Make fields final if possible to ensure immutability

This commit is contained in:
thatsIch
2014-09-29 09:54:34 +02:00
parent 35f6c84d9f
commit 474596f095
261 changed files with 607 additions and 597 deletions
@@ -15,12 +15,12 @@ public class BlockRenderInfo
final public BaseBlockRender rendererInstance;
private boolean useTmp = false;
private TmpFlippableIcon tmpTopIcon = new TmpFlippableIcon();
private TmpFlippableIcon tmpBottomIcon = new TmpFlippableIcon();
private TmpFlippableIcon tmpSouthIcon = new TmpFlippableIcon();
private TmpFlippableIcon tmpNorthIcon = new TmpFlippableIcon();
private TmpFlippableIcon tmpEastIcon = new TmpFlippableIcon();
private TmpFlippableIcon tmpWestIcon = new TmpFlippableIcon();
private final TmpFlippableIcon tmpTopIcon = new TmpFlippableIcon();
private final TmpFlippableIcon tmpBottomIcon = new TmpFlippableIcon();
private final TmpFlippableIcon tmpSouthIcon = new TmpFlippableIcon();
private final TmpFlippableIcon tmpNorthIcon = new TmpFlippableIcon();
private final TmpFlippableIcon tmpEastIcon = new TmpFlippableIcon();
private final TmpFlippableIcon tmpWestIcon = new TmpFlippableIcon();
private FlippableIcon topIcon = null;
private FlippableIcon bottomIcon = null;
@@ -32,8 +32,8 @@ public class BusRenderHelper implements IPartRenderHelper
double maxY = 16;
double maxZ = 16;
AEBaseBlock blk = (AEBaseBlock) AEApi.instance().blocks().blockMultiPart.block();
BaseBlockRender bbr = new BaseBlockRender();
final AEBaseBlock blk = (AEBaseBlock) AEApi.instance().blocks().blockMultiPart.block();
final BaseBlockRender bbr = new BaseBlockRender();
private ForgeDirection ax = ForgeDirection.EAST;
private ForgeDirection ay = ForgeDirection.UP;
@@ -104,12 +104,12 @@ public class BusRenderHelper implements IPartRenderHelper
}
BoundBoxCalculator bbc = new BoundBoxCalculator();
final BoundBoxCalculator bbc = new BoundBoxCalculator();
int renderingForPass = 0;
int currentPass = 0;
int itemsRendered = 0;
boolean noAlphaPass = AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) == false;
final boolean noAlphaPass = AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) == false;
public int getItemsRendered()
{
@@ -28,7 +28,7 @@ public class BusRenderer implements IItemRenderer
public static final BusRenderer instance = new BusRenderer();
public RenderBlocksWorkaround renderer = new RenderBlocksWorkaround();
public final RenderBlocksWorkaround renderer = new RenderBlocksWorkaround();
public static final HashMap<Integer, IPart> renderPart = new HashMap<Integer, IPart>();
public IPart getRenderer(ItemStack is, IPartItem c)
@@ -42,19 +42,19 @@ public class RenderBlocksWorkaround extends RenderBlocks
public int bZPos;
public int bZNeg;
public int aoXPos[];
public int aoXNeg[];
public int aoYPos[];
public int aoYNeg[];
public int aoZPos[];
public int aoZNeg[];
public final int[] aoXPos;
public final int[] aoXNeg;
public final int[] aoYPos;
public final int[] aoYNeg;
public final int[] aoZPos;
public final int[] aoZNeg;
public float foXPos[];
public float foXNeg[];
public float foYPos[];
public float foYNeg[];
public float foZPos[];
public float foZNeg[];
public final float[] foXPos;
public final float[] foXNeg;
public final float[] foYPos;
public final float[] foYNeg;
public final float[] foZPos;
public final float[] foZNeg;
public int lightHash;
@@ -656,7 +656,7 @@ public class RenderBlocksWorkaround extends RenderBlocks
return ((LightingCache) sim).lightHash == lh;
}
int lightHashTmp[] = new int[27];
final int[] lightHashTmp = new int[27];
public float opacity = 1.0f;
private int getLightingHash(Block blk, IBlockAccess w, int x, int y, int z)
@@ -15,11 +15,11 @@ import org.lwjgl.opengl.GL11;
public class SpatialSkyRender extends IRenderHandler
{
private static SpatialSkyRender instance = new SpatialSkyRender();
private static final SpatialSkyRender instance = new SpatialSkyRender();
private Random random = new Random();
private final Random random = new Random();
private long cycle = 0;
private int dspList;
private final int dspList;
public SpatialSkyRender() {
dspList = GLAllocation.generateDisplayLists( 1 );
@@ -18,12 +18,12 @@ import cpw.mods.fml.relauncher.SideOnly;
public class WorldRender implements ISimpleBlockRenderingHandler
{
private RenderBlocks renderer = new RenderBlocks();
private final RenderBlocks renderer = new RenderBlocks();
final int renderID = RenderingRegistry.getNextAvailableRenderId();
public static final WorldRender instance = new WorldRender();
boolean hasError = false;
public HashMap<AEBaseBlock, BaseBlockRender> blockRenders = new HashMap<AEBaseBlock, BaseBlockRender>();
public final HashMap<AEBaseBlock, BaseBlockRender> blockRenders = new HashMap<AEBaseBlock, BaseBlockRender>();
void setRender(AEBaseBlock in, BaseBlockRender r)
{
@@ -19,7 +19,7 @@ import appeng.tile.storage.TileSkyChest;
public class RenderBlockSkyChest extends BaseBlockRender
{
ModelChest model = new ModelChest();
final ModelChest model = new ModelChest();
public RenderBlockSkyChest() {
super( true, 80 );
@@ -25,7 +25,7 @@ public class RenderBlockSkyCompass extends BaseBlockRender
{
float r = 0;
ModelCompass model = new ModelCompass();
final ModelCompass model = new ModelCompass();
public RenderBlockSkyCompass() {
super( true, 80 );
@@ -11,10 +11,10 @@ import appeng.entity.EntityFloatingItem;
public class AssemblerFX extends EntityFX
{
IAEItemStack item;
EntityFloatingItem fi;
final IAEItemStack item;
final EntityFloatingItem fi;
float time = 0;
float speed;
final float speed;
public AssemblerFX(World w, double x, double y, double z, double r, double g, double b, float speed, IAEItemStack is) {
super( w, x, y, z, r, g, b );
@@ -15,11 +15,11 @@ import cpw.mods.fml.relauncher.SideOnly;
public class CraftingFx extends EntityBreakingFX
{
private IIcon particleTextureIndex;
private final IIcon particleTextureIndex;
private int startBlkX;
private int startBlkY;
private int startBlkZ;
private final int startBlkX;
private final int startBlkY;
private final int startBlkZ;
@Override
public int getFXLayer()
@@ -15,11 +15,11 @@ import cpw.mods.fml.relauncher.SideOnly;
public class EnergyFx extends EntityBreakingFX
{
private IIcon particleTextureIndex;
private final IIcon particleTextureIndex;
private int startBlkX;
private int startBlkY;
private int startBlkZ;
private final int startBlkX;
private final int startBlkY;
private final int startBlkZ;
@Override
public int getFXLayer()
@@ -5,7 +5,9 @@ import net.minecraft.world.World;
public class LightningArcFX extends LightningFX
{
double rx, ry, rz;
final double rx;
final double ry;
final double rz;
public LightningArcFX(World w, double x, double y, double z, double ex, double ey, double ez, double r, double g, double b) {
super( w, x, y, z, r, g, b, 6 );
@@ -13,8 +13,8 @@ public class LightningFX extends EntityFX
{
final int steps = getSteps();
static Random rng = new Random();
double[][] Steps;
static final Random rng = new Random();
final double[][] Steps;
protected LightningFX(World w, double x, double y, double z, double r, double g, double b, int maxAge) {
super( w, x, y, z, r, g, b );
@@ -172,8 +172,8 @@ public class LightningFX extends EntityFX
}
boolean hasData = false;
double[] I = new double[3];
double[] K = new double[3];
final double[] I = new double[3];
final double[] K = new double[3];
private void draw(Tessellator tess, double[] a, double[] b, double f6, double f8)
{
@@ -11,7 +11,7 @@ import appeng.client.texture.ExtraBlockTextures;
public class MatterCannonFX extends EntityBreakingFX
{
private IIcon particleTextureIndex;
private final IIcon particleTextureIndex;
public MatterCannonFX(World par1World, double par2, double par4, double par6, Item par8Item) {
super( par1World, par2, par4, par6, par8Item );
@@ -14,7 +14,7 @@ import appeng.items.misc.ItemEncodedPattern;
public class ItemEncodedPatternRenderer implements IItemRenderer
{
RenderItem ri = new RenderItem();
final RenderItem ri = new RenderItem();
boolean recursive;
@Override
@@ -6,14 +6,14 @@ import net.minecraft.client.model.ModelRenderer;
public class ModelCompass extends ModelBase
{
ModelRenderer Ring1;
ModelRenderer Ring2;
ModelRenderer Ring3;
ModelRenderer Ring4;
ModelRenderer Middle;
ModelRenderer Base;
final ModelRenderer Ring1;
final ModelRenderer Ring2;
final ModelRenderer Ring3;
final ModelRenderer Ring4;
final ModelRenderer Middle;
final ModelRenderer Base;
ModelRenderer Pointer;
final ModelRenderer Pointer;
public ModelCompass() {
textureWidth = 16;