Reduces visibility of internal fields/methods

Reduces the visibility of all fields to private and create setters/getters
when necessary. Exceptions are fields with GuiSync as these need to be
public.

Reduces the visibility of internal methods to private/protected/default when possible.
This commit is contained in:
yueh
2015-10-08 15:42:42 +02:00
parent 1ea48fb389
commit 500fc47490
463 changed files with 5670 additions and 3757 deletions
+4 -4
View File
@@ -64,12 +64,12 @@ import appeng.util.SettingsFrom;
public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, ICustomNameObject
{
public static final ThreadLocal<WeakReference<AEBaseTile>> DROP_NO_ITEMS = new ThreadLocal<WeakReference<AEBaseTile>>();
private static final ThreadLocal<WeakReference<AEBaseTile>> DROP_NO_ITEMS = new ThreadLocal<WeakReference<AEBaseTile>>();
private static final Map<Class<? extends AEBaseTile>, Map<TileEventType, List<AETileEventHandler>>> HANDLERS = new HashMap<Class<? extends AEBaseTile>, Map<TileEventType, List<AETileEventHandler>>>();
private static final Map<Class<? extends TileEntity>, IStackSrc> ITEM_STACKS = new HashMap<Class<? extends TileEntity>, IStackSrc>();
private int renderFragment = 0;
@Nullable
public String customName;
private String customName;
private ForgeDirection forward = ForgeDirection.UNKNOWN;
private ForgeDirection up = ForgeDirection.UNKNOWN;
@@ -243,7 +243,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
}
public final boolean readFromStream( final ByteBuf data )
private final boolean readFromStream( final ByteBuf data )
{
boolean output = false;
@@ -302,7 +302,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
}
public final void writeToStream( final ByteBuf data )
private final void writeToStream( final ByteBuf data )
{
try
{
@@ -42,13 +42,13 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
{
@SideOnly( Side.CLIENT )
public Integer dspList;
private Integer dspList;
@SideOnly( Side.CLIENT )
public boolean updateList;
private boolean updateList;
IAEItemStack dspPlay;
AEColor paintedColor = AEColor.Transparent;
private IAEItemStack dspPlay;
private AEColor paintedColor = AEColor.Transparent;
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileCraftingMonitorTile( final ByteBuf data ) throws IOException
@@ -67,7 +67,7 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
this.dspPlay = null;
}
this.updateList = true;
this.setUpdateList( true );
return oldPaintedColor != this.paintedColor; // tesr!
}
@@ -161,4 +161,24 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
this.markForUpdate();
return true;
}
public Integer getDisplayList()
{
return this.dspList;
}
public void setDisplayList( final Integer dspList )
{
this.dspList = dspList;
}
public boolean isUpdateList()
{
return this.updateList;
}
public void setUpdateList( final boolean updateList )
{
this.updateList = updateList;
}
}
@@ -27,7 +27,7 @@ import appeng.api.definitions.IBlocks;
public class TileCraftingStorageTile extends TileCraftingTile
{
public static final int KILO_SCALAR = 1024;
private static final int KILO_SCALAR = 1024;
@Override
protected ItemStack getItemFromTile( final Object obj )
@@ -57,16 +57,16 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
private final CraftingCPUCalculator calc = new CraftingCPUCalculator( this );
public ISimplifiedBundle lightCache;
private ISimplifiedBundle lightCache;
public NBTTagCompound previousState = null;
public boolean isCoreBlock = false;
CraftingCPUCluster cluster;
private NBTTagCompound previousState = null;
private boolean isCoreBlock = false;
private CraftingCPUCluster cluster;
public TileCraftingTile()
{
this.gridProxy.setFlags( GridFlags.MULTIBLOCK, GridFlags.REQUIRE_CHANNEL );
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.getProxy().setFlags( GridFlags.MULTIBLOCK, GridFlags.REQUIRE_CHANNEL );
this.getProxy().setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
}
@Override
@@ -119,7 +119,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
public void onReady()
{
super.onReady();
this.gridProxy.setVisualRepresentation( this.getItemFromTile( this ) );
this.getProxy().setVisualRepresentation( this.getItemFromTile( this ) );
this.updateMultiBlock();
}
@@ -149,9 +149,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
final boolean formed = this.isFormed();
boolean power = false;
if( this.gridProxy.isReady() )
if( this.getProxy().isReady() )
{
power = this.gridProxy.isActive();
power = this.getProxy().isActive();
}
final int current = this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord );
@@ -166,11 +166,11 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
if( formed )
{
this.gridProxy.setValidSides( EnumSet.allOf( ForgeDirection.class ) );
this.getProxy().setValidSides( EnumSet.allOf( ForgeDirection.class ) );
}
else
{
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.getProxy().setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
}
}
}
@@ -187,8 +187,8 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileCraftingTile( final NBTTagCompound data )
{
data.setBoolean( "core", this.isCoreBlock );
if( this.isCoreBlock && this.cluster != null )
data.setBoolean( "core", this.isCoreBlock() );
if( this.isCoreBlock() && this.cluster != null )
{
this.cluster.writeToNBT( data );
}
@@ -197,8 +197,8 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileCraftingTile( final NBTTagCompound data )
{
this.isCoreBlock = data.getBoolean( "core" );
if( this.isCoreBlock )
this.setCoreBlock( data.getBoolean( "core" ) );
if( this.isCoreBlock() )
{
if( this.cluster != null )
{
@@ -206,7 +206,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
}
else
{
this.previousState = (NBTTagCompound) data.copy();
this.setPreviousState( (NBTTagCompound) data.copy() );
}
}
}
@@ -333,7 +333,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
return ( this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord ) & 4 ) == 4;
}
return this.gridProxy.isActive();
return this.getProxy().isActive();
}
@Override
@@ -341,8 +341,38 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
if( Platform.isServer() )
{
return this.gridProxy.isActive();
return this.getProxy().isActive();
}
return this.isPowered() && this.isFormed();
}
public boolean isCoreBlock()
{
return this.isCoreBlock;
}
public void setCoreBlock( final boolean isCoreBlock )
{
this.isCoreBlock = isCoreBlock;
}
public ISimplifiedBundle getLightCache()
{
return this.lightCache;
}
public void setLightCache( final ISimplifiedBundle lightCache )
{
this.lightCache = lightCache;
}
public NBTTagCompound getPreviousState()
{
return this.previousState;
}
public void setPreviousState( final NBTTagCompound previousState )
{
this.previousState = previousState;
}
}
@@ -85,7 +85,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 9 + 2 );
private final IConfigManager settings;
private final UpgradeInventory upgrades;
public ISimplifiedBundle lightCache;
private ISimplifiedBundle lightCache;
private boolean isPowered = false;
private ForgeDirection pushDirection = ForgeDirection.UNKNOWN;
private ItemStack myPattern = null;
@@ -102,12 +102,12 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
this.settings = new ConfigManager( this );
this.settings.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
this.inv.setMaxStackSize( 1 );
this.gridProxy.setIdlePowerUsage( 0.0 );
this.getGridProxy().setIdlePowerUsage( 0.0 );
this.upgrades = new DefinitionUpgradeInventory( assembler, this, this.getUpgradeSlots() );
this.craftingInv = new InventoryCrafting( new ContainerNull(), 3, 3 );
}
protected int getUpgradeSlots()
private int getUpgradeSlots()
{
return 5;
}
@@ -152,11 +152,11 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
if( this.isAwake )
{
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
this.getGridProxy().getTick().wakeDevice( this.getGridProxy().getNode() );
}
else
{
this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
this.getGridProxy().getTick().sleepDevice( this.getGridProxy().getNode() );
}
}
catch( final GridAccessException e )
@@ -553,7 +553,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
try
{
return (int) ( this.gridProxy.getEnergy().extractAEPower( ticksPassed * bonusValue * acceleratorTax, Actionable.MODULATE, PowerMultiplier.CONFIG ) / acceleratorTax );
return (int) ( this.getGridProxy().getEnergy().extractAEPower( ticksPassed * bonusValue * acceleratorTax, Actionable.MODULATE, PowerMultiplier.CONFIG ) / acceleratorTax );
}
catch( final GridAccessException e )
{
@@ -629,7 +629,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
try
{
newState = this.gridProxy.isActive() && this.gridProxy.getEnergy().extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.0001;
newState = this.getGridProxy().isActive() && this.getGridProxy().getEnergy().extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.0001;
}
catch( final GridAccessException ignored )
{
@@ -654,4 +654,14 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
return this.isPowered;
}
public ISimplifiedBundle getLightCache()
{
return this.lightCache;
}
public void setLightCache( final ISimplifiedBundle lightCache )
{
this.lightCache = lightCache;
}
}
@@ -34,24 +34,24 @@ import appeng.tile.events.TileEventType;
public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionHost, IGridProxyable
{
protected final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true );
private final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true );
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_AENetwork( final NBTTagCompound data )
{
this.gridProxy.readFromNBT( data );
this.getGridProxy().readFromNBT( data );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_AENetwork( final NBTTagCompound data )
{
this.gridProxy.writeToNBT( data );
this.getGridProxy().writeToNBT( data );
}
@Override
public AENetworkProxy getProxy()
{
return this.gridProxy;
return this.getGridProxy();
}
@Override
@@ -63,40 +63,45 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH
@Override
public IGridNode getGridNode( final ForgeDirection dir )
{
return this.gridProxy.getNode();
return this.getGridProxy().getNode();
}
@Override
public void onChunkUnload()
{
super.onChunkUnload();
this.gridProxy.onChunkUnload();
this.getGridProxy().onChunkUnload();
}
@Override
public void onReady()
{
super.onReady();
this.gridProxy.onReady();
this.getGridProxy().onReady();
}
@Override
public void invalidate()
{
super.invalidate();
this.gridProxy.invalidate();
this.getGridProxy().invalidate();
}
@Override
public void validate()
{
super.validate();
this.gridProxy.validate();
this.getGridProxy().validate();
}
@Override
public IGridNode getActionableNode()
{
return this.gridProxy.getNode();
return this.getGridProxy().getNode();
}
public AENetworkProxy getGridProxy()
{
return this.gridProxy;
}
}
@@ -36,18 +36,18 @@ import appeng.tile.powersink.AEBasePoweredTile;
public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IActionHost, IGridProxyable
{
protected final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true );
private final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true );
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_AENetwork( final NBTTagCompound data )
{
this.gridProxy.readFromNBT( data );
this.getProxy().readFromNBT( data );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_AENetwork( final NBTTagCompound data )
{
this.gridProxy.writeToNBT( data );
this.getProxy().writeToNBT( data );
}
@Override
@@ -71,7 +71,7 @@ public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IA
@Override
public IGridNode getGridNode( final ForgeDirection dir )
{
return this.gridProxy.getNode();
return this.getProxy().getNode();
}
@Override
@@ -84,33 +84,34 @@ public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IA
public void validate()
{
super.validate();
this.gridProxy.validate();
this.getProxy().validate();
}
@Override
public void invalidate()
{
super.invalidate();
this.gridProxy.invalidate();
this.getProxy().invalidate();
}
@Override
public void onChunkUnload()
{
super.onChunkUnload();
this.gridProxy.onChunkUnload();
this.getProxy().onChunkUnload();
}
@Override
public void onReady()
{
super.onReady();
this.gridProxy.onReady();
this.getProxy().onReady();
}
@Override
public IGridNode getActionableNode()
{
return this.gridProxy.getNode();
return this.getProxy().getNode();
}
}
@@ -36,18 +36,18 @@ import appeng.tile.events.TileEventType;
public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxyable
{
protected final AENetworkProxy gridProxy = this.createProxy();
private final AENetworkProxy gridProxy = this.createProxy();
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_AENetwork( final NBTTagCompound data )
{
this.gridProxy.readFromNBT( data );
this.getProxy().readFromNBT( data );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_AENetwork( final NBTTagCompound data )
{
this.gridProxy.writeToNBT( data );
this.getProxy().writeToNBT( data );
}
protected AENetworkProxy createProxy()
@@ -58,7 +58,7 @@ public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxy
@Override
public IGridNode getGridNode( final ForgeDirection dir )
{
return this.gridProxy.getNode();
return this.getProxy().getNode();
}
@Override
@@ -71,28 +71,28 @@ public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxy
public void onChunkUnload()
{
super.onChunkUnload();
this.gridProxy.onChunkUnload();
this.getProxy().onChunkUnload();
}
@Override
public void onReady()
{
super.onReady();
this.gridProxy.onReady();
this.getProxy().onReady();
}
@Override
public void invalidate()
{
super.invalidate();
this.gridProxy.invalidate();
this.getProxy().invalidate();
}
@Override
public void validate()
{
super.validate();
this.gridProxy.validate();
this.getProxy().validate();
}
@Override
@@ -116,6 +116,6 @@ public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxy
@Override
public IGridNode getActionableNode()
{
return this.gridProxy.getNode();
return this.getProxy().getNode();
}
}
@@ -41,21 +41,21 @@ import appeng.util.Platform;
public class TileCrank extends AEBaseTile implements ICustomCollision
{
final int ticksPerRotation = 18;
private final int ticksPerRotation = 18;
// sided values..
public float visibleRotation = 0;
public int charge = 0;
private float visibleRotation = 0;
private int charge = 0;
public int hits = 0;
public int rotation = 0;
private int hits = 0;
private int rotation = 0;
@TileEvent( TileEventType.TICK )
public void Tick_TileCrank()
{
if( this.rotation > 0 )
{
this.visibleRotation -= 360 / ( this.ticksPerRotation );
this.setVisibleRotation( this.getVisibleRotation() - 360 / ( this.ticksPerRotation ) );
this.charge++;
if( this.charge >= this.ticksPerRotation )
{
@@ -71,7 +71,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
}
}
public ICrankable getGrinder()
private ICrankable getGrinder()
{
if( Platform.isClient() )
{
@@ -168,4 +168,14 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
out.add( AxisAlignedBB.getBoundingBox( xOff + 0.15, yOff + 0.15, zOff + 0.15,// ahh
xOff + 0.85, yOff + 0.85, zOff + 0.85 ) );
}
public float getVisibleRotation()
{
return this.visibleRotation;
}
private void setVisibleRotation( final float visibleRotation )
{
this.visibleRotation = visibleRotation;
}
}
@@ -41,10 +41,10 @@ import appeng.util.inv.WrapperInventoryRange;
public class TileGrinder extends AEBaseInvTile implements ICrankable
{
final int[] inputs = { 0, 1, 2 };
final int[] sides = { 0, 1, 2, 3, 4, 5 };
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 7 );
int points;
private final int[] inputs = { 0, 1, 2 };
private final int[] sides = { 0, 1, 2, 3, 4, 5 };
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 7 );
private int points;
@Override
public void setOrientation( final ForgeDirection inForward, final ForgeDirection inUp )
@@ -38,10 +38,10 @@ import appeng.util.iterators.InvIterator;
public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack>
{
protected final IAEAppEngInventory te;
protected final IAEItemStack[] inv;
final int size;
int maxStack;
private final IAEAppEngInventory te;
private final IAEItemStack[] inv;
private final int size;
private int maxStack;
public AppEngInternalAEInventory( final IAEAppEngInventory te, final int s )
{
@@ -80,7 +80,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
data.setTag( name, c );
}
public void writeToNBT( final NBTTagCompound target )
private void writeToNBT( final NBTTagCompound target )
{
for( int x = 0; x < this.size; x++ )
{
@@ -110,7 +110,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
}
}
public void readFromNBT( final NBTTagCompound target )
private void readFromNBT( final NBTTagCompound target )
{
for( int x = 0; x < this.size; x++ )
{
@@ -36,15 +36,15 @@ import appeng.util.iterators.InvIterator;
public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
{
protected final int size;
protected final ItemStack[] inv;
public boolean enableClientEvents = false;
protected IAEAppEngInventory te;
protected int maxStack;
private final int size;
private final ItemStack[] inv;
private boolean enableClientEvents = false;
private IAEAppEngInventory te;
private int maxStack;
public AppEngInternalInventory( final IAEAppEngInventory inventory, final int size )
{
this.te = inventory;
this.setTileEntity( inventory );
this.size = size;
this.maxStack = 64;
this.inv = new ItemStack[size];
@@ -97,9 +97,9 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
ns = split.splitStack( qty );
}
if( this.te != null && this.eventsEnabled() )
if( this.getTileEntity() != null && this.eventsEnabled() )
{
this.te.onChangeInventory( this, slot, InvOperation.decreaseStackSize, ns, null );
this.getTileEntity().onChangeInventory( this, slot, InvOperation.decreaseStackSize, ns, null );
}
this.markDirty();
@@ -111,7 +111,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
protected boolean eventsEnabled()
{
return Platform.isServer() || this.enableClientEvents;
return Platform.isServer() || this.isEnableClientEvents();
}
@Override
@@ -126,7 +126,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
final ItemStack oldStack = this.inv[slot];
this.inv[slot] = newItemStack;
if( this.te != null && this.eventsEnabled() )
if( this.getTileEntity() != null && this.eventsEnabled() )
{
ItemStack removed = oldStack;
ItemStack added = newItemStack;
@@ -151,7 +151,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
}
}
this.te.onChangeInventory( this, slot, InvOperation.setInventorySlotContents, removed, added );
this.getTileEntity().onChangeInventory( this, slot, InvOperation.setInventorySlotContents, removed, added );
this.markDirty();
}
@@ -178,9 +178,9 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
@Override
public void markDirty()
{
if( this.te != null && this.eventsEnabled() )
if( this.getTileEntity() != null && this.eventsEnabled() )
{
this.te.onChangeInventory( this, -1, InvOperation.markDirty, null, null );
this.getTileEntity().onChangeInventory( this, -1, InvOperation.markDirty, null, null );
}
}
@@ -214,9 +214,9 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
// for guis...
public void markDirty( final int slotIndex )
{
if( this.te != null && this.eventsEnabled() )
if( this.getTileEntity() != null && this.eventsEnabled() )
{
this.te.onChangeInventory( this, slotIndex, InvOperation.markDirty, null, null );
this.getTileEntity().onChangeInventory( this, slotIndex, InvOperation.markDirty, null, null );
}
}
@@ -227,7 +227,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
data.setTag( name, c );
}
public void writeToNBT( final NBTTagCompound target )
private void writeToNBT( final NBTTagCompound target )
{
for( int x = 0; x < this.size; x++ )
{
@@ -282,4 +282,24 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
{
return new InvIterator( this );
}
private boolean isEnableClientEvents()
{
return this.enableClientEvents;
}
public void setEnableClientEvents( final boolean enableClientEvents )
{
this.enableClientEvents = enableClientEvents;
}
private IAEAppEngInventory getTileEntity()
{
return this.te;
}
public void setTileEntity( final IAEAppEngInventory te )
{
this.te = te;
}
}
@@ -46,18 +46,18 @@ import appeng.util.IConfigManagerHost;
public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, IAEAppEngInventory, IConfigManagerHost
{
final AppEngInternalInventory cell = new AppEngInternalInventory( this, 1 );
final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 63 );
final ConfigManager manager = new ConfigManager( this );
private final AppEngInternalInventory cell = new AppEngInternalInventory( this, 1 );
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 63 );
private final ConfigManager manager = new ConfigManager( this );
IInventory cacheUpgrades = null;
IInventory cacheConfig = null;
private IInventory cacheUpgrades = null;
private IInventory cacheConfig = null;
private boolean locked = false;
public TileCellWorkbench()
{
this.manager.registerSetting( Settings.COPY_MODE, CopyMode.CLEAR_ON_REMOVE );
this.cell.enableClientEvents = true;
this.cell.setEnableClientEvents( true );
}
public IInventory getCellUpgradeInventory()
+21 -21
View File
@@ -55,19 +55,19 @@ import appeng.util.item.AEItemStack;
public class TileCharger extends AENetworkPowerTile implements ICrankable
{
final int[] sides = { 0 };
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 );
int tickTickTimer = 0;
private final int[] sides = { 0 };
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 );
private int tickTickTimer = 0;
int lastUpdate = 0;
boolean requiresUpdate = false;
private int lastUpdate = 0;
private boolean requiresUpdate = false;
public TileCharger()
{
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.gridProxy.setFlags();
this.internalMaxPower = 1500;
this.gridProxy.setIdlePowerUsage( 0 );
this.getProxy().setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.getProxy().setFlags();
this.setInternalMaxPower( 1500 );
this.getProxy().setIdlePowerUsage( 0 );
}
@Override
@@ -123,11 +123,11 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
final ItemStack myItem = this.getStackInSlot( 0 );
// charge from the network!
if( this.internalCurrentPower < 1499 )
if( this.getInternalCurrentPower() < 1499 )
{
try
{
this.injectExternalPower( PowerUnits.AE, this.gridProxy.getEnergy().extractAEPower( Math.min( 150.0, 1500.0 - this.internalCurrentPower ), Actionable.MODULATE, PowerMultiplier.ONE ) );
this.injectExternalPower( PowerUnits.AE, this.getProxy().getEnergy().extractAEPower( Math.min( 150.0, 1500.0 - this.getInternalCurrentPower() ), Actionable.MODULATE, PowerMultiplier.ONE ) );
this.tickTickTimer = 20; // keep ticking...
}
catch( final GridAccessException e )
@@ -143,27 +143,27 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
final IMaterials materials = AEApi.instance().definitions().materials();
if( this.internalCurrentPower > 149 && Platform.isChargeable( myItem ) )
if( this.getInternalCurrentPower() > 149 && Platform.isChargeable( myItem ) )
{
final IAEItemPowerStorage ps = (IAEItemPowerStorage) myItem.getItem();
if( ps.getAEMaxPower( myItem ) > ps.getAECurrentPower( myItem ) )
{
final double oldPower = this.internalCurrentPower;
final double oldPower = this.getInternalCurrentPower();
final double adjustment = ps.injectAEPower( myItem, this.extractAEPower( 150.0, Actionable.MODULATE, PowerMultiplier.CONFIG ) );
this.internalCurrentPower += adjustment;
if( oldPower > this.internalCurrentPower )
this.setInternalCurrentPower( this.getInternalCurrentPower() + adjustment );
if( oldPower > this.getInternalCurrentPower() )
{
this.requiresUpdate = true;
}
this.tickTickTimer = 20; // keep ticking...
}
}
else if( this.internalCurrentPower > 1499 && materials.certusQuartzCrystal().isSameAs( myItem ) )
else if( this.getInternalCurrentPower() > 1499 && materials.certusQuartzCrystal().isSameAs( myItem ) )
{
if( Platform.getRandomFloat() > 0.8f ) // simulate wait
{
this.extractAEPower( this.internalMaxPower, Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500
this.extractAEPower( this.getInternalMaxPower(), Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500
for( final ItemStack charged : materials.certusQuartzCrystalCharged().maybeStack( myItem.stackSize ).asSet() )
{
@@ -177,7 +177,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
public void setOrientation( final ForgeDirection inForward, final ForgeDirection inUp )
{
super.setOrientation( inForward, inUp );
this.gridProxy.setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) );
this.getProxy().setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) );
this.setPowerSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) );
}
@@ -190,7 +190,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
@Override
public boolean canTurn()
{
return this.internalCurrentPower < this.internalMaxPower;
return this.getInternalCurrentPower() < this.getInternalMaxPower();
}
@Override
@@ -199,13 +199,13 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
this.injectExternalPower( PowerUnits.AE, 150 );
final ItemStack myItem = this.getStackInSlot( 0 );
if( this.internalCurrentPower > 1499 )
if( this.getInternalCurrentPower() > 1499 )
{
final IMaterials materials = AEApi.instance().definitions().materials();
if( materials.certusQuartzCrystal().isSameAs( myItem ) )
{
this.extractAEPower( this.internalMaxPower, Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500
this.extractAEPower( this.getInternalMaxPower(), Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500
for( final ItemStack charged : materials.certusQuartzCrystalCharged().maybeStack( myItem.stackSize ).asSet() )
{
@@ -49,11 +49,11 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
{
private static final FluidTankInfo[] EMPTY = { new FluidTankInfo( null, 10 ) };
final int[] sides = { 0, 1 };
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 3 );
final ConfigManager cm = new ConfigManager( this );
private final int[] sides = { 0, 1 };
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 3 );
private final ConfigManager cm = new ConfigManager( this );
public double storedPower = 0;
private double storedPower = 0;
public TileCondenser()
{
@@ -64,14 +64,14 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
public void writeToNBT_TileCondenser( final NBTTagCompound data )
{
this.cm.writeToNBT( data );
data.setDouble( "storedPower", this.storedPower );
data.setDouble( "storedPower", this.getStoredPower() );
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileCondenser( final NBTTagCompound data )
{
this.cm.readFromNBT( data );
this.storedPower = data.getDouble( "storedPower" );
this.setStoredPower( data.getDouble( "storedPower" ) );
}
public double getStorage()
@@ -93,16 +93,16 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
public void addPower( final double rawPower )
{
this.storedPower += rawPower;
this.storedPower = Math.max( 0.0, Math.min( this.getStorage(), this.storedPower ) );
this.setStoredPower( this.getStoredPower() + rawPower );
this.setStoredPower( Math.max( 0.0, Math.min( this.getStorage(), this.getStoredPower() ) ) );
final double requiredPower = this.getRequiredPower();
final ItemStack output = this.getOutput();
while( requiredPower <= this.storedPower && output != null && requiredPower > 0 )
while( requiredPower <= this.getStoredPower() && output != null && requiredPower > 0 )
{
if( this.canAddOutput( output ) )
{
this.storedPower -= requiredPower;
this.setStoredPower( this.getStoredPower() - requiredPower );
this.addOutput( output );
}
else
@@ -278,4 +278,14 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
{
return this.cm;
}
public double getStoredPower()
{
return this.storedPower;
}
private void setStoredPower( final double storedPower )
{
this.storedPower = storedPower;
}
}
@@ -80,32 +80,32 @@ import appeng.util.item.AEItemStack;
public class TileInscriber extends AENetworkPowerTile implements IGridTickable, IUpgradeableHost, IConfigManagerHost
{
public final int maxProcessingTime = 100;
final int[] top = { 0 };
final int[] bottom = { 1 };
final int[] sides = { 2, 3 };
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 4 );
private final int maxProcessingTime = 100;
private final int[] top = { 0 };
private final int[] bottom = { 1 };
private final int[] sides = { 2, 3 };
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 4 );
private final IConfigManager settings;
private final UpgradeInventory upgrades;
public int processingTime = 0;
private int processingTime = 0;
// cycles from 0 - 16, at 8 it preforms the action, at 16 it re-enables the normal routine.
public boolean smash;
public int finalStep;
public long clientStart;
private boolean smash;
private int finalStep;
private long clientStart;
@Reflected
public TileInscriber()
{
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.internalMaxPower = 1500;
this.gridProxy.setIdlePowerUsage( 0 );
this.getProxy().setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.setInternalMaxPower( 1500 );
this.getProxy().setIdlePowerUsage( 0 );
this.settings = new ConfigManager( this );
final ITileDefinition inscriberDefinition = AEApi.instance().definitions().blocks().inscriber();
this.upgrades = new DefinitionUpgradeInventory( inscriberDefinition, this, this.getUpgradeSlots() );
}
protected int getUpgradeSlots()
private int getUpgradeSlots()
{
return 3;
}
@@ -137,13 +137,13 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
{
final int slot = data.readByte();
final boolean oldSmash = this.smash;
final boolean oldSmash = this.isSmash();
final boolean newSmash = ( slot & 64 ) == 64;
if( oldSmash != newSmash && newSmash )
{
this.smash = true;
this.clientStart = System.currentTimeMillis();
this.setSmash( true );
this.setClientStart( System.currentTimeMillis() );
}
for( int num = 0; num < this.inv.getSizeInventory(); num++ )
@@ -164,7 +164,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileInscriber( final ByteBuf data ) throws IOException
{
int slot = this.smash ? 64 : 0;
int slot = this.isSmash() ? 64 : 0;
for( int num = 0; num < this.inv.getSizeInventory(); num++ )
{
@@ -189,7 +189,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
public void setOrientation( final ForgeDirection inForward, final ForgeDirection inUp )
{
super.setOrientation( inForward, inUp );
this.gridProxy.setValidSides( EnumSet.complementOf( EnumSet.of( this.getForward() ) ) );
this.getProxy().setValidSides( EnumSet.complementOf( EnumSet.of( this.getForward() ) ) );
this.setPowerSides( EnumSet.complementOf( EnumSet.of( this.getForward() ) ) );
}
@@ -229,7 +229,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
@Override
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
if( this.smash )
if( this.isSmash() )
{
return false;
}
@@ -262,15 +262,15 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
{
if( slot != 3 )
{
this.processingTime = 0;
this.setProcessingTime( 0 );
}
if( !this.smash )
if( !this.isSmash() )
{
this.markForUpdate();
}
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
this.getProxy().getTick().wakeDevice( this.getProxy().getNode() );
}
}
catch( final GridAccessException e )
@@ -282,7 +282,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
@Override
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final int side )
{
if( this.smash )
if( this.isSmash() )
{
return false;
}
@@ -309,7 +309,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
@Override
public TickingRequest getTickingRequest( final IGridNode node )
{
return new TickingRequest( TickRates.Inscriber.min, TickRates.Inscriber.max, !this.hasWork(), false );
return new TickingRequest( TickRates.Inscriber.getMin(), TickRates.Inscriber.getMax(), !this.hasWork(), false );
}
private boolean hasWork()
@@ -319,8 +319,8 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
return true;
}
this.processingTime = 0;
return this.smash;
this.setProcessingTime( 0 );
return this.isSmash();
}
@Nullable
@@ -420,7 +420,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
@Override
public TickRateModulation tickingRequest( final IGridNode node, final int ticksSinceLastCall )
{
if( this.smash )
if( this.isSmash() )
{
this.finalStep++;
if( this.finalStep == 8 )
@@ -433,7 +433,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
if( ad.addItems( outputCopy ) == null )
{
this.processingTime = 0;
this.setProcessingTime( 0 );
if( out.getProcessType() == InscriberProcessType.Press )
{
this.setInventorySlotContents( 0, null );
@@ -448,7 +448,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
else if( this.finalStep == 16 )
{
this.finalStep = 0;
this.smash = false;
this.setSmash( false );
this.markForUpdate();
}
}
@@ -456,7 +456,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
{
try
{
final IEnergyGrid eg = this.gridProxy.getEnergy();
final IEnergyGrid eg = this.getProxy().getEnergy();
IEnergySource src = this;
// Base 1, increase by 1 for each card
@@ -475,13 +475,13 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
{
src.extractAEPower( powerConsumption, Actionable.MODULATE, PowerMultiplier.CONFIG );
if( this.processingTime == 0 )
if( this.getProcessingTime() == 0 )
{
this.processingTime += speedFactor;
this.setProcessingTime( this.getProcessingTime() + speedFactor );
}
else
{
this.processingTime += ticksSinceLastCall * speedFactor;
this.setProcessingTime( this.getProcessingTime() + ticksSinceLastCall * speedFactor );
}
}
}
@@ -490,9 +490,9 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
// :P
}
if( this.processingTime > this.maxProcessingTime )
if( this.getProcessingTime() > this.getMaxProcessingTime() )
{
this.processingTime = this.maxProcessingTime;
this.setProcessingTime( this.getMaxProcessingTime() );
final IInscriberRecipe out = this.getTask();
if( out != null )
{
@@ -500,7 +500,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this.inv, 3, 1, true ), ForgeDirection.UNKNOWN );
if( ad.simulateAdd( outputCopy ) == null )
{
this.smash = true;
this.setSmash( true );
this.finalStep = 0;
this.markForUpdate();
}
@@ -543,4 +543,39 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
{
}
public long getClientStart()
{
return this.clientStart;
}
private void setClientStart( final long clientStart )
{
this.clientStart = clientStart;
}
public boolean isSmash()
{
return this.smash;
}
public void setSmash( final boolean smash )
{
this.smash = smash;
}
public int getMaxProcessingTime()
{
return this.maxProcessingTime;
}
public int getProcessingTime()
{
return this.processingTime;
}
private void setProcessingTime( final int processingTime )
{
this.processingTime = processingTime;
}
}
@@ -67,8 +67,8 @@ import appeng.util.inv.IInventoryDestination;
public class TileInterface extends AENetworkInvTile implements IGridTickable, ITileStorageMonitorable, IStorageMonitorable, IInventoryDestination, IInterfaceHost, IPriorityHost
{
final DualityInterface duality = new DualityInterface( this.gridProxy, this );
ForgeDirection pointAt = ForgeDirection.UNKNOWN;
private final DualityInterface duality = new DualityInterface( this.getGridProxy(), this );
private ForgeDirection pointAt = ForgeDirection.UNKNOWN;
@MENetworkEventSubscribe
public void stateChange( final MENetworkChannelsChanged c )
@@ -115,7 +115,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
this.setOrientation( this.pointAt.offsetY != 0 ? ForgeDirection.SOUTH : ForgeDirection.UP, this.pointAt.getOpposite() );
}
this.gridProxy.setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt ) ) );
this.getGridProxy().setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt ) ) );
this.markForUpdate();
this.markDirty();
}
@@ -141,7 +141,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
@Override
public void onReady()
{
this.gridProxy.setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt ) ) );
this.getGridProxy().setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt ) ) );
super.onReady();
this.duality.initialize();
}
@@ -28,8 +28,8 @@ import appeng.util.Platform;
public class TileLightDetector extends AEBaseTile
{
int lastCheck = 30;
int lastLight = 0;
private int lastCheck = 30;
private int lastLight = 0;
public boolean isReady()
{
@@ -48,10 +48,10 @@ import appeng.tile.events.TileEventType;
public class TilePaint extends AEBaseTile
{
static final int LIGHT_PER_DOT = 12;
private static final int LIGHT_PER_DOT = 12;
int isLit = 0;
List<Splotch> dots = null;
private int isLit = 0;
private List<Splotch> dots = null;
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TilePaint( final NBTTagCompound data )
@@ -64,7 +64,7 @@ public class TilePaint extends AEBaseTile
}
}
void writeBuffer( final ByteBuf out )
private void writeBuffer( final ByteBuf out )
{
if( this.dots == null )
{
@@ -89,7 +89,7 @@ public class TilePaint extends AEBaseTile
}
}
void readBuffer( final ByteBuf in )
private void readBuffer( final ByteBuf in )
{
final byte howMany = in.readByte();
@@ -109,7 +109,7 @@ public class TilePaint extends AEBaseTile
this.isLit = 0;
for( final Splotch s : this.dots )
{
if( s.lumen )
if( s.isLumen() )
{
this.isLit += LIGHT_PER_DOT;
}
@@ -174,7 +174,7 @@ public class TilePaint extends AEBaseTile
while( i.hasNext() )
{
final Splotch s = i.next();
if( s.side == side )
if( s.getSide() == side )
{
i.remove();
}
@@ -189,7 +189,7 @@ public class TilePaint extends AEBaseTile
this.isLit = 0;
for( final Splotch s : this.dots )
{
if( s.lumen )
if( s.isLumen() )
{
this.isLit += LIGHT_PER_DOT;
}
@@ -40,13 +40,13 @@ import appeng.util.Platform;
public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPowerChannelState, ICrystalGrowthAccelerator
{
public boolean hasPower = false;
private boolean hasPower = false;
public TileQuartzGrowthAccelerator()
{
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.gridProxy.setFlags();
this.gridProxy.setIdlePowerUsage( 8 );
this.getProxy().setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.getProxy().setFlags();
this.getProxy().setIdlePowerUsage( 8 );
}
@MENetworkEventSubscribe
@@ -64,9 +64,9 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileQuartzGrowthAccelerator( final ByteBuf data )
{
final boolean hadPower = this.hasPower;
this.hasPower = data.readBoolean();
return this.hasPower != hadPower;
final boolean hadPower = this.isPowered();
this.setPowered( data.readBoolean() );
return this.isPowered() != hadPower;
}
@TileEvent( TileEventType.NETWORK_WRITE )
@@ -74,7 +74,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
{
try
{
data.writeBoolean( this.gridProxy.getEnergy().isNetworkPowered() );
data.writeBoolean( this.getProxy().getEnergy().isNetworkPowered() );
}
catch( final GridAccessException e )
{
@@ -86,7 +86,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
public void setOrientation( final ForgeDirection inForward, final ForgeDirection inUp )
{
super.setOrientation( inForward, inUp );
this.gridProxy.setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) );
this.getProxy().setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) );
}
@Override
@@ -96,7 +96,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
{
try
{
return this.gridProxy.getEnergy().isNetworkPowered();
return this.getProxy().getEnergy().isNetworkPowered();
}
catch( final GridAccessException e )
{
@@ -112,4 +112,9 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
{
return this.isPowered();
}
private void setPowered( final boolean hasPower )
{
this.hasPower = hasPower;
}
}
@@ -82,18 +82,18 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
{
private static int difference = 0;
public final AppEngInternalInventory configSlot = new AppEngInternalInventory( this, 1 );
private final AppEngInternalInventory configSlot = new AppEngInternalInventory( this, 1 );
private final IConfigManager cm = new ConfigManager( this );
private final SecurityInventory inventory = new SecurityInventory( this );
private final MEMonitorHandler<IAEItemStack> securityMonitor = new MEMonitorHandler<IAEItemStack>( this.inventory );
public long securityKey;
AEColor paintedColor = AEColor.Transparent;
private long securityKey;
private AEColor paintedColor = AEColor.Transparent;
private boolean isActive = false;
public TileSecurity()
{
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
this.gridProxy.setIdlePowerUsage( 2.0 );
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
this.getProxy().setIdlePowerUsage( 2.0 );
difference++;
this.securityKey = System.currentTimeMillis() * 10 + difference;
@@ -116,12 +116,12 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
@Override
public void getDrops( final World w, final int x, final int y, final int z, final List<ItemStack> drops )
{
if( !this.configSlot.isEmpty() )
if( !this.getConfigSlot().isEmpty() )
{
drops.add( this.configSlot.getStackInSlot( 0 ) );
drops.add( this.getConfigSlot().getStackInSlot( 0 ) );
}
for( final IAEItemStack ais : this.inventory.storedItems )
for( final IAEItemStack ais : this.inventory.getStoredItems() )
{
drops.add( ais.getItemStack() );
}
@@ -147,7 +147,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileSecurity( final ByteBuf data )
{
data.writeBoolean( this.gridProxy.isActive() );
data.writeBoolean( this.getProxy().isActive() );
data.writeByte( this.paintedColor.ordinal() );
}
@@ -158,12 +158,12 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
data.setByte( "paintedColor", (byte) this.paintedColor.ordinal() );
data.setLong( "securityKey", this.securityKey );
this.configSlot.writeToNBT( data, "config" );
this.getConfigSlot().writeToNBT( data, "config" );
final NBTTagCompound storedItems = new NBTTagCompound();
int offset = 0;
for( final IAEItemStack ais : this.inventory.storedItems )
for( final IAEItemStack ais : this.inventory.getStoredItems() )
{
final NBTTagCompound it = new NBTTagCompound();
ais.getItemStack().writeToNBT( it );
@@ -184,7 +184,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
}
this.securityKey = data.getLong( "securityKey" );
this.configSlot.readFromNBT( data, "config" );
this.getConfigSlot().readFromNBT( data, "config" );
final NBTTagCompound storedItems = data.getCompoundTag( "storedItems" );
for( final Object key : storedItems.func_150296_c() )
@@ -192,7 +192,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
final NBTBase obj = storedItems.getTag( (String) key );
if( obj instanceof NBTTagCompound )
{
this.inventory.storedItems.add( AEItemStack.create( ItemStack.loadItemStackFromNBT( (NBTTagCompound) obj ) ) );
this.inventory.getStoredItems().add( AEItemStack.create( ItemStack.loadItemStackFromNBT( (NBTTagCompound) obj ) ) );
}
}
}
@@ -202,7 +202,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
try
{
this.saveChanges();
this.gridProxy.getGrid().postEvent( new MENetworkSecurityChange() );
this.getProxy().getGrid().postEvent( new MENetworkSecurityChange() );
}
catch( final GridAccessException e )
{
@@ -286,7 +286,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
public boolean isPowered()
{
return this.gridProxy.isActive();
return this.getProxy().isActive();
}
@Override
@@ -313,7 +313,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
final IPlayerRegistry pr = AEApi.instance().registries().players();
// read permissions
for( final IAEItemStack ais : this.inventory.storedItems )
for( final IAEItemStack ais : this.inventory.getStoredItems() )
{
final ItemStack is = ais.getItemStack();
final Item i = is.getItem();
@@ -325,19 +325,19 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
}
// make sure thea admin is Boss.
playerPerms.put( this.gridProxy.getNode().getPlayerID(), EnumSet.allOf( SecurityPermissions.class ) );
playerPerms.put( this.getProxy().getNode().getPlayerID(), EnumSet.allOf( SecurityPermissions.class ) );
}
@Override
public boolean isSecurityEnabled()
{
return this.isActive && this.gridProxy.isActive();
return this.isActive && this.getProxy().isActive();
}
@Override
public int getOwner()
{
return this.gridProxy.getNode().getPlayerID();
return this.getProxy().getNode().getPlayerID();
}
@Override
@@ -359,4 +359,9 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
this.markForUpdate();
return true;
}
public AppEngInternalInventory getConfigSlot()
{
return this.configSlot;
}
}
@@ -57,17 +57,17 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
private static final int MIN_BURN_SPEED = 20;
private final IInventory inv = new AppEngInternalInventory( this, 1 );
public int burnSpeed = 100;
public double burnTime = 0;
public double maxBurnTime = 0;
private int burnSpeed = 100;
private double burnTime = 0;
private double maxBurnTime = 0;
// client side..
public boolean isOn;
public TileVibrationChamber()
{
this.gridProxy.setIdlePowerUsage( 0 );
this.gridProxy.setFlags();
this.getGridProxy().setIdlePowerUsage( 0 );
this.getGridProxy().setFlags();
}
@Override
@@ -91,23 +91,23 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToNetwork( final ByteBuf data )
{
data.writeBoolean( this.burnTime > 0 );
data.writeBoolean( this.getBurnTime() > 0 );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileVibrationChamber( final NBTTagCompound data )
{
data.setDouble( "burnTime", this.burnTime );
data.setDouble( "maxBurnTime", this.maxBurnTime );
data.setInteger( "burnSpeed", this.burnSpeed );
data.setDouble( "burnTime", this.getBurnTime() );
data.setDouble( "maxBurnTime", this.getMaxBurnTime() );
data.setInteger( "burnSpeed", this.getBurnSpeed() );
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileVibrationChamber( final NBTTagCompound data )
{
this.burnTime = data.getDouble( "burnTime" );
this.maxBurnTime = data.getDouble( "maxBurnTime" );
this.burnSpeed = data.getInteger( "burnSpeed" );
this.setBurnTime( data.getDouble( "burnTime" ) );
this.setMaxBurnTime( data.getDouble( "maxBurnTime" ) );
this.setBurnSpeed( data.getInteger( "burnSpeed" ) );
}
@Override
@@ -125,13 +125,13 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
@Override
public void onChangeInventory( final IInventory inv, final int slot, final InvOperation mc, final ItemStack removed, final ItemStack added )
{
if( this.burnTime <= 0 )
if( this.getBurnTime() <= 0 )
{
if( this.canEatFuel() )
{
try
{
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
this.getGridProxy().getTick().wakeDevice( this.getGridProxy().getNode() );
}
catch( final GridAccessException e )
{
@@ -176,44 +176,44 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
@Override
public TickingRequest getTickingRequest( final IGridNode node )
{
if( this.burnTime <= 0 )
if( this.getBurnTime() <= 0 )
{
this.eatFuel();
}
return new TickingRequest( TickRates.VibrationChamber.min, TickRates.VibrationChamber.max, this.burnTime <= 0, false );
return new TickingRequest( TickRates.VibrationChamber.getMin(), TickRates.VibrationChamber.getMax(), this.getBurnTime() <= 0, false );
}
@Override
public TickRateModulation tickingRequest( final IGridNode node, final int ticksSinceLastCall )
{
if( this.burnTime <= 0 )
if( this.getBurnTime() <= 0 )
{
this.eatFuel();
if( this.burnTime > 0 )
if( this.getBurnTime() > 0 )
{
return TickRateModulation.URGENT;
}
this.burnSpeed = 100;
this.setBurnSpeed( 100 );
return TickRateModulation.SLEEP;
}
this.burnSpeed = Math.max( MIN_BURN_SPEED, Math.min( this.burnSpeed, MAX_BURN_SPEED ) );
final double dilation = this.burnSpeed / DILATION_SCALING;
this.setBurnSpeed( Math.max( MIN_BURN_SPEED, Math.min( this.getBurnSpeed(), MAX_BURN_SPEED ) ) );
final double dilation = this.getBurnSpeed() / DILATION_SCALING;
double timePassed = ticksSinceLastCall * dilation;
this.burnTime -= timePassed;
if( this.burnTime < 0 )
this.setBurnTime( this.getBurnTime() - timePassed );
if( this.getBurnTime() < 0 )
{
timePassed += this.burnTime;
this.burnTime = 0;
timePassed += this.getBurnTime();
this.setBurnTime( 0 );
}
try
{
final IEnergyGrid grid = this.gridProxy.getEnergy();
final IEnergyGrid grid = this.getGridProxy().getEnergy();
final double newPower = timePassed * POWER_PER_TICK;
final double overFlow = grid.injectPower( newPower, Actionable.SIMULATE );
@@ -222,20 +222,20 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
if( overFlow > 0 )
{
this.burnSpeed -= ticksSinceLastCall;
this.setBurnSpeed( this.getBurnSpeed() - ticksSinceLastCall );
}
else
{
this.burnSpeed += ticksSinceLastCall;
this.setBurnSpeed( this.getBurnSpeed() + ticksSinceLastCall );
}
this.burnSpeed = Math.max( MIN_BURN_SPEED, Math.min( this.burnSpeed, MAX_BURN_SPEED ) );
this.setBurnSpeed( Math.max( MIN_BURN_SPEED, Math.min( this.getBurnSpeed(), MAX_BURN_SPEED ) ) );
return overFlow > 0 ? TickRateModulation.SLOWER : TickRateModulation.FASTER;
}
catch( final GridAccessException e )
{
this.burnSpeed -= ticksSinceLastCall;
this.burnSpeed = Math.max( MIN_BURN_SPEED, Math.min( this.burnSpeed, MAX_BURN_SPEED ) );
this.setBurnSpeed( this.getBurnSpeed() - ticksSinceLastCall );
this.setBurnSpeed( Math.max( MIN_BURN_SPEED, Math.min( this.getBurnSpeed(), MAX_BURN_SPEED ) ) );
return TickRateModulation.SLOWER;
}
}
@@ -248,8 +248,8 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
final int newBurnTime = TileEntityFurnace.getItemBurnTime( is );
if( newBurnTime > 0 && is.stackSize > 0 )
{
this.burnTime += newBurnTime;
this.maxBurnTime = this.burnTime;
this.setBurnTime( this.getBurnTime() + newBurnTime );
this.setMaxBurnTime( this.getBurnTime() );
is.stackSize--;
if( is.stackSize <= 0 )
{
@@ -271,11 +271,11 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
}
}
if( this.burnTime > 0 )
if( this.getBurnTime() > 0 )
{
try
{
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
this.getGridProxy().getTick().wakeDevice( this.getGridProxy().getNode() );
}
catch( final GridAccessException e )
{
@@ -284,9 +284,9 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
}
// state change
if( ( !this.isOn && this.burnTime > 0 ) || ( this.isOn && this.burnTime <= 0 ) )
if( ( !this.isOn && this.getBurnTime() > 0 ) || ( this.isOn && this.getBurnTime() <= 0 ) )
{
this.isOn = this.burnTime > 0;
this.isOn = this.getBurnTime() > 0;
this.markForUpdate();
if( this.hasWorldObj() )
@@ -295,4 +295,34 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
}
}
}
public int getBurnSpeed()
{
return this.burnSpeed;
}
private void setBurnSpeed( final int burnSpeed )
{
this.burnSpeed = burnSpeed;
}
public double getMaxBurnTime()
{
return this.maxBurnTime;
}
private void setMaxBurnTime( final double maxBurnTime )
{
this.maxBurnTime = maxBurnTime;
}
public double getBurnTime()
{
return this.burnTime;
}
private void setBurnTime( final double burnTime )
{
this.burnTime = burnTime;
}
}
@@ -59,32 +59,32 @@ import appeng.util.Platform;
public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomCollision
{
public CableBusContainer cb = new CableBusContainer( this );
private CableBusContainer cb = new CableBusContainer( this );
/**
* Immibis MB Support
*/
boolean ImmibisMicroblocks_TransformableTileEntityMarker = true;
private boolean ImmibisMicroblocks_TransformableTileEntityMarker = true;
private int oldLV = -1; // on re-calculate light when it changes
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileCableBus( final NBTTagCompound data )
{
this.cb.readFromNBT( data );
this.getCableBus().readFromNBT( data );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileCableBus( final NBTTagCompound data )
{
this.cb.writeToNBT( data );
this.getCableBus().writeToNBT( data );
}
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileCableBus( final ByteBuf data ) throws IOException
{
final boolean ret = this.cb.readFromStream( data );
final boolean ret = this.getCableBus().readFromStream( data );
final int newLV = this.cb.getLightValue();
final int newLV = this.getCableBus().getLightValue();
if( newLV != this.oldLV )
{
this.oldLV = newLV;
@@ -98,11 +98,11 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
protected void updateTileSetting()
{
if( this.cb.requiresDynamicRender )
if( this.getCableBus().isRequiresDynamicRender() )
{
try
{
final TileCableBus tcb = (TileCableBus) BlockCableBus.tesrTile.newInstance();
final TileCableBus tcb = (TileCableBus) BlockCableBus.getTesrTile().newInstance();
tcb.copyFrom( this );
this.getWorldObj().setTileEntity( this.xCoord, this.yCoord, this.zCoord, tcb );
}
@@ -115,16 +115,16 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
protected void copyFrom( final TileCableBus oldTile )
{
final CableBusContainer tmpCB = this.cb;
this.cb = oldTile.cb;
final CableBusContainer tmpCB = this.getCableBus();
this.setCableBus( oldTile.getCableBus() );
this.oldLV = oldTile.oldLV;
oldTile.cb = tmpCB;
oldTile.setCableBus( tmpCB );
}
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileCableBus( final ByteBuf data ) throws IOException
{
this.cb.writeToStream( data );
this.getCableBus().writeToStream( data );
}
@Override
@@ -137,7 +137,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
public void invalidate()
{
super.invalidate();
this.cb.removeFromWorld();
this.getCableBus().removeFromWorld();
}
@Override
@@ -150,20 +150,20 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public IGridNode getGridNode( final ForgeDirection dir )
{
return this.cb.getGridNode( dir );
return this.getCableBus().getGridNode( dir );
}
@Override
public AECableType getCableConnectionType( final ForgeDirection side )
{
return this.cb.getCableConnectionType( side );
return this.getCableBus().getCableConnectionType( side );
}
@Override
public void onChunkUnload()
{
super.onChunkUnload();
this.cb.removeFromWorld();
this.getCableBus().removeFromWorld();
}
@Override
@@ -174,7 +174,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
return;
}
final int newLV = this.cb.getLightValue();
final int newLV = this.getCableBus().getLightValue();
if( newLV != this.oldLV )
{
this.oldLV = newLV;
@@ -194,20 +194,20 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public void getDrops( final World w, final int x, final int y, final int z, final List drops )
{
this.cb.getDrops( drops );
this.getCableBus().getDrops( drops );
}
@Override
public void getNoDrops( final World w, final int x, final int y, final int z, final List<ItemStack> drops )
{
this.cb.getNoDrops( drops );
this.getCableBus().getNoDrops( drops );
}
@Override
public void onReady()
{
super.onReady();
if( this.cb.isEmpty() )
if( this.getCableBus().isEmpty() )
{
if( this.worldObj.getTileEntity( this.xCoord, this.yCoord, this.zCoord ) == this )
{
@@ -216,44 +216,44 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
}
else
{
this.cb.addToWorld();
this.getCableBus().addToWorld();
}
}
@Override
public boolean requiresTESR()
{
return this.cb.requiresDynamicRender;
return this.getCableBus().isRequiresDynamicRender();
}
@Override
public IFacadeContainer getFacadeContainer()
{
return this.cb.getFacadeContainer();
return this.getCableBus().getFacadeContainer();
}
@Override
public boolean canAddPart( final ItemStack is, final ForgeDirection side )
{
return this.cb.canAddPart( is, side );
return this.getCableBus().canAddPart( is, side );
}
@Override
public ForgeDirection addPart( final ItemStack is, final ForgeDirection side, final EntityPlayer player )
{
return this.cb.addPart( is, side, player );
return this.getCableBus().addPart( is, side, player );
}
@Override
public IPart getPart( final ForgeDirection side )
{
return this.cb.getPart( side );
return this.getCableBus().getPart( side );
}
@Override
public void removePart( final ForgeDirection side, final boolean suppressUpdate )
{
this.cb.removePart( side, suppressUpdate );
this.getCableBus().removePart( side, suppressUpdate );
}
@Override
@@ -265,13 +265,13 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public AEColor getColor()
{
return this.cb.getColor();
return this.getCableBus().getColor();
}
@Override
public void clearContainer()
{
this.cb = new CableBusContainer( this );
this.setCableBus( new CableBusContainer( this ) );
}
@Override
@@ -283,13 +283,13 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final int x, final int y, final int z, final Entity e, final boolean visual )
{
return this.cb.getSelectedBoundingBoxesFromPool( false, true, e, visual );
return this.getCableBus().getSelectedBoundingBoxesFromPool( false, true, e, visual );
}
@Override
public SelectedPart selectPart( final Vec3 pos )
{
return this.cb.selectPart( pos );
return this.getCableBus().selectPart( pos );
}
@Override
@@ -307,19 +307,19 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public boolean hasRedstone( final ForgeDirection side )
{
return this.cb.hasRedstone( side );
return this.getCableBus().hasRedstone( side );
}
@Override
public boolean isEmpty()
{
return this.cb.isEmpty();
return this.getCableBus().isEmpty();
}
@Override
public Set<LayerFlags> getLayerFlags()
{
return this.cb.getLayerFlags();
return this.getCableBus().getLayerFlags();
}
@Override
@@ -358,23 +358,33 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public boolean isInWorld()
{
return this.cb.isInWorld();
return this.getCableBus().isInWorld();
}
public boolean ImmibisMicroblocks_isSideOpen( final int side )
private boolean ImmibisMicroblocks_isSideOpen( final int side )
{
return true;
}
public void ImmibisMicroblocks_onMicroblocksChanged()
{
this.cb.updateConnections();
this.getCableBus().updateConnections();
}
@Override
public boolean recolourBlock( final ForgeDirection side, final AEColor colour, final EntityPlayer who )
{
return this.cb.recolourBlock( side, colour, who );
return this.getCableBus().recolourBlock( side, colour, who );
}
public CableBusContainer getCableBus()
{
return this.cb;
}
private void setCableBus( final CableBusContainer cb )
{
this.cb = cb;
}
}
@@ -28,11 +28,11 @@ public class TileCableBusTESR extends TileCableBus
@Override
protected void updateTileSetting()
{
if( !this.cb.requiresDynamicRender )
if( !this.getCableBus().isRequiresDynamicRender() )
{
try
{
final TileCableBus tcb = (TileCableBus) BlockCableBus.noTesrTile.newInstance();
final TileCableBus tcb = (TileCableBus) BlockCableBus.getNoTesrTile().newInstance();
tcb.copyFrom( this );
this.getWorldObj().setTileEntity( this.xCoord, this.yCoord, this.zCoord, tcb );
}
@@ -49,10 +49,10 @@ public class TileController extends AENetworkPowerTile
public TileController()
{
this.internalMaxPower = 8000;
this.internalPublicPowerStorage = true;
this.gridProxy.setIdlePowerUsage( 3 );
this.gridProxy.setFlags( GridFlags.CANNOT_CARRY, GridFlags.DENSE_CAPACITY );
this.setInternalMaxPower( 8000 );
this.setInternalPublicPowerStorage( true );
this.getProxy().setIdlePowerUsage( 3 );
this.getProxy().setFlags( GridFlags.CANNOT_CARRY, GridFlags.DENSE_CAPACITY );
}
@Override
@@ -86,11 +86,11 @@ public class TileController extends AENetworkPowerTile
{
if( this.isValid )
{
this.gridProxy.setValidSides( EnumSet.allOf( ForgeDirection.class ) );
this.getProxy().setValidSides( EnumSet.allOf( ForgeDirection.class ) );
}
else
{
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.getProxy().setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
}
this.updateMeta();
@@ -100,7 +100,7 @@ public class TileController extends AENetworkPowerTile
private void updateMeta()
{
if( !this.gridProxy.isReady() )
if( !this.getProxy().isReady() )
{
return;
}
@@ -109,11 +109,11 @@ public class TileController extends AENetworkPowerTile
try
{
if( this.gridProxy.getEnergy().isNetworkPowered() )
if( this.getProxy().getEnergy().isNetworkPowered() )
{
meta = 1;
if( this.gridProxy.getPath().getControllerState() == ControllerState.CONTROLLER_CONFLICT )
if( this.getProxy().getPath().getControllerState() == ControllerState.CONTROLLER_CONFLICT )
{
meta = 2;
}
@@ -135,7 +135,7 @@ public class TileController extends AENetworkPowerTile
{
try
{
return this.gridProxy.getEnergy().getEnergyDemand( 8000 );
return this.getProxy().getEnergy().getEnergyDemand( 8000 );
}
catch( final GridAccessException e )
{
@@ -149,7 +149,7 @@ public class TileController extends AENetworkPowerTile
{
try
{
final double ret = this.gridProxy.getEnergy().injectPower( power, mode );
final double ret = this.getProxy().getEnergy().injectPower( power, mode );
if( mode == Actionable.SIMULATE )
{
return ret;
@@ -168,7 +168,7 @@ public class TileController extends AENetworkPowerTile
{
try
{
this.gridProxy.getGrid().postEvent( new MENetworkPowerStorage( this, x ) );
this.getProxy().getGrid().postEvent( new MENetworkPowerStorage( this, x ) );
}
catch( final GridAccessException e )
{
@@ -34,7 +34,7 @@ public class TileCreativeEnergyCell extends AENetworkTile implements IAEPowerSto
public TileCreativeEnergyCell()
{
this.gridProxy.setIdlePowerUsage( 0 );
this.getProxy().setIdlePowerUsage( 0 );
}
@Override
@@ -24,6 +24,6 @@ public class TileDenseEnergyCell extends TileEnergyCell
public TileDenseEnergyCell()
{
this.internalMaxPower = 200000 * 8;
this.setInternalMaxPower( 200000 * 8 );
}
}
@@ -36,13 +36,13 @@ import appeng.tile.inventory.InvOperation;
public class TileEnergyAcceptor extends AENetworkPowerTile
{
static final AppEngInternalInventory INTERNAL_INVENTORY = new AppEngInternalInventory( null, 0 );
final int[] sides = {};
private static final AppEngInternalInventory INTERNAL_INVENTORY = new AppEngInternalInventory( null, 0 );
private final int[] sides = {};
public TileEnergyAcceptor()
{
this.gridProxy.setIdlePowerUsage( 0.0 );
this.internalMaxPower = 0;
this.getProxy().setIdlePowerUsage( 0.0 );
this.setInternalMaxPower( 0 );
}
@Override
@@ -72,12 +72,12 @@ public class TileEnergyAcceptor extends AENetworkPowerTile
{
try
{
final IEnergyGrid grid = this.gridProxy.getEnergy();
final IEnergyGrid grid = this.getProxy().getEnergy();
return grid.getEnergyDemand( maxRequired );
}
catch( final GridAccessException e )
{
return this.internalMaxPower;
return this.getInternalMaxPower();
}
}
@@ -86,7 +86,7 @@ public class TileEnergyAcceptor extends AENetworkPowerTile
{
try
{
final IEnergyGrid grid = this.gridProxy.getEnergy();
final IEnergyGrid grid = this.getProxy().getEnergy();
final double leftOver = grid.injectPower( power, mode );
if( mode == Actionable.SIMULATE )
{
@@ -39,14 +39,14 @@ import appeng.util.SettingsFrom;
public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
{
protected double internalCurrentPower = 0.0;
protected double internalMaxPower = 200000.0;
private double internalCurrentPower = 0.0;
private double internalMaxPower = 200000.0;
private byte currentMeta = -1;
public TileEnergyCell()
{
this.gridProxy.setIdlePowerUsage( 0 );
this.getProxy().setIdlePowerUsage( 0 );
}
@Override
@@ -70,7 +70,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
return;
}
byte boundMetadata = (byte) ( 8.0 * ( this.internalCurrentPower / this.internalMaxPower ) );
byte boundMetadata = (byte) ( 8.0 * ( this.internalCurrentPower / this.getInternalMaxPower() ) );
if( boundMetadata > 7 )
{
@@ -125,7 +125,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
{
final NBTTagCompound tag = new NBTTagCompound();
tag.setDouble( "internalCurrentPower", this.internalCurrentPower );
tag.setDouble( "internalMaxPower", this.internalMaxPower ); // used for tool tip.
tag.setDouble( "internalMaxPower", this.getInternalMaxPower() ); // used for tool tip.
return tag;
}
return null;
@@ -137,9 +137,9 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
if( mode == Actionable.SIMULATE )
{
final double fakeBattery = this.internalCurrentPower + amt;
if( fakeBattery > this.internalMaxPower )
if( fakeBattery > this.getInternalMaxPower() )
{
return fakeBattery - this.internalMaxPower;
return fakeBattery - this.getInternalMaxPower();
}
return 0;
@@ -147,14 +147,14 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
if( this.internalCurrentPower < 0.01 && amt > 0.01 )
{
this.gridProxy.getNode().getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.PROVIDE_POWER ) );
this.getProxy().getNode().getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.PROVIDE_POWER ) );
}
this.internalCurrentPower += amt;
if( this.internalCurrentPower > this.internalMaxPower )
if( this.internalCurrentPower > this.getInternalMaxPower() )
{
amt = this.internalCurrentPower - this.internalMaxPower;
this.internalCurrentPower = this.internalMaxPower;
amt = this.internalCurrentPower - this.getInternalMaxPower();
this.internalCurrentPower = this.getInternalMaxPower();
this.changePowerLevel();
return amt;
@@ -167,7 +167,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
@Override
public double getAEMaxPower()
{
return this.internalMaxPower;
return this.getInternalMaxPower();
}
@Override
@@ -205,13 +205,13 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
return this.internalCurrentPower;
}
final boolean wasFull = this.internalCurrentPower >= this.internalMaxPower - 0.001;
final boolean wasFull = this.internalCurrentPower >= this.getInternalMaxPower() - 0.001;
if( wasFull && amt > 0.001 )
{
try
{
this.gridProxy.getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) );
this.getProxy().getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) );
}
catch( final GridAccessException ignored )
{
@@ -233,4 +233,14 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
this.changePowerLevel();
return amt;
}
private double getInternalMaxPower()
{
return this.internalMaxPower;
}
void setInternalMaxPower( final double internalMaxPower )
{
this.internalMaxPower = internalMaxPower;
}
}
@@ -53,22 +53,22 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
public static final int POWERED_FLAG = 1;
public static final int CHANNEL_FLAG = 2;
final int[] sides = { 0 };
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 );
private final int[] sides = { 0 };
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 );
public int clientFlags = 0;
private int clientFlags = 0;
public TileWireless()
{
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.getGridProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
this.getGridProxy().setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
}
@Override
public void setOrientation( final ForgeDirection inForward, final ForgeDirection inUp )
{
super.setOrientation( inForward, inUp );
this.gridProxy.setValidSides( EnumSet.of( this.getForward().getOpposite() ) );
this.getGridProxy().setValidSides( EnumSet.of( this.getForward().getOpposite() ) );
}
@MENetworkEventSubscribe
@@ -86,27 +86,27 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileWireless( final ByteBuf data )
{
final int old = this.clientFlags;
this.clientFlags = data.readByte();
final int old = this.getClientFlags();
this.setClientFlags( data.readByte() );
return old != this.clientFlags;
return old != this.getClientFlags();
}
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileWireless( final ByteBuf data )
{
this.clientFlags = 0;
this.setClientFlags( 0 );
try
{
if( this.gridProxy.getEnergy().isNetworkPowered() )
if( this.getGridProxy().getEnergy().isNetworkPowered() )
{
this.clientFlags |= POWERED_FLAG;
this.setClientFlags( this.getClientFlags() | POWERED_FLAG );
}
if( this.gridProxy.getNode().meetsChannelRequirements() )
if( this.getGridProxy().getNode().meetsChannelRequirements() )
{
this.clientFlags |= CHANNEL_FLAG;
this.setClientFlags( this.getClientFlags() | CHANNEL_FLAG );
}
}
catch( final GridAccessException e )
@@ -114,7 +114,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
// meh
}
data.writeByte( (byte) this.clientFlags );
data.writeByte( (byte) this.getClientFlags() );
}
@Override
@@ -162,7 +162,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
private void updatePower()
{
this.gridProxy.setIdlePowerUsage( AEConfig.instance.wireless_getPowerDrain( this.getBoosters() ) );
this.getGridProxy().setIdlePowerUsage( AEConfig.instance.wireless_getPowerDrain( this.getBoosters() ) );
}
private int getBoosters()
@@ -188,10 +188,10 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
{
if( Platform.isClient() )
{
return this.isPowered() && ( CHANNEL_FLAG == ( this.clientFlags & CHANNEL_FLAG ) );
return this.isPowered() && ( CHANNEL_FLAG == ( this.getClientFlags() & CHANNEL_FLAG ) );
}
return this.gridProxy.isActive();
return this.getGridProxy().isActive();
}
@Override
@@ -199,7 +199,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
{
try
{
return this.gridProxy.getGrid();
return this.getGridProxy().getGrid();
}
catch( final GridAccessException e )
{
@@ -210,6 +210,16 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
@Override
public boolean isPowered()
{
return POWERED_FLAG == ( this.clientFlags & POWERED_FLAG );
return POWERED_FLAG == ( this.getClientFlags() & POWERED_FLAG );
}
public int getClientFlags()
{
return this.clientFlags;
}
private void setClientFlags( final int clientFlags )
{
this.clientFlags = clientFlags;
}
}
@@ -38,14 +38,13 @@ import appeng.tile.events.TileEventType;
public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowerStorage
{
protected final boolean internalCanAcceptPower = true;
// values that determine general function, are set by inheriting classes if
// needed. These should generally remain static.
protected double internalMaxPower = 10000;
protected boolean internalPublicPowerStorage = false;
protected AccessRestriction internalPowerFlow = AccessRestriction.READ_WRITE;
private double internalMaxPower = 10000;
private boolean internalPublicPowerStorage = false;
private AccessRestriction internalPowerFlow = AccessRestriction.READ_WRITE;
// the current power buffer.
protected double internalCurrentPower = 0;
private double internalCurrentPower = 0;
private EnumSet<ForgeDirection> internalPowerSides = EnumSet.allOf( ForgeDirection.class );
protected EnumSet<ForgeDirection> getPowerSides()
@@ -62,13 +61,13 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_AERootPoweredTile( final NBTTagCompound data )
{
data.setDouble( "internalCurrentPower", this.internalCurrentPower );
data.setDouble( "internalCurrentPower", this.getInternalCurrentPower() );
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_AERootPoweredTile( final NBTTagCompound data )
{
this.internalCurrentPower = data.getDouble( "internalCurrentPower" );
this.setInternalCurrentPower( data.getDouble( "internalCurrentPower" ) );
}
protected final double getExternalPowerDemand( final PowerUnits externalUnit, final double maxPowerRequired )
@@ -78,7 +77,7 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
protected double getFunnelPowerDemand( final double maxRequired )
{
return this.internalMaxPower - this.internalCurrentPower;
return this.getInternalMaxPower() - this.getInternalCurrentPower();
}
public final double injectExternalPower( final PowerUnits input, final double amt )
@@ -101,27 +100,27 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
if( mode == Actionable.SIMULATE )
{
final double fakeBattery = this.internalCurrentPower + amt;
final double fakeBattery = this.getInternalCurrentPower() + amt;
if( fakeBattery > this.internalMaxPower )
if( fakeBattery > this.getInternalMaxPower() )
{
return fakeBattery - this.internalMaxPower;
return fakeBattery - this.getInternalMaxPower();
}
return 0;
}
else
{
if( this.internalCurrentPower < 0.01 && amt > 0.01 )
if( this.getInternalCurrentPower() < 0.01 && amt > 0.01 )
{
this.PowerEvent( PowerEventType.PROVIDE_POWER );
}
this.internalCurrentPower += amt;
if( this.internalCurrentPower > this.internalMaxPower )
this.setInternalCurrentPower( this.getInternalCurrentPower() + amt );
if( this.getInternalCurrentPower() > this.getInternalMaxPower() )
{
amt = this.internalCurrentPower - this.internalMaxPower;
this.internalCurrentPower = this.internalMaxPower;
amt = this.getInternalCurrentPower() - this.getInternalMaxPower();
this.setInternalCurrentPower( this.getInternalMaxPower() );
return amt;
}
@@ -137,25 +136,25 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
@Override
public final double getAEMaxPower()
{
return this.internalMaxPower;
return this.getInternalMaxPower();
}
@Override
public final double getAECurrentPower()
{
return this.internalCurrentPower;
return this.getInternalCurrentPower();
}
@Override
public final boolean isAEPublicPowerStorage()
{
return this.internalPublicPowerStorage;
return this.isInternalPublicPowerStorage();
}
@Override
public final AccessRestriction getPowerFlow()
{
return this.internalPowerFlow;
return this.getInternalPowerFlow();
}
@Override
@@ -168,27 +167,67 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
{
if( mode == Actionable.SIMULATE )
{
if( this.internalCurrentPower > amt )
if( this.getInternalCurrentPower() > amt )
{
return amt;
}
return this.internalCurrentPower;
return this.getInternalCurrentPower();
}
final boolean wasFull = this.internalCurrentPower >= this.internalMaxPower - 0.001;
final boolean wasFull = this.getInternalCurrentPower() >= this.getInternalMaxPower() - 0.001;
if( wasFull && amt > 0.001 )
{
this.PowerEvent( PowerEventType.REQUEST_POWER );
}
if( this.internalCurrentPower > amt )
if( this.getInternalCurrentPower() > amt )
{
this.internalCurrentPower -= amt;
this.setInternalCurrentPower( this.getInternalCurrentPower() - amt );
return amt;
}
amt = this.internalCurrentPower;
this.internalCurrentPower = 0;
amt = this.getInternalCurrentPower();
this.setInternalCurrentPower( 0 );
return amt;
}
public double getInternalCurrentPower()
{
return this.internalCurrentPower;
}
public void setInternalCurrentPower( final double internalCurrentPower )
{
this.internalCurrentPower = internalCurrentPower;
}
public double getInternalMaxPower()
{
return this.internalMaxPower;
}
public void setInternalMaxPower( final double internalMaxPower )
{
this.internalMaxPower = internalMaxPower;
}
private boolean isInternalPublicPowerStorage()
{
return this.internalPublicPowerStorage;
}
public void setInternalPublicPowerStorage( final boolean internalPublicPowerStorage )
{
this.internalPublicPowerStorage = internalPublicPowerStorage;
}
private AccessRestriction getInternalPowerFlow()
{
return this.internalPowerFlow;
}
public void setInternalPowerFlow( final AccessRestriction internalPowerFlow )
{
this.internalPowerFlow = internalPowerFlow;
}
}
+2 -2
View File
@@ -38,7 +38,7 @@ import appeng.util.Platform;
public abstract class IC2 extends AERootPoweredTile implements IEnergySink
{
boolean isInIC2 = false;
private boolean isInIC2 = false;
@Override
public final boolean acceptsEnergyFrom( final TileEntity emitter, final ForgeDirection direction )
@@ -64,7 +64,7 @@ public abstract class IC2 extends AERootPoweredTile implements IEnergySink
// just store the excess in the current block, if I return the waste,
// IC2 will just disintegrate it - Oct 20th 2013
final double overflow = PowerUnits.EU.convertTo( PowerUnits.AE, this.injectExternalPower( PowerUnits.EU, amount ) );
this.internalCurrentPower += overflow;
this.setInternalCurrentPower( this.getInternalCurrentPower() + overflow );
return 0; // see above comment.
}
@@ -42,7 +42,7 @@ public abstract class MekJoules extends RedstoneFlux implements IStrictEnergyAcc
public void setEnergy( final double energy )
{
final double extra = this.injectExternalPower( PowerUnits.MK, energy );
this.internalCurrentPower += PowerUnits.MK.convertTo( PowerUnits.AE, extra );
this.setInternalCurrentPower( this.getInternalCurrentPower() + PowerUnits.MK.convertTo( PowerUnits.AE, extra ) );
}
@Override
@@ -54,25 +54,23 @@ import appeng.util.Platform;
public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
{
private static final IBlockDefinition RING_DEFINITION = AEApi.instance().definitions().blocks().quantumRing();
public final byte corner = 16;
final int[] sidesRing = {};
final int[] sidesLink = { 0 };
final AppEngInternalInventory internalInventory = new AppEngInternalInventory( this, 1 );
final byte hasSingularity = 32;
final byte powered = 64;
private final byte corner = 16;
private final int[] sidesRing = {};
private final int[] sidesLink = { 0 };
private final AppEngInternalInventory internalInventory = new AppEngInternalInventory( this, 1 );
private final byte hasSingularity = 32;
private final byte powered = 64;
private final QuantumCalculator calc = new QuantumCalculator( this );
public boolean bridgePowered;
byte constructed = -1;
QuantumCluster cluster;
private byte constructed = -1;
private QuantumCluster cluster;
private boolean updateStatus = false;
public TileQuantumBridge()
{
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.gridProxy.setFlags( GridFlags.DENSE_CAPACITY );
this.gridProxy.setIdlePowerUsage( 22 );
this.getGridProxy().setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.getGridProxy().setFlags( GridFlags.DENSE_CAPACITY );
this.getGridProxy().setIdlePowerUsage( 22 );
this.internalInventory.setMaxStackSize( 1 );
}
@@ -100,7 +98,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
out |= this.hasSingularity;
}
if( this.gridProxy.isActive() && this.constructed != -1 )
if( this.getGridProxy().isActive() && this.constructed != -1 )
{
out |= this.powered;
}
@@ -113,7 +111,6 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
{
final int oldValue = this.constructed;
this.constructed = data.readByte();
this.bridgePowered = ( this.constructed | this.powered ) == this.powered;
return this.constructed != oldValue;
}
@@ -142,7 +139,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
return this.sidesRing;
}
public boolean isCenter()
private boolean isCenter()
{
for( final Block link : AEApi.instance().definitions().blocks().quantumLink().maybeBlock().asSet() )
{
@@ -180,7 +177,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
{
final ItemStack linkStack = maybeLinkStack.get();
this.gridProxy.setVisualRepresentation( linkStack );
this.getGridProxy().setVisualRepresentation( linkStack );
}
}
@@ -198,7 +195,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
{
if( !affectWorld )
{
this.cluster.updateStatus = false;
this.cluster.setUpdateStatus( false );
}
this.cluster.destroy();
@@ -208,7 +205,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
if( affectWorld )
{
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.getGridProxy().setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
}
}
@@ -238,18 +235,18 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
if( this.isCorner() || this.isCenter() )
{
this.gridProxy.setValidSides( this.getConnections() );
this.getGridProxy().setValidSides( this.getConnections() );
}
else
{
this.gridProxy.setValidSides( EnumSet.allOf( ForgeDirection.class ) );
this.getGridProxy().setValidSides( EnumSet.allOf( ForgeDirection.class ) );
}
}
}
public boolean isCorner()
{
return ( this.constructed & this.corner ) == this.corner && this.constructed != -1;
return ( this.constructed & this.getCorner() ) == this.getCorner() && this.constructed != -1;
}
public EnumSet<ForgeDirection> getConnections()
@@ -291,7 +288,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
try
{
return this.gridProxy.getEnergy().isNetworkPowered();
return this.getGridProxy().getEnergy().isNetworkPowered();
}
catch( final GridAccessException e )
{
@@ -339,4 +336,9 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
this.cluster.destroy();
}
}
public byte getCorner()
{
return this.corner;
}
}
@@ -52,13 +52,13 @@ import appeng.util.Platform;
public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallable<Void>
{
final int[] sides = { 0, 1 };
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 );
YesNo lastRedstoneState = YesNo.UNDECIDED;
private final int[] sides = { 0, 1 };
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 );
private YesNo lastRedstoneState = YesNo.UNDECIDED;
public TileSpatialIOPort()
{
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
this.getGridProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
@@ -127,8 +127,8 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
final ItemStack cell = this.getStackInSlot( 0 );
if( this.isSpatialCell( cell ) && this.getStackInSlot( 1 ) == null )
{
final IGrid gi = this.gridProxy.getGrid();
final IEnergyGrid energy = this.gridProxy.getEnergy();
final IGrid gi = this.getGridProxy().getGrid();
final IEnergyGrid energy = this.getGridProxy().getEnergy();
final ISpatialStorageCell sc = (ISpatialStorageCell) cell.getItem();
@@ -54,16 +54,17 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
public static final int DISPLAY_ENABLED = 0x10;
public static final int DISPLAY_POWERED_ENABLED = 0x20;
public static final int NET_STATUS = 0x10 + 0x20;
final SpatialPylonCalculator calc = new SpatialPylonCalculator( this );
int displayBits = 0;
SpatialPylonCluster cluster;
boolean didHaveLight = false;
private final SpatialPylonCalculator calc = new SpatialPylonCalculator( this );
private int displayBits = 0;
private SpatialPylonCluster cluster;
private boolean didHaveLight = false;
public TileSpatialPylon()
{
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL, GridFlags.MULTIBLOCK );
this.gridProxy.setIdlePowerUsage( 0.5 );
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL, GridFlags.MULTIBLOCK );
this.getProxy().setIdlePowerUsage( 0.5 );
this.getProxy().setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
}
@Override
@@ -123,7 +124,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
public void updateStatus( final SpatialPylonCluster c )
{
this.cluster = c;
this.gridProxy.setValidSides( c == null ? EnumSet.noneOf( ForgeDirection.class ) : EnumSet.allOf( ForgeDirection.class ) );
this.getProxy().setValidSides( c == null ? EnumSet.noneOf( ForgeDirection.class ) : EnumSet.allOf( ForgeDirection.class ) );
this.recalculateDisplay();
}
@@ -135,11 +136,11 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
if( this.cluster != null )
{
if( this.cluster.min.equals( this.getLocation() ) )
if( this.cluster.getMin().equals( this.getLocation() ) )
{
this.displayBits = DISPLAY_END_MIN;
}
else if( this.cluster.max.equals( this.getLocation() ) )
else if( this.cluster.getMax().equals( this.getLocation() ) )
{
this.displayBits = DISPLAY_END_MAX;
}
@@ -148,7 +149,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
this.displayBits = DISPLAY_MIDDLE;
}
switch( this.cluster.currentAxis )
switch( this.cluster.getCurrentAxis() )
{
case X:
this.displayBits |= DISPLAY_X;
@@ -166,12 +167,12 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
try
{
if( this.gridProxy.getEnergy().isNetworkPowered() )
if( this.getProxy().getEnergy().isNetworkPowered() )
{
this.displayBits |= DISPLAY_POWERED_ENABLED;
}
if( this.cluster.isValid && this.gridProxy.isActive() )
if( this.cluster.isValid() && this.getProxy().isActive() )
{
this.displayBits |= DISPLAY_ENABLED;
}
@@ -95,34 +95,34 @@ import appeng.util.item.AEFluidStack;
public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHandler, ITerminalHost, IPriorityHost, IConfigManagerHost, IColorableTile
{
static final ChestNoHandler NO_HANDLER = new ChestNoHandler();
static final int[] SIDES = { 0 };
static final int[] FRONT = { 1 };
static final int[] NO_SLOTS = {};
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 );
final BaseActionSource mySrc = new MachineSource( this );
final IConfigManager config = new ConfigManager( this );
ItemStack storageType;
long lastStateChange = 0;
int priority = 0;
int state = 0;
boolean wasActive = false;
AEColor paintedColor = AEColor.Transparent;
boolean isCached = false;
private static final ChestNoHandler NO_HANDLER = new ChestNoHandler();
private static final int[] SIDES = { 0 };
private static final int[] FRONT = { 1 };
private static final int[] NO_SLOTS = {};
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 );
private final BaseActionSource mySrc = new MachineSource( this );
private final IConfigManager config = new ConfigManager( this );
private ItemStack storageType;
private long lastStateChange = 0;
private int priority = 0;
private int state = 0;
private boolean wasActive = false;
private AEColor paintedColor = AEColor.Transparent;
private boolean isCached = false;
private ICellHandler cellHandler;
private MEMonitorHandler itemCell;
private MEMonitorHandler fluidCell;
public TileChest()
{
this.internalMaxPower = PowerMultiplier.CONFIG.multiply( 40 );
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
this.setInternalMaxPower( PowerMultiplier.CONFIG.multiply( 40 ) );
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
this.config.registerSetting( Settings.SORT_BY, SortOrder.NAME );
this.config.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
this.config.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
this.internalPublicPowerStorage = true;
this.internalPowerFlow = AccessRestriction.WRITE;
this.setInternalPublicPowerStorage( true );
this.setInternalPowerFlow( AccessRestriction.WRITE );
}
@Override
@@ -132,7 +132,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
try
{
this.gridProxy.getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) );
this.getProxy().getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) );
}
catch( final GridAccessException e )
{
@@ -163,13 +163,13 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
this.state &= ~0x40;
}
final boolean currentActive = this.gridProxy.isActive();
final boolean currentActive = this.getProxy().isActive();
if( this.wasActive != currentActive )
{
this.wasActive = currentActive;
try
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch( final GridAccessException e )
{
@@ -189,7 +189,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
return 1;
}
public IMEInventoryHandler getHandler( final StorageChannel channel ) throws ChestNoHandler
private IMEInventoryHandler getHandler( final StorageChannel channel ) throws ChestNoHandler
{
if( !this.isCached )
{
@@ -217,7 +217,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
power += this.cellHandler.cellIdleDrain( is, fluidCell );
}
this.gridProxy.setIdlePowerUsage( power );
this.getProxy().setIdlePowerUsage( power );
this.itemCell = this.wrap( itemCell );
this.fluidCell = this.wrap( fluidCell );
@@ -316,7 +316,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
try
{
gridPowered = this.gridProxy.getEnergy().isNetworkPowered();
gridPowered = this.getProxy().getEnergy().isNetworkPowered();
}
catch( final GridAccessException ignored )
{
@@ -345,7 +345,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
try
{
final IEnergyGrid eg = this.gridProxy.getEnergy();
final IEnergyGrid eg = this.getProxy().getEnergy();
stash = eg.extractAEPower( amt, mode, PowerMultiplier.ONE );
if( stash >= amt )
{
@@ -369,11 +369,11 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
return;
}
final double idleUsage = this.gridProxy.getIdlePowerUsage();
final double idleUsage = this.getProxy().getIdlePowerUsage();
try
{
if( !this.gridProxy.getEnergy().isNetworkPowered() )
if( !this.getProxy().getEnergy().isNetworkPowered() )
{
final double powerUsed = this.extractAEPower( idleUsage, Actionable.MODULATE, PowerMultiplier.CONFIG ); // drain
if( powerUsed + 0.1 >= idleUsage != ( this.state & 0x40 ) > 0 )
@@ -384,7 +384,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
catch( final GridAccessException e )
{
final double powerUsed = this.extractAEPower( this.gridProxy.getIdlePowerUsage(), Actionable.MODULATE, PowerMultiplier.CONFIG ); // drain
final double powerUsed = this.extractAEPower( this.getProxy().getIdlePowerUsage(), Actionable.MODULATE, PowerMultiplier.CONFIG ); // drain
if( powerUsed + 0.1 >= idleUsage != ( this.state & 0x40 ) > 0 )
{
this.recalculateDisplay();
@@ -531,9 +531,9 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
try
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
final IStorageGrid gs = this.gridProxy.getStorage();
final IStorageGrid gs = this.getProxy().getStorage();
Platform.postChanges( gs, removed, added, this.mySrc );
}
catch( final GridAccessException ignored )
@@ -638,7 +638,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public List<IMEInventoryHandler> getCellArray( final StorageChannel channel )
{
if( this.gridProxy.isActive() )
if( this.getProxy().isActive() )
{
try
{
@@ -669,7 +669,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
try
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch( final GridAccessException e )
{
@@ -773,7 +773,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public IStorageMonitorable getMonitorable( final ForgeDirection side, final BaseActionSource src )
{
if( Platform.canAccess( this.gridProxy, src ) && side != this.getForward() )
if( Platform.canAccess( this.getProxy(), src ) && side != this.getForward() )
{
return this;
}
@@ -865,10 +865,10 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
private static final long serialVersionUID = 7995805326136526631L;
}
class ChestNetNotifier<T extends IAEStack<T>> implements IMEMonitorHandlerReceiver<T>
private class ChestNetNotifier<T extends IAEStack<T>> implements IMEMonitorHandlerReceiver<T>
{
final StorageChannel chan;
private final StorageChannel chan;
public ChestNetNotifier( final StorageChannel chan )
{
@@ -896,9 +896,9 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
try
{
if( TileChest.this.gridProxy.isActive() )
if( TileChest.this.getProxy().isActive() )
{
TileChest.this.gridProxy.getStorage().postAlterationOfStoredItems( this.chan, change, TileChest.this.mySrc );
TileChest.this.getProxy().getStorage().postAlterationOfStoredItems( this.chan, change, TileChest.this.mySrc );
}
}
catch( final GridAccessException e )
@@ -917,7 +917,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
}
class ChestMonitorHandler<T extends IAEStack> extends MEMonitorHandler<T>
private class ChestMonitorHandler<T extends IAEStack> extends MEMonitorHandler<T>
{
public ChestMonitorHandler( final IMEInventoryHandler<T> t )
@@ -925,7 +925,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
super( t );
}
public IMEInventoryHandler<T> getInternalHandler()
private IMEInventoryHandler<T> getInternalHandler()
{
final IMEInventoryHandler<T> h = this.getHandler();
if( h instanceof MEInventoryHandler )
@@ -62,23 +62,23 @@ import appeng.util.Platform;
public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPriorityHost
{
final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 10 );
final ICellHandler[] handlersBySlot = new ICellHandler[10];
final DriveWatcher<IAEItemStack>[] invBySlot = new DriveWatcher[10];
final BaseActionSource mySrc;
boolean isCached = false;
List<MEInventoryHandler> items = new LinkedList<MEInventoryHandler>();
List<MEInventoryHandler> fluids = new LinkedList<MEInventoryHandler>();
long lastStateChange = 0;
int state = 0;
int priority = 0;
boolean wasActive = false;
private final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 10 );
private final ICellHandler[] handlersBySlot = new ICellHandler[10];
private final DriveWatcher<IAEItemStack>[] invBySlot = new DriveWatcher[10];
private final BaseActionSource mySrc;
private boolean isCached = false;
private List<MEInventoryHandler> items = new LinkedList<MEInventoryHandler>();
private List<MEInventoryHandler> fluids = new LinkedList<MEInventoryHandler>();
private long lastStateChange = 0;
private int state = 0;
private int priority = 0;
private boolean wasActive = false;
public TileDrive()
{
this.mySrc = new MachineSource( this );
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
this.getGridProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
}
@TileEvent( TileEventType.NETWORK_WRITE )
@@ -93,7 +93,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
this.state &= 0x24924924; // just keep the blinks...
}
if( this.gridProxy.isActive() )
if( this.getGridProxy().isActive() )
{
this.state |= 0x80000000;
}
@@ -160,7 +160,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
return ( this.state & 0x80000000 ) == 0x80000000;
}
return this.gridProxy.isActive();
return this.getGridProxy().isActive();
}
@Override
@@ -205,7 +205,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
private void recalculateDisplay()
{
final boolean currentActive = this.gridProxy.isActive();
final boolean currentActive = this.getGridProxy().isActive();
if( currentActive )
{
this.state |= 0x80000000;
@@ -220,7 +220,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
this.wasActive = currentActive;
try
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.getGridProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch( final GridAccessException e )
{
@@ -281,9 +281,9 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
try
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.getGridProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
final IStorageGrid gs = this.gridProxy.getStorage();
final IStorageGrid gs = this.getGridProxy().getStorage();
Platform.postChanges( gs, removed, added, this.mySrc );
}
catch( final GridAccessException ignored )
@@ -299,7 +299,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
return this.sides;
}
public void updateState()
private void updateState()
{
if( !this.isCached )
{
@@ -349,7 +349,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
}
}
this.gridProxy.setIdlePowerUsage( power );
this.getGridProxy().setIdlePowerUsage( power );
this.isCached = true;
}
@@ -365,7 +365,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
@Override
public List<IMEInventoryHandler> getCellArray( final StorageChannel channel )
{
if( this.gridProxy.isActive() )
if( this.getGridProxy().isActive() )
{
this.updateState();
return (List) ( channel == StorageChannel.ITEMS ? this.items : this.fluids );
@@ -390,7 +390,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
try
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.getGridProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch( final GridAccessException e )
{
@@ -106,7 +106,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
@Reflected
public TileIOPort()
{
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
this.getGridProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
this.manager = new ConfigManager( this );
this.manager.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
this.manager.registerSetting( Settings.FULLNESS_MODE, FullnessMode.EMPTY );
@@ -158,11 +158,11 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
{
if( this.hasWork() )
{
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
this.getGridProxy().getTick().wakeDevice( this.getGridProxy().getNode() );
}
else
{
this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
this.getGridProxy().getTick().sleepDevice( this.getGridProxy().getNode() );
}
}
catch( final GridAccessException e )
@@ -181,7 +181,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
}
public boolean getRedstoneState()
private boolean getRedstoneState()
{
if( this.lastRedstoneState == YesNo.UNDECIDED )
{
@@ -234,7 +234,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
this.updateTask();
}
boolean hasWork()
private boolean hasWork()
{
if( this.isEnabled() )
{
@@ -307,13 +307,13 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
@Override
public TickingRequest getTickingRequest( final IGridNode node )
{
return new TickingRequest( TickRates.IOPort.min, TickRates.IOPort.max, this.hasWork(), false );
return new TickingRequest( TickRates.IOPort.getMin(), TickRates.IOPort.getMax(), this.hasWork(), false );
}
@Override
public TickRateModulation tickingRequest( final IGridNode node, final int ticksSinceLastCall )
{
if( !this.gridProxy.isActive() )
if( !this.getGridProxy().isActive() )
{
return TickRateModulation.IDLE;
}
@@ -335,9 +335,9 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
try
{
final IMEInventory<IAEItemStack> itemNet = this.gridProxy.getStorage().getItemInventory();
final IMEInventory<IAEFluidStack> fluidNet = this.gridProxy.getStorage().getFluidInventory();
final IEnergySource energy = this.gridProxy.getEnergy();
final IMEInventory<IAEItemStack> itemNet = this.getGridProxy().getStorage().getItemInventory();
final IMEInventory<IAEFluidStack> fluidNet = this.getGridProxy().getStorage().getFluidInventory();
final IEnergySource energy = this.getGridProxy().getEnergy();
for( int x = 0; x < 6; x++ )
{
final ItemStack is = this.cells.getStackInSlot( x );
@@ -36,29 +36,29 @@ import appeng.util.Platform;
public class TileSkyChest extends AEBaseInvTile
{
final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 };
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 9 * 4 );
private final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 };
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 9 * 4 );
// server
public int playerOpen;
private int playerOpen;
// client..
public long lastEvent;
public float lidAngle;
private long lastEvent;
private float lidAngle;
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileSkyChest( final ByteBuf data )
{
data.writeBoolean( this.playerOpen > 0 );
data.writeBoolean( this.getPlayerOpen() > 0 );
}
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileSkyChest( final ByteBuf data )
{
final int wasOpen = this.playerOpen;
this.playerOpen = data.readBoolean() ? 1 : 0;
final int wasOpen = this.getPlayerOpen();
this.setPlayerOpen( data.readBoolean() ? 1 : 0 );
if( wasOpen != this.playerOpen )
if( wasOpen != this.getPlayerOpen() )
{
this.lastEvent = System.currentTimeMillis();
this.setLastEvent( System.currentTimeMillis() );
}
return false; // TESR yo!
@@ -84,9 +84,9 @@ public class TileSkyChest extends AEBaseInvTile
return;
}
this.playerOpen++;
this.setPlayerOpen( this.getPlayerOpen() + 1 );
if( this.playerOpen == 1 )
if( this.getPlayerOpen() == 1 )
{
this.getWorldObj().playSoundEffect( this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, "random.chestopen", 0.5F, this.getWorldObj().rand.nextFloat() * 0.1F + 0.9F );
this.markForUpdate();
@@ -101,14 +101,14 @@ public class TileSkyChest extends AEBaseInvTile
return;
}
this.playerOpen--;
this.setPlayerOpen( this.getPlayerOpen() - 1 );
if( this.playerOpen < 0 )
if( this.getPlayerOpen() < 0 )
{
this.playerOpen = 0;
this.setPlayerOpen( 0 );
}
if( this.playerOpen == 0 )
if( this.getPlayerOpen() == 0 )
{
this.getWorldObj().playSoundEffect( this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, "random.chestclosed", 0.5F, this.getWorldObj().rand.nextFloat() * 0.1F + 0.9F );
this.markForUpdate();
@@ -126,4 +126,34 @@ public class TileSkyChest extends AEBaseInvTile
{
return this.sides;
}
public float getLidAngle()
{
return this.lidAngle;
}
public void setLidAngle( final float lidAngle )
{
this.lidAngle = lidAngle;
}
public int getPlayerOpen()
{
return this.playerOpen;
}
private void setPlayerOpen( final int playerOpen )
{
this.playerOpen = playerOpen;
}
public long getLastEvent()
{
return this.lastEvent;
}
private void setLastEvent( final long lastEvent )
{
this.lastEvent = lastEvent;
}
}