Make fields final if possible to ensure immutability
This commit is contained in:
@@ -45,7 +45,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
private ForgeDirection forward = ForgeDirection.UNKNOWN;
|
||||
private ForgeDirection up = ForgeDirection.UNKNOWN;
|
||||
|
||||
public static ThreadLocal<WeakReference<AEBaseTile>> dropNoItems = new ThreadLocal<WeakReference<AEBaseTile>>();
|
||||
public static final ThreadLocal<WeakReference<AEBaseTile>> dropNoItems = new ThreadLocal<WeakReference<AEBaseTile>>();
|
||||
|
||||
public void disableDrops()
|
||||
{
|
||||
|
||||
@@ -62,10 +62,10 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IAEAppEn
|
||||
static final int[] sides = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
static final ItemStack assemblerStack = AEApi.instance().blocks().blockMolecularAssembler.stack( 1 );
|
||||
|
||||
private InventoryCrafting craftingInv = new InventoryCrafting( new ContainerNull(), 3, 3 );
|
||||
private AppEngInternalInventory inv = new AppEngInternalInventory( this, 9 + 2 );
|
||||
private IConfigManager settings = new ConfigManager( this );
|
||||
private UpgradeInventory upgrades = new UpgradeInventory( assemblerStack, this, getUpgradeSlots() );
|
||||
private final InventoryCrafting craftingInv = new InventoryCrafting( new ContainerNull(), 3, 3 );
|
||||
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 9 + 2 );
|
||||
private final IConfigManager settings = new ConfigManager( this );
|
||||
private final UpgradeInventory upgrades = new UpgradeInventory( assemblerStack, this, getUpgradeSlots() );
|
||||
|
||||
private ForgeDirection pushDirection = ForgeDirection.UNKNOWN;
|
||||
private ItemStack myPattern = null;
|
||||
|
||||
@@ -25,7 +25,7 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH
|
||||
gridProxy.writeToNBT( data );
|
||||
}
|
||||
|
||||
protected AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", getItemFromTile( this ), true );
|
||||
protected final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", getItemFromTile( this ), true );
|
||||
|
||||
@Override
|
||||
public AENetworkProxy getProxy()
|
||||
|
||||
@@ -27,7 +27,7 @@ public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IA
|
||||
gridProxy.writeToNBT( data );
|
||||
}
|
||||
|
||||
protected AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", getItemFromTile( this ), true );
|
||||
protected final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", getItemFromTile( this ), true );
|
||||
|
||||
@Override
|
||||
public AENetworkProxy getProxy()
|
||||
|
||||
@@ -24,7 +24,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
|
||||
|
||||
final int inputs[] = new int[] { 0, 1, 2 };
|
||||
final int sides[] = new int[] { 0, 1, 2, 3, 4, 5 };
|
||||
AppEngInternalInventory inv = new AppEngInternalInventory( this, 7 );
|
||||
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 7 );
|
||||
|
||||
@Override
|
||||
public void setOrientation(ForgeDirection inForward, ForgeDirection inUp)
|
||||
|
||||
@@ -17,11 +17,11 @@ import appeng.util.iterators.InvIterator;
|
||||
public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack>
|
||||
{
|
||||
|
||||
protected IAEAppEngInventory te;
|
||||
int size;
|
||||
protected final IAEAppEngInventory te;
|
||||
final int size;
|
||||
int maxStack;
|
||||
|
||||
protected IAEItemStack inv[];
|
||||
protected final IAEItemStack[] inv;
|
||||
|
||||
public boolean isEmpty()
|
||||
{
|
||||
|
||||
@@ -16,11 +16,11 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
|
||||
{
|
||||
|
||||
protected IAEAppEngInventory te;
|
||||
protected int size;
|
||||
protected final int size;
|
||||
protected int maxStack;
|
||||
|
||||
public boolean enableClientEvents = false;
|
||||
protected ItemStack inv[];
|
||||
protected final ItemStack[] inv;
|
||||
|
||||
public IMEInventory getMEInventory()
|
||||
{
|
||||
|
||||
@@ -26,9 +26,9 @@ import appeng.util.IConfigManagerHost;
|
||||
public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, IAEAppEngInventory, IConfigurableObject, IConfigManagerHost
|
||||
{
|
||||
|
||||
AppEngInternalInventory cell = new AppEngInternalInventory( this, 1 );
|
||||
AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 63 );
|
||||
ConfigManager cm = new ConfigManager( this );
|
||||
final AppEngInternalInventory cell = new AppEngInternalInventory( this, 1 );
|
||||
final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 63 );
|
||||
final ConfigManager cm = new ConfigManager( this );
|
||||
|
||||
IInventory cacheUpgrades = null;
|
||||
IInventory cacheConfig = null;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
|
||||
{
|
||||
|
||||
final int sides[] = new int[] { 0 };
|
||||
AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 );
|
||||
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 );
|
||||
int tickTickTimer = 0;
|
||||
|
||||
int lastUpdate = 0;
|
||||
|
||||
@@ -27,10 +27,10 @@ import appeng.util.Platform;
|
||||
public class TileCondenser extends AEBaseInvTile implements IAEAppEngInventory, IFluidHandler, IConfigManagerHost, IConfigurableObject
|
||||
{
|
||||
|
||||
int sides[] = new int[] { 0, 1 };
|
||||
static private FluidTankInfo[] empty = new FluidTankInfo[] { new FluidTankInfo( null, 10 ) };
|
||||
AppEngInternalInventory inv = new AppEngInternalInventory( this, 3 );
|
||||
ConfigManager cm = new ConfigManager( this );
|
||||
final int[] sides = new int[] { 0, 1 };
|
||||
static private final FluidTankInfo[] empty = new FluidTankInfo[] { new FluidTankInfo( null, 10 ) };
|
||||
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 3 );
|
||||
final ConfigManager cm = new ConfigManager( this );
|
||||
|
||||
public double storedPower = 0;
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
final int bottom[] = new int[] { 1 };
|
||||
final int sides[] = new int[] { 2, 3 };
|
||||
|
||||
AppEngInternalInventory inv = new AppEngInternalInventory( this, 4 );
|
||||
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 4 );
|
||||
|
||||
public final int maxProcessingTime = 100;
|
||||
public int processingTime = 0;
|
||||
@@ -58,8 +58,8 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
public long clientStart;
|
||||
|
||||
static final ItemStack inscriberStack = AEApi.instance().blocks().blockInscriber.stack( 1 );
|
||||
private IConfigManager settings = new ConfigManager( this );
|
||||
private UpgradeInventory upgrades = new UpgradeInventory( inscriberStack, this, getUpgradeSlots() );
|
||||
private final IConfigManager settings = new ConfigManager( this );
|
||||
private final UpgradeInventory upgrades = new UpgradeInventory( inscriberStack, this, getUpgradeSlots() );
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType(ForgeDirection dir)
|
||||
|
||||
@@ -50,7 +50,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IS
|
||||
{
|
||||
|
||||
ForgeDirection pointAt = ForgeDirection.UNKNOWN;
|
||||
DualityInterface duality = new DualityInterface( gridProxy, this );
|
||||
final DualityInterface duality = new DualityInterface( gridProxy, this );
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void stateChange(MENetworkChannelsChanged c)
|
||||
|
||||
@@ -62,17 +62,17 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
||||
{
|
||||
|
||||
private static int difference = 0;
|
||||
private IConfigManager cm = new ConfigManager( this );
|
||||
private final IConfigManager cm = new ConfigManager( this );
|
||||
|
||||
private SecurityInventory inventory = new SecurityInventory( this );
|
||||
private MEMonitorHandler<IAEItemStack> securityMonitor = new MEMonitorHandler<IAEItemStack>( inventory );
|
||||
private final SecurityInventory inventory = new SecurityInventory( this );
|
||||
private final MEMonitorHandler<IAEItemStack> securityMonitor = new MEMonitorHandler<IAEItemStack>( inventory );
|
||||
|
||||
private boolean isActive = false;
|
||||
|
||||
AEColor paintedColor = AEColor.Transparent;
|
||||
public long securityKey;
|
||||
|
||||
public AppEngInternalInventory configSlot = new AppEngInternalInventory( this, 1 );
|
||||
public final AppEngInternalInventory configSlot = new AppEngInternalInventory( this, 1 );
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack)
|
||||
|
||||
@@ -31,7 +31,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
|
||||
final double powerPerTick = 5;
|
||||
|
||||
final int sides[] = new int[] { 0 };
|
||||
AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 );
|
||||
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 );
|
||||
|
||||
public int burnSpeed = 100;
|
||||
public double burnTime = 0;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
|
||||
public static final int CHANNEL_FLAG = 2;
|
||||
|
||||
final int sides[] = new int[] { 0 };
|
||||
AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 );
|
||||
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 );
|
||||
|
||||
public int clientFlags = 0;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
|
||||
// values that determine general function, are set by inheriting classes if
|
||||
// needed. These should generally remain static.
|
||||
protected double internalMaxPower = 10000;
|
||||
protected boolean internalCanAcceptPower = true;
|
||||
protected final boolean internalCanAcceptPower = true;
|
||||
protected boolean internalPublicPowerStorage = false;
|
||||
private EnumSet<ForgeDirection> internalPowerSides = EnumSet.allOf( ForgeDirection.class );
|
||||
|
||||
|
||||
@@ -36,13 +36,13 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
||||
final int sidesRing[] = new int[] {};
|
||||
final int sidesLink[] = new int[] { 0 };
|
||||
|
||||
AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 );
|
||||
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 );
|
||||
|
||||
public final byte corner = 16;
|
||||
final byte hasSingularity = 32;
|
||||
final byte powered = 64;
|
||||
|
||||
private QuantumCalculator calc = new QuantumCalculator( this );
|
||||
private final QuantumCalculator calc = new QuantumCalculator( this );
|
||||
byte constructed = -1;
|
||||
|
||||
QuantumCluster cluster;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements Callable
|
||||
{
|
||||
|
||||
final int sides[] = { 0, 1 };
|
||||
AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 );
|
||||
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 );
|
||||
YesNo lastRedstoneState = YesNo.UNDECIDED;
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
|
||||
@@ -77,9 +77,9 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
||||
static final int front[] = new int[] { 1 };
|
||||
static final int noSlots[] = new int[] {};
|
||||
|
||||
AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 );
|
||||
BaseActionSource mySrc = new MachineSource( this );
|
||||
IConfigManager config = new ConfigManager( this );
|
||||
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 );
|
||||
final BaseActionSource mySrc = new MachineSource( this );
|
||||
final IConfigManager config = new ConfigManager( this );
|
||||
|
||||
ItemStack storageType;
|
||||
long lastStateChange = 0;
|
||||
|
||||
@@ -43,15 +43,15 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
||||
{
|
||||
|
||||
final int sides[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
AppEngInternalInventory inv = new AppEngInternalInventory( this, 10 );
|
||||
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 10 );
|
||||
|
||||
boolean isCached = false;
|
||||
ICellHandler handlersBySlot[] = new ICellHandler[10];
|
||||
DriveWatcher<IAEItemStack> invBySlot[] = new DriveWatcher[10];
|
||||
final ICellHandler[] handlersBySlot = new ICellHandler[10];
|
||||
final DriveWatcher<IAEItemStack>[] invBySlot = new DriveWatcher[10];
|
||||
List<MEInventoryHandler> items = new LinkedList<MEInventoryHandler>();
|
||||
List<MEInventoryHandler> fluids = new LinkedList<MEInventoryHandler>();
|
||||
|
||||
BaseActionSource mySrc;
|
||||
final BaseActionSource mySrc;
|
||||
long lastStateChange = 0;
|
||||
int state = 0;
|
||||
int priority = 0;
|
||||
|
||||
@@ -48,17 +48,17 @@ import appeng.util.inv.WrapperInventoryRange;
|
||||
public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IConfigManagerHost, IGridTickable
|
||||
{
|
||||
|
||||
ConfigManager cm = new ConfigManager( this );
|
||||
final ConfigManager cm = new ConfigManager( this );
|
||||
|
||||
final int input[] = { 0, 1, 2, 3, 4, 5 };
|
||||
final int output[] = { 6, 7, 8, 9, 10, 11 };
|
||||
|
||||
final int outputSlots[] = { 6, 7, 8, 9, 10, 11 };
|
||||
|
||||
AppEngInternalInventory cells = new AppEngInternalInventory( this, 12 );
|
||||
UpgradeInventory upgrades = new UpgradeInventory( AEApi.instance().blocks().blockIOPort.block(), this, 3 );
|
||||
final AppEngInternalInventory cells = new AppEngInternalInventory( this, 12 );
|
||||
final UpgradeInventory upgrades = new UpgradeInventory( AEApi.instance().blocks().blockIOPort.block(), this, 3 );
|
||||
|
||||
BaseActionSource mySrc = new MachineSource( this );
|
||||
final BaseActionSource mySrc = new MachineSource( this );
|
||||
|
||||
YesNo lastRedstoneState = YesNo.UNDECIDED;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user