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
@@ -11,8 +11,8 @@ import appeng.util.Platform;
public class AdaptorIInventory extends InventoryAdaptor
{
private IInventory i;
private boolean wrapperEnabled;
private final IInventory i;
private final boolean wrapperEnabled;
public AdaptorIInventory(IInventory s) {
i = s;
@@ -12,10 +12,10 @@ import buildcraft.api.inventory.ISpecialInventory;
public class AdaptorISpecialInventory extends InventoryAdaptor
{
private AdaptorIInventory remover;
private final AdaptorIInventory remover;
private ISpecialInventory i;
private ForgeDirection d;
private final ISpecialInventory i;
private final ForgeDirection d;
public AdaptorISpecialInventory(ISpecialInventory s, ForgeDirection dd) {
i = s;
@@ -12,7 +12,7 @@ import appeng.util.iterators.StackToSlotIterator;
public class AdaptorList extends InventoryAdaptor
{
private List<ItemStack> i;
private final List<ItemStack> i;
public AdaptorList(List<ItemStack> s) {
i = s;
@@ -15,7 +15,7 @@ import appeng.util.iterators.NullIterator;
public class AdaptorPlayerHand extends InventoryAdaptor
{
private EntityPlayer p;
private final EntityPlayer p;
public AdaptorPlayerHand(EntityPlayer _p) {
p = _p;
@@ -18,8 +18,8 @@ import com.google.common.collect.ImmutableList;
public class IMEAdaptor extends InventoryAdaptor
{
IMEInventory<IAEItemStack> target;
BaseActionSource src;
final IMEInventory<IAEItemStack> target;
final BaseActionSource src;
int maxSlots = 0;
public IMEAdaptor(IMEInventory<IAEItemStack> input, BaseActionSource src) {
@@ -8,8 +8,8 @@ import appeng.api.storage.data.IItemList;
public class IMEAdaptorIterator implements Iterator<ItemSlot>
{
Iterator<IAEItemStack> stack;
ItemSlot slot = new ItemSlot();
final Iterator<IAEItemStack> stack;
final ItemSlot slot = new ItemSlot();
int offset = 0;
boolean hasNext;
@@ -9,7 +9,7 @@ import appeng.util.item.AEItemStack;
public class IMEInventoryDestination implements IInventoryDestination
{
IMEInventory<IAEItemStack> me;
final IMEInventory<IAEItemStack> me;
public IMEInventoryDestination(IMEInventory<IAEItemStack> o) {
me = o;
@@ -97,7 +97,7 @@ public class WrapperInvSlot
}
}
private IInventory inv;
private final IInventory inv;
public WrapperInvSlot(IInventory inv) {
this.inv = inv;
@@ -7,7 +7,7 @@ import net.minecraft.item.ItemStack;
public class WrapperInventoryRange implements IInventory
{
private IInventory src;
private final IInventory src;
int[] slots;
protected boolean ignoreValidItems = false;
@@ -8,8 +8,8 @@ import net.minecraftforge.common.util.ForgeDirection;
public class WrapperMCISidedInventory extends WrapperInventoryRange implements IInventory, IInventoryWrapper
{
private ForgeDirection dir;
ISidedInventory side;
private final ForgeDirection dir;
final ISidedInventory side;
public WrapperMCISidedInventory(ISidedInventory a, ForgeDirection d) {
super( a, a.getAccessibleSlotsFromSide( d.ordinal() ), false );
@@ -9,8 +9,8 @@ import net.minecraftforge.common.util.ForgeDirection;
public class WrapperTEPipe implements IInventory
{
TileEntity ad;
ForgeDirection dir;
final TileEntity ad;
final ForgeDirection dir;
public WrapperTEPipe(TileEntity te, ForgeDirection d) {
ad = te;