Changed access to use this qualifier
This commit is contained in:
@@ -52,9 +52,9 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
||||
|
||||
public IInventory getCellUpgradeInventory()
|
||||
{
|
||||
if ( cacheUpgrades == null )
|
||||
if ( this.cacheUpgrades == null )
|
||||
{
|
||||
ICellWorkbenchItem cell = getCell();
|
||||
ICellWorkbenchItem cell = this.getCell();
|
||||
if ( cell == null )
|
||||
return null;
|
||||
|
||||
@@ -66,16 +66,16 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
||||
if ( inv == null )
|
||||
return null;
|
||||
|
||||
return cacheUpgrades = inv;
|
||||
return this.cacheUpgrades = inv;
|
||||
}
|
||||
return cacheUpgrades;
|
||||
return this.cacheUpgrades;
|
||||
}
|
||||
|
||||
public IInventory getCellConfigInventory()
|
||||
{
|
||||
if ( cacheConfig == null )
|
||||
if ( this.cacheConfig == null )
|
||||
{
|
||||
ICellWorkbenchItem cell = getCell();
|
||||
ICellWorkbenchItem cell = this.getCell();
|
||||
if ( cell == null )
|
||||
return null;
|
||||
|
||||
@@ -87,40 +87,40 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
||||
if ( inv == null )
|
||||
return null;
|
||||
|
||||
return cacheConfig = inv;
|
||||
return this.cacheConfig = inv;
|
||||
}
|
||||
return cacheConfig;
|
||||
return this.cacheConfig;
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public void writeToNBT_TileCellWorkbench(NBTTagCompound data)
|
||||
{
|
||||
cell.writeToNBT( data, "cell" );
|
||||
config.writeToNBT( data, "config" );
|
||||
cm.writeToNBT( data );
|
||||
this.cell.writeToNBT( data, "cell" );
|
||||
this.config.writeToNBT( data, "config" );
|
||||
this.cm.writeToNBT( data );
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBT_TileCellWorkbench(NBTTagCompound data)
|
||||
{
|
||||
cell.readFromNBT( data, "cell" );
|
||||
config.readFromNBT( data, "config" );
|
||||
cm.readFromNBT( data );
|
||||
this.cell.readFromNBT( data, "cell" );
|
||||
this.config.readFromNBT( data, "config" );
|
||||
this.cm.readFromNBT( data );
|
||||
}
|
||||
|
||||
public TileCellWorkbench() {
|
||||
cm.registerSetting( Settings.COPY_MODE, CopyMode.CLEAR_ON_REMOVE );
|
||||
cell.enableClientEvents = true;
|
||||
this.cm.registerSetting( Settings.COPY_MODE, CopyMode.CLEAR_ON_REMOVE );
|
||||
this.cell.enableClientEvents = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName(String name)
|
||||
{
|
||||
if ( name.equals( "config" ) )
|
||||
return config;
|
||||
return this.config;
|
||||
|
||||
if ( name.equals( "cell" ) )
|
||||
return cell;
|
||||
return this.cell;
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -136,14 +136,14 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack)
|
||||
{
|
||||
if ( inv == cell && !locked )
|
||||
if ( inv == this.cell && !this.locked )
|
||||
{
|
||||
locked = true;
|
||||
this.locked = true;
|
||||
|
||||
cacheUpgrades = null;
|
||||
cacheConfig = null;
|
||||
this.cacheUpgrades = null;
|
||||
this.cacheConfig = null;
|
||||
|
||||
IInventory c = getCellConfigInventory();
|
||||
IInventory c = this.getCellConfigInventory();
|
||||
if ( c != null )
|
||||
{
|
||||
boolean cellHasConfig = false;
|
||||
@@ -158,34 +158,34 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
||||
|
||||
if ( cellHasConfig )
|
||||
{
|
||||
for (int x = 0; x < config.getSizeInventory(); x++)
|
||||
config.setInventorySlotContents( x, c.getStackInSlot( x ) );
|
||||
for (int x = 0; x < this.config.getSizeInventory(); x++)
|
||||
this.config.setInventorySlotContents( x, c.getStackInSlot( x ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int x = 0; x < config.getSizeInventory(); x++)
|
||||
c.setInventorySlotContents( x, config.getStackInSlot( x ) );
|
||||
for (int x = 0; x < this.config.getSizeInventory(); x++)
|
||||
c.setInventorySlotContents( x, this.config.getStackInSlot( x ) );
|
||||
|
||||
c.markDirty();
|
||||
}
|
||||
}
|
||||
else if ( cm.getSetting( Settings.COPY_MODE ) == CopyMode.CLEAR_ON_REMOVE )
|
||||
else if ( this.cm.getSetting( Settings.COPY_MODE ) == CopyMode.CLEAR_ON_REMOVE )
|
||||
{
|
||||
for (int x = 0; x < config.getSizeInventory(); x++)
|
||||
config.setInventorySlotContents( x, null );
|
||||
for (int x = 0; x < this.config.getSizeInventory(); x++)
|
||||
this.config.setInventorySlotContents( x, null );
|
||||
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
locked = false;
|
||||
this.locked = false;
|
||||
}
|
||||
else if ( inv == config && !locked )
|
||||
else if ( inv == this.config && !this.locked )
|
||||
{
|
||||
IInventory c = getCellConfigInventory();
|
||||
IInventory c = this.getCellConfigInventory();
|
||||
if ( c != null )
|
||||
{
|
||||
for (int x = 0; x < config.getSizeInventory(); x++)
|
||||
c.setInventorySlotContents( x, config.getStackInSlot( x ) );
|
||||
for (int x = 0; x < this.config.getSizeInventory(); x++)
|
||||
c.setInventorySlotContents( x, this.config.getStackInSlot( x ) );
|
||||
|
||||
c.markDirty();
|
||||
}
|
||||
@@ -197,17 +197,17 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
||||
{
|
||||
super.getDrops( w, x, y, z, drops );
|
||||
|
||||
if ( cell.getStackInSlot( 0 ) != null )
|
||||
drops.add( cell.getStackInSlot( 0 ) );
|
||||
if ( this.cell.getStackInSlot( 0 ) != null )
|
||||
drops.add( this.cell.getStackInSlot( 0 ) );
|
||||
}
|
||||
|
||||
public ICellWorkbenchItem getCell()
|
||||
{
|
||||
if ( cell.getStackInSlot( 0 ) == null )
|
||||
if ( this.cell.getStackInSlot( 0 ) == null )
|
||||
return null;
|
||||
|
||||
if ( cell.getStackInSlot( 0 ).getItem() instanceof ICellWorkbenchItem )
|
||||
return ((ICellWorkbenchItem) cell.getStackInSlot( 0 ).getItem());
|
||||
if ( this.cell.getStackInSlot( 0 ).getItem() instanceof ICellWorkbenchItem )
|
||||
return ((ICellWorkbenchItem) this.cell.getStackInSlot( 0 ).getItem());
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -215,7 +215,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
||||
@Override
|
||||
public IConfigManager getConfigManager()
|
||||
{
|
||||
return cm;
|
||||
return this.cm;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -70,11 +70,11 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
|
||||
{
|
||||
IAEItemStack item = AEItemStack.loadItemStackFromPacket( data );
|
||||
ItemStack is = item.getItemStack();
|
||||
inv.setInventorySlotContents( 0, is );
|
||||
this.inv.setInventorySlotContents( 0, is );
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
inv.setInventorySlotContents( 0, null );
|
||||
this.inv.setInventorySlotContents( 0, null );
|
||||
}
|
||||
return false; // TESR doesn't need updates!
|
||||
}
|
||||
@@ -82,7 +82,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
|
||||
@TileEvent(TileEventType.NETWORK_WRITE)
|
||||
public void writeToStream_TileCharger(ByteBuf data) throws IOException
|
||||
{
|
||||
AEItemStack is = AEItemStack.create( getStackInSlot( 0 ) );
|
||||
AEItemStack is = AEItemStack.create( this.getStackInSlot( 0 ) );
|
||||
if ( is != null )
|
||||
is.writeToPacket( data );
|
||||
}
|
||||
@@ -90,29 +90,29 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
|
||||
@TileEvent(TileEventType.TICK)
|
||||
public void Tick_TileCharger()
|
||||
{
|
||||
if ( lastUpdate > 60 && requiresUpdate )
|
||||
if ( this.lastUpdate > 60 && this.requiresUpdate )
|
||||
{
|
||||
requiresUpdate = false;
|
||||
markForUpdate();
|
||||
lastUpdate = 0;
|
||||
this.requiresUpdate = false;
|
||||
this.markForUpdate();
|
||||
this.lastUpdate = 0;
|
||||
}
|
||||
lastUpdate++;
|
||||
this.lastUpdate++;
|
||||
|
||||
tickTickTimer++;
|
||||
if ( tickTickTimer < 20 )
|
||||
this.tickTickTimer++;
|
||||
if ( this.tickTickTimer < 20 )
|
||||
return;
|
||||
tickTickTimer = 0;
|
||||
this.tickTickTimer = 0;
|
||||
|
||||
ItemStack myItem = getStackInSlot( 0 );
|
||||
ItemStack myItem = this.getStackInSlot( 0 );
|
||||
|
||||
// charge from the network!
|
||||
if ( internalCurrentPower < 1499 )
|
||||
if ( this.internalCurrentPower < 1499 )
|
||||
{
|
||||
try
|
||||
{
|
||||
injectExternalPower( PowerUnits.AE,
|
||||
gridProxy.getEnergy().extractAEPower( Math.min( 150.0, 1500.0 - internalCurrentPower ), Actionable.MODULATE, PowerMultiplier.ONE ) );
|
||||
tickTickTimer = 20; // keep ticking...
|
||||
this.injectExternalPower( PowerUnits.AE,
|
||||
this.gridProxy.getEnergy().extractAEPower( Math.min( 150.0, 1500.0 - this.internalCurrentPower ), Actionable.MODULATE, PowerMultiplier.ONE ) );
|
||||
this.tickTickTimer = 20; // keep ticking...
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -123,86 +123,86 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
|
||||
if ( myItem == null )
|
||||
return;
|
||||
|
||||
if ( internalCurrentPower > 149 && Platform.isChargeable( myItem ) )
|
||||
if ( this.internalCurrentPower > 149 && Platform.isChargeable( myItem ) )
|
||||
{
|
||||
IAEItemPowerStorage ps = (IAEItemPowerStorage) myItem.getItem();
|
||||
if ( ps.getAEMaxPower( myItem ) > ps.getAECurrentPower( myItem ) )
|
||||
{
|
||||
double oldPower = internalCurrentPower;
|
||||
double oldPower = this.internalCurrentPower;
|
||||
|
||||
double adjustment = ps.injectAEPower( myItem, extractAEPower( 150.0, Actionable.MODULATE, PowerMultiplier.CONFIG ) );
|
||||
internalCurrentPower += adjustment;
|
||||
if ( oldPower > internalCurrentPower )
|
||||
requiresUpdate = true;
|
||||
tickTickTimer = 20; // keep ticking...
|
||||
double adjustment = ps.injectAEPower( myItem, this.extractAEPower( 150.0, Actionable.MODULATE, PowerMultiplier.CONFIG ) );
|
||||
this.internalCurrentPower += adjustment;
|
||||
if ( oldPower > this.internalCurrentPower )
|
||||
this.requiresUpdate = true;
|
||||
this.tickTickTimer = 20; // keep ticking...
|
||||
}
|
||||
}
|
||||
else if ( internalCurrentPower > 1499 && AEApi.instance().materials().materialCertusQuartzCrystal.sameAsStack( myItem ) )
|
||||
else if ( this.internalCurrentPower > 1499 && AEApi.instance().materials().materialCertusQuartzCrystal.sameAsStack( myItem ) )
|
||||
{
|
||||
if ( Platform.getRandomFloat() > 0.8f ) // simulate wait
|
||||
{
|
||||
extractAEPower( internalMaxPower, Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500
|
||||
setInventorySlotContents( 0, AEApi.instance().materials().materialCertusQuartzCrystalCharged.stack( myItem.stackSize ) );
|
||||
this.extractAEPower( this.internalMaxPower, Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500
|
||||
this.setInventorySlotContents( 0, AEApi.instance().materials().materialCertusQuartzCrystalCharged.stack( myItem.stackSize ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TileCharger() {
|
||||
gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||
gridProxy.setFlags();
|
||||
internalMaxPower = 1500;
|
||||
gridProxy.setIdlePowerUsage( 0 );
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||
this.gridProxy.setFlags();
|
||||
this.internalMaxPower = 1500;
|
||||
this.gridProxy.setIdlePowerUsage( 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation(ForgeDirection inForward, ForgeDirection inUp)
|
||||
{
|
||||
super.setOrientation( inForward, inUp );
|
||||
gridProxy.setValidSides( EnumSet.of( getUp(), getUp().getOpposite() ) );
|
||||
setPowerSides( EnumSet.of( getUp(), getUp().getOpposite() ) );
|
||||
this.gridProxy.setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) );
|
||||
this.setPowerSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTurn()
|
||||
{
|
||||
return internalCurrentPower < internalMaxPower;
|
||||
return this.internalCurrentPower < this.internalMaxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyTurn()
|
||||
{
|
||||
injectExternalPower( PowerUnits.AE, 150 );
|
||||
this.injectExternalPower( PowerUnits.AE, 150 );
|
||||
|
||||
ItemStack myItem = getStackInSlot( 0 );
|
||||
if ( internalCurrentPower > 1499 && AEApi.instance().materials().materialCertusQuartzCrystal.sameAsStack( myItem ) )
|
||||
ItemStack myItem = this.getStackInSlot( 0 );
|
||||
if ( this.internalCurrentPower > 1499 && AEApi.instance().materials().materialCertusQuartzCrystal.sameAsStack( myItem ) )
|
||||
{
|
||||
extractAEPower( internalMaxPower, Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500
|
||||
setInventorySlotContents( 0, AEApi.instance().materials().materialCertusQuartzCrystalCharged.stack( myItem.stackSize ) );
|
||||
this.extractAEPower( this.internalMaxPower, Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500
|
||||
this.setInventorySlotContents( 0, AEApi.instance().materials().materialCertusQuartzCrystalCharged.stack( myItem.stackSize ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCrankAttach(ForgeDirection directionToCrank)
|
||||
{
|
||||
return getUp().equals( directionToCrank ) || getUp().getOpposite().equals( directionToCrank );
|
||||
return this.getUp().equals( directionToCrank ) || this.getUp().getOpposite().equals( directionToCrank );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInternalInventory()
|
||||
{
|
||||
return inv;
|
||||
return this.inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added)
|
||||
{
|
||||
markForUpdate();
|
||||
this.markForUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide(ForgeDirection whichSide)
|
||||
{
|
||||
return sides;
|
||||
return this.sides;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -235,22 +235,22 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
|
||||
if ( !Platform.hasPermissions( new DimensionalCoord( this ), player ) )
|
||||
return;
|
||||
|
||||
ItemStack myItem = getStackInSlot( 0 );
|
||||
ItemStack myItem = this.getStackInSlot( 0 );
|
||||
if ( myItem == null )
|
||||
{
|
||||
ItemStack held = player.inventory.getCurrentItem();
|
||||
if ( AEApi.instance().materials().materialCertusQuartzCrystal.sameAsStack( held ) || Platform.isChargeable( held ) )
|
||||
{
|
||||
held = player.inventory.decrStackSize( player.inventory.currentItem, 1 );
|
||||
setInventorySlotContents( 0, held );
|
||||
this.setInventorySlotContents( 0, held );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
drops.add( myItem );
|
||||
setInventorySlotContents( 0, null );
|
||||
Platform.spawnDrops( worldObj, xCoord + getForward().offsetX, yCoord + getForward().offsetY, zCoord + getForward().offsetZ, drops );
|
||||
this.setInventorySlotContents( 0, null );
|
||||
Platform.spawnDrops( this.worldObj, this.xCoord + this.getForward().offsetX, this.yCoord + this.getForward().offsetY, this.zCoord + this.getForward().offsetZ, drops );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,24 +54,24 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public void writeToNBT_TileCondenser(NBTTagCompound data)
|
||||
{
|
||||
cm.writeToNBT( data );
|
||||
data.setDouble( "storedPower", storedPower );
|
||||
this.cm.writeToNBT( data );
|
||||
data.setDouble( "storedPower", this.storedPower );
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBT_TileCondenser(NBTTagCompound data)
|
||||
{
|
||||
cm.readFromNBT( data );
|
||||
storedPower = data.getDouble( "storedPower" );
|
||||
this.cm.readFromNBT( data );
|
||||
this.storedPower = data.getDouble( "storedPower" );
|
||||
}
|
||||
|
||||
public TileCondenser() {
|
||||
cm.registerSetting( Settings.CONDENSER_OUTPUT, CondenserOutput.TRASH );
|
||||
this.cm.registerSetting( Settings.CONDENSER_OUTPUT, CondenserOutput.TRASH );
|
||||
}
|
||||
|
||||
public double getStorage()
|
||||
{
|
||||
ItemStack is = inv.getStackInSlot( 2 );
|
||||
ItemStack is = this.inv.getStackInSlot( 2 );
|
||||
if ( is != null )
|
||||
{
|
||||
if ( is.getItem() instanceof IStorageComponent )
|
||||
@@ -86,17 +86,17 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
|
||||
|
||||
public void addPower(double rawPower)
|
||||
{
|
||||
storedPower += rawPower;
|
||||
storedPower = Math.max( 0.0, Math.min( getStorage(), storedPower ) );
|
||||
this.storedPower += rawPower;
|
||||
this.storedPower = Math.max( 0.0, Math.min( this.getStorage(), this.storedPower ) );
|
||||
|
||||
double requiredPower = getRequiredPower();
|
||||
ItemStack output = getOutput();
|
||||
while (requiredPower <= storedPower && output != null && requiredPower > 0)
|
||||
double requiredPower = this.getRequiredPower();
|
||||
ItemStack output = this.getOutput();
|
||||
while (requiredPower <= this.storedPower && output != null && requiredPower > 0)
|
||||
{
|
||||
if ( canAddOutput( output ) )
|
||||
if ( this.canAddOutput( output ) )
|
||||
{
|
||||
storedPower -= requiredPower;
|
||||
addOutput( output );
|
||||
this.storedPower -= requiredPower;
|
||||
this.addOutput( output );
|
||||
}
|
||||
else
|
||||
break;
|
||||
@@ -106,7 +106,7 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
|
||||
|
||||
private boolean canAddOutput(ItemStack output)
|
||||
{
|
||||
ItemStack outputStack = getStackInSlot( 1 );
|
||||
ItemStack outputStack = this.getStackInSlot( 1 );
|
||||
return outputStack == null || (Platform.isSameItem( outputStack, output ) && outputStack.stackSize < outputStack.getMaxStackSize());
|
||||
}
|
||||
|
||||
@@ -117,19 +117,19 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
|
||||
*/
|
||||
private void addOutput(ItemStack output)
|
||||
{
|
||||
ItemStack outputStack = getStackInSlot( 1 );
|
||||
ItemStack outputStack = this.getStackInSlot( 1 );
|
||||
if ( outputStack == null )
|
||||
setInventorySlotContents( 1, output.copy() );
|
||||
this.setInventorySlotContents( 1, output.copy() );
|
||||
else
|
||||
{
|
||||
outputStack.stackSize++;
|
||||
setInventorySlotContents( 1, outputStack );
|
||||
this.setInventorySlotContents( 1, outputStack );
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack getOutput()
|
||||
{
|
||||
switch ((CondenserOutput) cm.getSetting( Settings.CONDENSER_OUTPUT ))
|
||||
switch ((CondenserOutput) this.cm.getSetting( Settings.CONDENSER_OUTPUT ))
|
||||
{
|
||||
case MATTER_BALLS:
|
||||
return AEApi.instance().materials().materialMatterBall.stack( 1 );
|
||||
@@ -143,7 +143,7 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
|
||||
|
||||
public double getRequiredPower()
|
||||
{
|
||||
return ((CondenserOutput) cm.getSetting( Settings.CONDENSER_OUTPUT )).requiredPower;
|
||||
return ((CondenserOutput) this.cm.getSetting( Settings.CONDENSER_OUTPUT )).requiredPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -152,11 +152,11 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
|
||||
if ( i == 0 )
|
||||
{
|
||||
if ( itemstack != null )
|
||||
addPower( itemstack.stackSize );
|
||||
this.addPower( itemstack.stackSize );
|
||||
}
|
||||
else
|
||||
{
|
||||
inv.setInventorySlotContents( 1, itemstack );
|
||||
this.inv.setInventorySlotContents( 1, itemstack );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,13 +181,13 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide(ForgeDirection side)
|
||||
{
|
||||
return sides;
|
||||
return this.sides;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInternalInventory()
|
||||
{
|
||||
return inv;
|
||||
return this.inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -198,7 +198,7 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
|
||||
ItemStack is = inv.getStackInSlot( 0 );
|
||||
if ( is != null )
|
||||
{
|
||||
addPower( is.stackSize );
|
||||
this.addPower( is.stackSize );
|
||||
inv.setInventorySlotContents( 0, null );
|
||||
}
|
||||
}
|
||||
@@ -208,7 +208,7 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
if ( doFill )
|
||||
addPower( (resource == null ? 0.0 : (double) resource.amount) / 500.0 );
|
||||
this.addPower( (resource == null ? 0.0 : (double) resource.amount) / 500.0 );
|
||||
|
||||
return resource == null ? 0 : resource.amount;
|
||||
}
|
||||
@@ -246,13 +246,13 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
|
||||
@Override
|
||||
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
|
||||
{
|
||||
addPower( 0 );
|
||||
this.addPower( 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConfigManager getConfigManager()
|
||||
{
|
||||
return cm;
|
||||
return this.cm;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
|
||||
static final ItemStack inscriberStack = AEApi.instance().blocks().blockInscriber.stack( 1 );
|
||||
private final IConfigManager settings = new ConfigManager( this );
|
||||
private final UpgradeInventory upgrades = new UpgradeInventory( inscriberStack, this, getUpgradeSlots() );
|
||||
private final UpgradeInventory upgrades = new UpgradeInventory( inscriberStack, this, this.getUpgradeSlots() );
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType(ForgeDirection dir)
|
||||
@@ -90,17 +90,17 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public void writeToNBT_TileInscriber(NBTTagCompound data)
|
||||
{
|
||||
inv.writeToNBT( data, "inscriberInv" );
|
||||
upgrades.writeToNBT( data, "upgrades" );
|
||||
settings.writeToNBT( data );
|
||||
this.inv.writeToNBT( data, "inscriberInv" );
|
||||
this.upgrades.writeToNBT( data, "upgrades" );
|
||||
this.settings.writeToNBT( data );
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBT_TileInscriber(NBTTagCompound data)
|
||||
{
|
||||
inv.readFromNBT( data, "inscriberInv" );
|
||||
upgrades.readFromNBT( data, "upgrades" );
|
||||
settings.readFromNBT( data );
|
||||
this.inv.readFromNBT( data, "inscriberInv" );
|
||||
this.upgrades.readFromNBT( data, "upgrades" );
|
||||
this.settings.readFromNBT( data );
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_READ)
|
||||
@@ -108,21 +108,21 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
{
|
||||
int slot = data.readByte();
|
||||
|
||||
boolean oldSmash = smash;
|
||||
boolean oldSmash = this.smash;
|
||||
boolean newSmash = (slot & 64) == 64;
|
||||
|
||||
if ( oldSmash != newSmash && newSmash )
|
||||
{
|
||||
smash = true;
|
||||
clientStart = System.currentTimeMillis();
|
||||
this.smash = true;
|
||||
this.clientStart = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
for (int num = 0; num < inv.getSizeInventory(); num++)
|
||||
for (int num = 0; num < this.inv.getSizeInventory(); num++)
|
||||
{
|
||||
if ( (slot & (1 << num)) > 0 )
|
||||
inv.setInventorySlotContents( num, AEItemStack.loadItemStackFromPacket( data ).getItemStack() );
|
||||
this.inv.setInventorySlotContents( num, AEItemStack.loadItemStackFromPacket( data ).getItemStack() );
|
||||
else
|
||||
inv.setInventorySlotContents( num, null );
|
||||
this.inv.setInventorySlotContents( num, null );
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -131,20 +131,20 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
@TileEvent(TileEventType.NETWORK_WRITE)
|
||||
public void writeToStream_TileInscriber(ByteBuf data) throws IOException
|
||||
{
|
||||
int slot = smash ? 64 : 0;
|
||||
int slot = this.smash ? 64 : 0;
|
||||
|
||||
for (int num = 0; num < inv.getSizeInventory(); num++)
|
||||
for (int num = 0; num < this.inv.getSizeInventory(); num++)
|
||||
{
|
||||
if ( inv.getStackInSlot( num ) != null )
|
||||
if ( this.inv.getStackInSlot( num ) != null )
|
||||
slot = slot | (1 << num);
|
||||
}
|
||||
|
||||
data.writeByte( slot );
|
||||
for (int num = 0; num < inv.getSizeInventory(); num++)
|
||||
for (int num = 0; num < this.inv.getSizeInventory(); num++)
|
||||
{
|
||||
if ( (slot & (1 << num)) > 0 )
|
||||
{
|
||||
AEItemStack st = AEItemStack.create( inv.getStackInSlot( num ) );
|
||||
AEItemStack st = AEItemStack.create( this.inv.getStackInSlot( num ) );
|
||||
st.writeToPacket( data );
|
||||
}
|
||||
}
|
||||
@@ -158,35 +158,35 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
|
||||
public TileInscriber()
|
||||
{
|
||||
gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||
internalMaxPower = 1500;
|
||||
gridProxy.setIdlePowerUsage( 0 );
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||
this.internalMaxPower = 1500;
|
||||
this.gridProxy.setIdlePowerUsage( 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation(ForgeDirection inForward, ForgeDirection inUp)
|
||||
{
|
||||
super.setOrientation( inForward, inUp );
|
||||
gridProxy.setValidSides( EnumSet.complementOf( EnumSet.of( getForward() ) ) );
|
||||
setPowerSides( EnumSet.complementOf( EnumSet.of( getForward() ) ) );
|
||||
this.gridProxy.setValidSides( EnumSet.complementOf( EnumSet.of( this.getForward() ) ) );
|
||||
this.setPowerSides( EnumSet.complementOf( EnumSet.of( this.getForward() ) ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInternalInventory()
|
||||
{
|
||||
return inv;
|
||||
return this.inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide(ForgeDirection d)
|
||||
{
|
||||
if ( d == ForgeDirection.UP )
|
||||
return top;
|
||||
return this.top;
|
||||
|
||||
if ( d == ForgeDirection.DOWN )
|
||||
return bottom;
|
||||
return this.bottom;
|
||||
|
||||
return sides;
|
||||
return this.sides;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -198,7 +198,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack)
|
||||
{
|
||||
if ( smash )
|
||||
if ( this.smash )
|
||||
return false;
|
||||
|
||||
if ( i == 0 || i == 1 )
|
||||
@@ -225,7 +225,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j)
|
||||
{
|
||||
if ( smash )
|
||||
if ( this.smash )
|
||||
return false;
|
||||
|
||||
return i == 0 || i == 1 || i == 3;
|
||||
@@ -239,12 +239,12 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
if ( mc != InvOperation.markDirty )
|
||||
{
|
||||
if ( slot != 3 )
|
||||
processingTime = 0;
|
||||
this.processingTime = 0;
|
||||
|
||||
if ( !smash )
|
||||
markForUpdate();
|
||||
if ( !this.smash )
|
||||
this.markForUpdate();
|
||||
|
||||
gridProxy.getTick().wakeDevice( gridProxy.getNode() );
|
||||
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
|
||||
}
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
@@ -255,9 +255,9 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
|
||||
public InscriberRecipe getTask()
|
||||
{
|
||||
ItemStack PlateA = getStackInSlot( 0 );
|
||||
ItemStack PlateB = getStackInSlot( 1 );
|
||||
ItemStack renamedItem = getStackInSlot( 2 );
|
||||
ItemStack PlateA = this.getStackInSlot( 0 );
|
||||
ItemStack PlateB = this.getStackInSlot( 1 );
|
||||
ItemStack renamedItem = this.getStackInSlot( 2 );
|
||||
|
||||
if ( PlateA != null && PlateA.stackSize > 1 )
|
||||
return null;
|
||||
@@ -320,7 +320,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
{
|
||||
for (ItemStack option : i.imprintable)
|
||||
{
|
||||
if ( Platform.isSameItemPrecise( option, getStackInSlot( 2 ) ) )
|
||||
if ( Platform.isSameItemPrecise( option, this.getStackInSlot( 2 ) ) )
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -331,55 +331,55 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
|
||||
private boolean hasWork()
|
||||
{
|
||||
if ( getTask() != null )
|
||||
if ( this.getTask() != null )
|
||||
return true;
|
||||
|
||||
processingTime = 0;
|
||||
return smash;
|
||||
this.processingTime = 0;
|
||||
return this.smash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(IGridNode node)
|
||||
{
|
||||
return new TickingRequest( TickRates.Inscriber.min, TickRates.Inscriber.max, !hasWork(), false );
|
||||
return new TickingRequest( TickRates.Inscriber.min, TickRates.Inscriber.max, !this.hasWork(), false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
|
||||
{
|
||||
if ( smash )
|
||||
if ( this.smash )
|
||||
{
|
||||
|
||||
finalStep++;
|
||||
if ( finalStep == 8 )
|
||||
this.finalStep++;
|
||||
if ( this.finalStep == 8 )
|
||||
{
|
||||
|
||||
InscriberRecipe out = getTask();
|
||||
InscriberRecipe out = this.getTask();
|
||||
if ( out != null )
|
||||
{
|
||||
ItemStack is = out.output.copy();
|
||||
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( inv, 3, 1, true ), ForgeDirection.UNKNOWN );
|
||||
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this.inv, 3, 1, true ), ForgeDirection.UNKNOWN );
|
||||
|
||||
if ( ad.addItems( is ) == null )
|
||||
{
|
||||
processingTime = 0;
|
||||
this.processingTime = 0;
|
||||
if ( out.usePlates )
|
||||
{
|
||||
setInventorySlotContents( 0, null );
|
||||
setInventorySlotContents( 1, null );
|
||||
this.setInventorySlotContents( 0, null );
|
||||
this.setInventorySlotContents( 1, null );
|
||||
}
|
||||
setInventorySlotContents( 2, null );
|
||||
this.setInventorySlotContents( 2, null );
|
||||
}
|
||||
}
|
||||
|
||||
markDirty();
|
||||
this.markDirty();
|
||||
|
||||
}
|
||||
else if ( finalStep == 16 )
|
||||
else if ( this.finalStep == 16 )
|
||||
{
|
||||
finalStep = 0;
|
||||
smash = false;
|
||||
markForUpdate();
|
||||
this.finalStep = 0;
|
||||
this.smash = false;
|
||||
this.markForUpdate();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -387,14 +387,14 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
IEnergyGrid eg;
|
||||
try
|
||||
{
|
||||
eg = gridProxy.getEnergy();
|
||||
eg = this.gridProxy.getEnergy();
|
||||
IEnergySource src = this;
|
||||
|
||||
// Base 1, increase by 1 for each card
|
||||
int speedFactor = 1 + upgrades.getInstalledUpgrades( Upgrades.SPEED );
|
||||
int speedFactor = 1 + this.upgrades.getInstalledUpgrades( Upgrades.SPEED );
|
||||
int powerConsumption = 10 * speedFactor;
|
||||
double powerThreshold = powerConsumption - 0.01;
|
||||
double powerReq = extractAEPower( powerConsumption, Actionable.SIMULATE, PowerMultiplier.CONFIG );
|
||||
double powerReq = this.extractAEPower( powerConsumption, Actionable.SIMULATE, PowerMultiplier.CONFIG );
|
||||
|
||||
if ( powerReq <= powerThreshold )
|
||||
{
|
||||
@@ -406,10 +406,10 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
{
|
||||
src.extractAEPower( powerConsumption, Actionable.MODULATE, PowerMultiplier.CONFIG );
|
||||
|
||||
if ( processingTime == 0 )
|
||||
processingTime = processingTime + speedFactor;
|
||||
if ( this.processingTime == 0 )
|
||||
this.processingTime = this.processingTime + speedFactor;
|
||||
else
|
||||
processingTime += TicksSinceLastCall * speedFactor;
|
||||
this.processingTime += TicksSinceLastCall * speedFactor;
|
||||
}
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
@@ -417,41 +417,41 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
// :P
|
||||
}
|
||||
|
||||
if ( processingTime > maxProcessingTime )
|
||||
if ( this.processingTime > this.maxProcessingTime )
|
||||
{
|
||||
processingTime = maxProcessingTime;
|
||||
InscriberRecipe out = getTask();
|
||||
this.processingTime = this.maxProcessingTime;
|
||||
InscriberRecipe out = this.getTask();
|
||||
if ( out != null )
|
||||
{
|
||||
ItemStack is = out.output.copy();
|
||||
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( inv, 3, 1, true ), ForgeDirection.UNKNOWN );
|
||||
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this.inv, 3, 1, true ), ForgeDirection.UNKNOWN );
|
||||
if ( ad.simulateAdd( is ) == null )
|
||||
{
|
||||
smash = true;
|
||||
finalStep = 0;
|
||||
markForUpdate();
|
||||
this.smash = true;
|
||||
this.finalStep = 0;
|
||||
this.markForUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hasWork() ? TickRateModulation.URGENT : TickRateModulation.SLEEP;
|
||||
return this.hasWork() ? TickRateModulation.URGENT : TickRateModulation.SLEEP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConfigManager getConfigManager()
|
||||
{
|
||||
return settings;
|
||||
return this.settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName(String name)
|
||||
{
|
||||
if ( name.equals( "inv" ) )
|
||||
return inv;
|
||||
return this.inv;
|
||||
|
||||
if ( name.equals( "upgrades" ) )
|
||||
return upgrades;
|
||||
return this.upgrades;
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -459,7 +459,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
@Override
|
||||
public int getInstalledUpgrades(Upgrades u)
|
||||
{
|
||||
return upgrades.getInstalledUpgrades( u );
|
||||
return this.upgrades.getInstalledUpgrades( u );
|
||||
}
|
||||
|
||||
protected int getUpgradeSlots()
|
||||
@@ -472,9 +472,9 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
{
|
||||
super.getDrops( w, x, y, z, drops );
|
||||
|
||||
for (int h = 0; h < upgrades.getSizeInventory(); h++)
|
||||
for (int h = 0; h < this.upgrades.getSizeInventory(); h++)
|
||||
{
|
||||
ItemStack is = upgrades.getStackInSlot( h );
|
||||
ItemStack is = this.upgrades.getStackInSlot( h );
|
||||
if ( is != null )
|
||||
drops.add( is );
|
||||
}
|
||||
|
||||
@@ -66,18 +66,18 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
|
||||
{
|
||||
|
||||
ForgeDirection pointAt = ForgeDirection.UNKNOWN;
|
||||
final DualityInterface duality = new DualityInterface( gridProxy, this );
|
||||
final DualityInterface duality = new DualityInterface( this.gridProxy, this );
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void stateChange(MENetworkChannelsChanged c)
|
||||
{
|
||||
duality.notifyNeighbors();
|
||||
this.duality.notifyNeighbors();
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void stateChange(MENetworkPowerStatusChange c)
|
||||
{
|
||||
duality.notifyNeighbors();
|
||||
this.duality.notifyNeighbors();
|
||||
}
|
||||
|
||||
public void setSide(ForgeDirection axis)
|
||||
@@ -85,42 +85,42 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
|
||||
if ( Platform.isClient() )
|
||||
return;
|
||||
|
||||
if ( pointAt == axis.getOpposite() )
|
||||
pointAt = axis;
|
||||
else if ( pointAt == axis || pointAt == axis.getOpposite() )
|
||||
pointAt = ForgeDirection.UNKNOWN;
|
||||
else if ( pointAt == ForgeDirection.UNKNOWN )
|
||||
pointAt = axis.getOpposite();
|
||||
if ( this.pointAt == axis.getOpposite() )
|
||||
this.pointAt = axis;
|
||||
else if ( this.pointAt == axis || this.pointAt == axis.getOpposite() )
|
||||
this.pointAt = ForgeDirection.UNKNOWN;
|
||||
else if ( this.pointAt == ForgeDirection.UNKNOWN )
|
||||
this.pointAt = axis.getOpposite();
|
||||
else
|
||||
pointAt = Platform.rotateAround( pointAt, axis );
|
||||
this.pointAt = Platform.rotateAround( this.pointAt, axis );
|
||||
|
||||
if ( ForgeDirection.UNKNOWN == pointAt )
|
||||
setOrientation( pointAt, pointAt );
|
||||
if ( ForgeDirection.UNKNOWN == this.pointAt )
|
||||
this.setOrientation( this.pointAt, this.pointAt );
|
||||
else
|
||||
setOrientation( pointAt.offsetY != 0 ? ForgeDirection.SOUTH : ForgeDirection.UP, pointAt.getOpposite() );
|
||||
this.setOrientation( this.pointAt.offsetY != 0 ? ForgeDirection.SOUTH : ForgeDirection.UP, this.pointAt.getOpposite() );
|
||||
|
||||
gridProxy.setValidSides( EnumSet.complementOf( EnumSet.of( pointAt ) ) );
|
||||
markForUpdate();
|
||||
markDirty();
|
||||
this.gridProxy.setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt ) ) );
|
||||
this.markForUpdate();
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(World w, int x, int y, int z, ArrayList<ItemStack> drops)
|
||||
{
|
||||
duality.addDrops( drops );
|
||||
this.duality.addDrops( drops );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gridChanged()
|
||||
{
|
||||
duality.gridChanged();
|
||||
this.duality.gridChanged();
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public void writeToNBT_TileInterface(NBTTagCompound data)
|
||||
{
|
||||
data.setInteger( "pointAt", pointAt.ordinal() );
|
||||
duality.writeToNBT( data );
|
||||
data.setInteger( "pointAt", this.pointAt.ordinal() );
|
||||
this.duality.writeToNBT( data );
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
@@ -129,31 +129,31 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
|
||||
int val = data.getInteger( "pointAt" );
|
||||
|
||||
if ( val >= 0 && val < ForgeDirection.values().length )
|
||||
pointAt = ForgeDirection.values()[val];
|
||||
this.pointAt = ForgeDirection.values()[val];
|
||||
else
|
||||
pointAt = ForgeDirection.UNKNOWN;
|
||||
this.pointAt = ForgeDirection.UNKNOWN;
|
||||
|
||||
duality.readFromNBT( data );
|
||||
this.duality.readFromNBT( data );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReady()
|
||||
{
|
||||
gridProxy.setValidSides( EnumSet.complementOf( EnumSet.of( pointAt ) ) );
|
||||
this.gridProxy.setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt ) ) );
|
||||
super.onReady();
|
||||
duality.initialize();
|
||||
this.duality.initialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType(ForgeDirection dir)
|
||||
{
|
||||
return duality.getCableConnectionType( dir );
|
||||
return this.duality.getCableConnectionType( dir );
|
||||
}
|
||||
|
||||
@Override
|
||||
public DimensionalCoord getLocation()
|
||||
{
|
||||
return duality.getLocation();
|
||||
return this.duality.getLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -165,140 +165,140 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
|
||||
@Override
|
||||
public boolean canInsert(ItemStack stack)
|
||||
{
|
||||
return duality.canInsert( stack );
|
||||
return this.duality.canInsert( stack );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
{
|
||||
return duality.getItemInventory();
|
||||
return this.duality.getItemInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
{
|
||||
return duality.getFluidInventory();
|
||||
return this.duality.getFluidInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName(String name)
|
||||
{
|
||||
return duality.getInventoryByName( name );
|
||||
return this.duality.getInventoryByName( name );
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(IGridNode node)
|
||||
{
|
||||
return duality.getTickingRequest( node );
|
||||
return this.duality.getTickingRequest( node );
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
|
||||
{
|
||||
return duality.tickingRequest( node, TicksSinceLastCall );
|
||||
return this.duality.tickingRequest( node, TicksSinceLastCall );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInternalInventory()
|
||||
{
|
||||
return duality.getInternalInventory();
|
||||
return this.duality.getInternalInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
{
|
||||
duality.markDirty();
|
||||
this.duality.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added)
|
||||
{
|
||||
duality.onChangeInventory( inv, slot, mc, removed, added );
|
||||
this.duality.onChangeInventory( inv, slot, mc, removed, added );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide(ForgeDirection side)
|
||||
{
|
||||
return duality.getAccessibleSlotsFromSide( side.ordinal() );
|
||||
return this.duality.getAccessibleSlotsFromSide( side.ordinal() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public DualityInterface getInterfaceDuality()
|
||||
{
|
||||
return duality;
|
||||
return this.duality;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStorageMonitorable getMonitorable(ForgeDirection side, BaseActionSource src)
|
||||
{
|
||||
return duality.getMonitorable( side, src, this );
|
||||
return this.duality.getMonitorable( side, src, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConfigManager getConfigManager()
|
||||
{
|
||||
return duality.getConfigManager();
|
||||
return this.duality.getConfigManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pushPattern(ICraftingPatternDetails patternDetails, InventoryCrafting table)
|
||||
{
|
||||
return duality.pushPattern( patternDetails, table );
|
||||
return this.duality.pushPattern( patternDetails, table );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideCrafting(ICraftingProviderHelper craftingTracker)
|
||||
{
|
||||
duality.provideCrafting( craftingTracker );
|
||||
this.duality.provideCrafting( craftingTracker );
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<ForgeDirection> getTargets()
|
||||
{
|
||||
if ( pointAt == null || pointAt == ForgeDirection.UNKNOWN )
|
||||
if ( this.pointAt == null || this.pointAt == ForgeDirection.UNKNOWN )
|
||||
return EnumSet.complementOf( EnumSet.of( ForgeDirection.UNKNOWN ) );
|
||||
return EnumSet.of( pointAt );
|
||||
return EnumSet.of( this.pointAt );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBusy()
|
||||
{
|
||||
return duality.isBusy();
|
||||
return this.duality.isBusy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInstalledUpgrades(Upgrades u)
|
||||
{
|
||||
return duality.getInstalledUpgrades( u );
|
||||
return this.duality.getInstalledUpgrades( u );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<ICraftingLink> getRequestedJobs()
|
||||
{
|
||||
return duality.getRequestedJobs();
|
||||
return this.duality.getRequestedJobs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack items, Actionable mode)
|
||||
{
|
||||
return duality.injectCraftedItems( link, items, mode );
|
||||
return this.duality.injectCraftedItems( link, items, mode );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jobStateChange(ICraftingLink link)
|
||||
{
|
||||
duality.jobStateChange( link );
|
||||
this.duality.jobStateChange( link );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority()
|
||||
{
|
||||
return duality.getPriority();
|
||||
return this.duality.getPriority();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPriority(int newValue)
|
||||
{
|
||||
duality.setPriority( newValue );
|
||||
this.duality.setPriority( newValue );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,28 +31,28 @@ public class TileLightDetector extends AEBaseTile
|
||||
|
||||
public boolean isReady()
|
||||
{
|
||||
return lastLight > 0;
|
||||
return this.lastLight > 0;
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.TICK)
|
||||
public void Tick_TileLightDetector()
|
||||
{
|
||||
lastCheck++;
|
||||
if ( lastCheck > 30 )
|
||||
this.lastCheck++;
|
||||
if ( this.lastCheck > 30 )
|
||||
{
|
||||
lastCheck = 0;
|
||||
updateLight();
|
||||
this.lastCheck = 0;
|
||||
this.updateLight();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateLight()
|
||||
{
|
||||
int val = worldObj.getBlockLightValue( xCoord, yCoord, zCoord );
|
||||
int val = this.worldObj.getBlockLightValue( this.xCoord, this.yCoord, this.zCoord );
|
||||
|
||||
if ( lastLight != val )
|
||||
if ( this.lastLight != val )
|
||||
{
|
||||
lastLight = val;
|
||||
Platform.notifyBlocksOfNeighbors( worldObj, xCoord, yCoord, zCoord );
|
||||
this.lastLight = val;
|
||||
Platform.notifyBlocksOfNeighbors( this.worldObj, this.xCoord, this.yCoord, this.zCoord );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,15 +51,15 @@ public class TilePaint extends AEBaseTile
|
||||
|
||||
void writeBuffer(ByteBuf out)
|
||||
{
|
||||
if ( dots == null )
|
||||
if ( this.dots == null )
|
||||
{
|
||||
out.writeByte( 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
out.writeByte( dots.size() );
|
||||
out.writeByte( this.dots.size() );
|
||||
|
||||
for (Splotch s : dots)
|
||||
for (Splotch s : this.dots)
|
||||
s.writeToStream( out );
|
||||
}
|
||||
|
||||
@@ -69,32 +69,32 @@ public class TilePaint extends AEBaseTile
|
||||
|
||||
if ( howMany == 0 )
|
||||
{
|
||||
isLit = 0;
|
||||
dots = null;
|
||||
this.isLit = 0;
|
||||
this.dots = null;
|
||||
return;
|
||||
}
|
||||
|
||||
dots = new ArrayList( howMany );
|
||||
this.dots = new ArrayList( howMany );
|
||||
for (int x = 0; x < howMany; x++)
|
||||
dots.add( new Splotch( in ) );
|
||||
this.dots.add( new Splotch( in ) );
|
||||
|
||||
isLit = 0;
|
||||
for (Splotch s : dots)
|
||||
this.isLit = 0;
|
||||
for (Splotch s : this.dots)
|
||||
{
|
||||
if ( s.lumen )
|
||||
{
|
||||
isLit += LIGHT_PER_DOT;
|
||||
this.isLit += LIGHT_PER_DOT;
|
||||
}
|
||||
}
|
||||
|
||||
maxLit();
|
||||
this.maxLit();
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public void writeToNBT_TilePaint(NBTTagCompound data)
|
||||
{
|
||||
ByteBuf myDat = Unpooled.buffer();
|
||||
writeBuffer( myDat );
|
||||
this.writeBuffer( myDat );
|
||||
if ( myDat.hasArray() )
|
||||
data.setByteArray( "dots", myDat.array() );
|
||||
}
|
||||
@@ -103,75 +103,75 @@ public class TilePaint extends AEBaseTile
|
||||
public void readFromNBT_TilePaint(NBTTagCompound data)
|
||||
{
|
||||
if ( data.hasKey( "dots" ) )
|
||||
readBuffer( Unpooled.copiedBuffer( data.getByteArray( "dots" ) ) );
|
||||
this.readBuffer( Unpooled.copiedBuffer( data.getByteArray( "dots" ) ) );
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_WRITE)
|
||||
public void writeToStream_TilePaint(ByteBuf data)
|
||||
{
|
||||
writeBuffer( data );
|
||||
this.writeBuffer( data );
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_READ)
|
||||
public boolean readFromStream_TilePaint(ByteBuf data)
|
||||
{
|
||||
readBuffer( data );
|
||||
this.readBuffer( data );
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange()
|
||||
{
|
||||
if ( dots == null )
|
||||
if ( this.dots == null )
|
||||
return;
|
||||
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
if ( !isSideValid( side ) )
|
||||
removeSide( side );
|
||||
if ( !this.isSideValid( side ) )
|
||||
this.removeSide( side );
|
||||
}
|
||||
|
||||
updateData();
|
||||
this.updateData();
|
||||
}
|
||||
|
||||
private void updateData()
|
||||
{
|
||||
isLit = 0;
|
||||
for (Splotch s : dots)
|
||||
this.isLit = 0;
|
||||
for (Splotch s : this.dots)
|
||||
{
|
||||
if ( s.lumen )
|
||||
{
|
||||
isLit += LIGHT_PER_DOT;
|
||||
this.isLit += LIGHT_PER_DOT;
|
||||
}
|
||||
}
|
||||
|
||||
maxLit();
|
||||
this.maxLit();
|
||||
|
||||
if ( dots.isEmpty() )
|
||||
dots = null;
|
||||
if ( this.dots.isEmpty() )
|
||||
this.dots = null;
|
||||
|
||||
if ( dots == null )
|
||||
worldObj.setBlock( xCoord, yCoord, zCoord, Blocks.air );
|
||||
if ( this.dots == null )
|
||||
this.worldObj.setBlock( this.xCoord, this.yCoord, this.zCoord, Blocks.air );
|
||||
}
|
||||
|
||||
public void cleanSide(ForgeDirection side)
|
||||
{
|
||||
if ( dots == null )
|
||||
if ( this.dots == null )
|
||||
return;
|
||||
|
||||
removeSide( side );
|
||||
this.removeSide( side );
|
||||
|
||||
updateData();
|
||||
this.updateData();
|
||||
}
|
||||
|
||||
public boolean isSideValid(ForgeDirection side)
|
||||
{
|
||||
Block blk = worldObj.getBlock( xCoord + side.offsetX, yCoord + side.offsetY, zCoord + side.offsetZ );
|
||||
return blk.isSideSolid( worldObj, xCoord + side.offsetX, yCoord + side.offsetY, zCoord + side.offsetZ, side.getOpposite() );
|
||||
Block blk = this.worldObj.getBlock( this.xCoord + side.offsetX, this.yCoord + side.offsetY, this.zCoord + side.offsetZ );
|
||||
return blk.isSideSolid( this.worldObj, this.xCoord + side.offsetX, this.yCoord + side.offsetY, this.zCoord + side.offsetZ, side.getOpposite() );
|
||||
}
|
||||
|
||||
private void removeSide(ForgeDirection side)
|
||||
{
|
||||
Iterator<Splotch> i = dots.iterator();
|
||||
Iterator<Splotch> i = this.dots.iterator();
|
||||
while (i.hasNext())
|
||||
{
|
||||
Splotch s = i.next();
|
||||
@@ -179,55 +179,55 @@ public class TilePaint extends AEBaseTile
|
||||
i.remove();
|
||||
}
|
||||
|
||||
markForUpdate();
|
||||
markDirty();
|
||||
this.markForUpdate();
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
public int getLightLevel()
|
||||
{
|
||||
return isLit;
|
||||
return this.isLit;
|
||||
}
|
||||
|
||||
public void addBlot(ItemStack type, ForgeDirection side, Vec3 hitVec)
|
||||
{
|
||||
Block blk = worldObj.getBlock( xCoord + side.offsetX, yCoord + side.offsetY, zCoord + side.offsetZ );
|
||||
if ( blk.isSideSolid( worldObj, xCoord + side.offsetX, yCoord + side.offsetY, zCoord + side.offsetZ, side.getOpposite() ) )
|
||||
Block blk = this.worldObj.getBlock( this.xCoord + side.offsetX, this.yCoord + side.offsetY, this.zCoord + side.offsetZ );
|
||||
if ( blk.isSideSolid( this.worldObj, this.xCoord + side.offsetX, this.yCoord + side.offsetY, this.zCoord + side.offsetZ, side.getOpposite() ) )
|
||||
{
|
||||
ItemPaintBall ipb = (ItemPaintBall) type.getItem();
|
||||
|
||||
AEColor col = ipb.getColor( type );
|
||||
boolean lit = ipb.isLumen( type );
|
||||
|
||||
if ( dots == null )
|
||||
dots = new ArrayList<Splotch>();
|
||||
if ( this.dots == null )
|
||||
this.dots = new ArrayList<Splotch>();
|
||||
|
||||
if ( dots.size() > 20 )
|
||||
dots.remove( 0 );
|
||||
if ( this.dots.size() > 20 )
|
||||
this.dots.remove( 0 );
|
||||
|
||||
dots.add( new Splotch( col, lit, side, hitVec ) );
|
||||
this.dots.add( new Splotch( col, lit, side, hitVec ) );
|
||||
if ( lit )
|
||||
isLit += LIGHT_PER_DOT;
|
||||
this.isLit += LIGHT_PER_DOT;
|
||||
|
||||
maxLit();
|
||||
markForUpdate();
|
||||
markDirty();
|
||||
this.maxLit();
|
||||
this.markForUpdate();
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
private void maxLit()
|
||||
{
|
||||
if ( isLit > 14 )
|
||||
isLit = 14;
|
||||
if ( this.isLit > 14 )
|
||||
this.isLit = 14;
|
||||
|
||||
if ( worldObj != null )
|
||||
worldObj.updateLightByType( EnumSkyBlock.Block, xCoord, yCoord, zCoord );
|
||||
if ( this.worldObj != null )
|
||||
this.worldObj.updateLightByType( EnumSkyBlock.Block, this.xCoord, this.yCoord, this.zCoord );
|
||||
}
|
||||
|
||||
public Collection<Splotch> getDots()
|
||||
{
|
||||
if ( dots == null )
|
||||
if ( this.dots == null )
|
||||
return ImmutableList.of();
|
||||
|
||||
return dots;
|
||||
return this.dots;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
|
||||
@MENetworkEventSubscribe
|
||||
public void onPower(MENetworkPowerStatusChange ch)
|
||||
{
|
||||
markForUpdate();
|
||||
this.markForUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -54,9 +54,9 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
|
||||
@TileEvent(TileEventType.NETWORK_READ)
|
||||
public boolean readFromStream_TileQuartzGrowthAccelerator(ByteBuf data)
|
||||
{
|
||||
boolean hadPower = hasPower;
|
||||
hasPower = data.readBoolean();
|
||||
return hasPower != hadPower;
|
||||
boolean hadPower = this.hasPower;
|
||||
this.hasPower = data.readBoolean();
|
||||
return this.hasPower != hadPower;
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_WRITE)
|
||||
@@ -64,7 +64,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
|
||||
{
|
||||
try
|
||||
{
|
||||
data.writeBoolean( gridProxy.getEnergy().isNetworkPowered() );
|
||||
data.writeBoolean( this.gridProxy.getEnergy().isNetworkPowered() );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -73,16 +73,16 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
|
||||
}
|
||||
|
||||
public TileQuartzGrowthAccelerator() {
|
||||
gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||
gridProxy.setFlags();
|
||||
gridProxy.setIdlePowerUsage( 8 );
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||
this.gridProxy.setFlags();
|
||||
this.gridProxy.setIdlePowerUsage( 8 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation(ForgeDirection inForward, ForgeDirection inUp)
|
||||
{
|
||||
super.setOrientation( inForward, inUp );
|
||||
gridProxy.setValidSides( EnumSet.of( getUp(), getUp().getOpposite() ) );
|
||||
this.gridProxy.setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -92,7 +92,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
|
||||
{
|
||||
try
|
||||
{
|
||||
return gridProxy.getEnergy().isNetworkPowered();
|
||||
return this.gridProxy.getEnergy().isNetworkPowered();
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -100,13 +100,13 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
|
||||
}
|
||||
}
|
||||
|
||||
return hasPower;
|
||||
return this.hasPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive()
|
||||
{
|
||||
return isPowered();
|
||||
return this.isPowered();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
||||
private final IConfigManager cm = new ConfigManager( this );
|
||||
|
||||
private final SecurityInventory inventory = new SecurityInventory( this );
|
||||
private final MEMonitorHandler<IAEItemStack> securityMonitor = new MEMonitorHandler<IAEItemStack>( inventory );
|
||||
private final MEMonitorHandler<IAEItemStack> securityMonitor = new MEMonitorHandler<IAEItemStack>( this.inventory );
|
||||
|
||||
private boolean isActive = false;
|
||||
|
||||
@@ -102,16 +102,16 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
||||
@Override
|
||||
public void getDrops(World w, int x, int y, int z, ArrayList<ItemStack> drops)
|
||||
{
|
||||
if ( !configSlot.isEmpty() )
|
||||
drops.add( configSlot.getStackInSlot( 0 ) );
|
||||
if ( !this.configSlot.isEmpty() )
|
||||
drops.add( this.configSlot.getStackInSlot( 0 ) );
|
||||
|
||||
for (IAEItemStack ais : inventory.storedItems)
|
||||
for (IAEItemStack ais : this.inventory.storedItems)
|
||||
drops.add( ais.getItemStack() );
|
||||
}
|
||||
|
||||
IMEInventoryHandler<IAEItemStack> getSecurityInventory()
|
||||
{
|
||||
return inventory;
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -120,7 +120,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
||||
super.onReady();
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
isActive = true;
|
||||
this.isActive = true;
|
||||
MinecraftForge.EVENT_BUS.post( new LocatableEventAnnounce( this, LocatableEvent.Register ) );
|
||||
}
|
||||
}
|
||||
@@ -130,7 +130,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
||||
{
|
||||
super.onChunkUnload();
|
||||
MinecraftForge.EVENT_BUS.post( new LocatableEventAnnounce( this, LocatableEvent.Unregister ) );
|
||||
isActive = false;
|
||||
this.isActive = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -138,41 +138,41 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
||||
{
|
||||
super.invalidate();
|
||||
MinecraftForge.EVENT_BUS.post( new LocatableEventAnnounce( this, LocatableEvent.Unregister ) );
|
||||
isActive = false;
|
||||
this.isActive = false;
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_READ)
|
||||
public boolean readFromStream_TileSecurity(ByteBuf data)
|
||||
{
|
||||
boolean wasActive = isActive;
|
||||
isActive = data.readBoolean();
|
||||
boolean wasActive = this.isActive;
|
||||
this.isActive = data.readBoolean();
|
||||
|
||||
AEColor oldPaintedColor = paintedColor;
|
||||
paintedColor = AEColor.values()[data.readByte()];
|
||||
AEColor oldPaintedColor = this.paintedColor;
|
||||
this.paintedColor = AEColor.values()[data.readByte()];
|
||||
|
||||
return oldPaintedColor != paintedColor || wasActive != isActive;
|
||||
return oldPaintedColor != this.paintedColor || wasActive != this.isActive;
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_WRITE)
|
||||
public void writeToStream_TileSecurity(ByteBuf data)
|
||||
{
|
||||
data.writeBoolean( gridProxy.isActive() );
|
||||
data.writeByte( paintedColor.ordinal() );
|
||||
data.writeBoolean( this.gridProxy.isActive() );
|
||||
data.writeByte( this.paintedColor.ordinal() );
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public void writeToNBT_TileSecurity(NBTTagCompound data)
|
||||
{
|
||||
cm.writeToNBT( data );
|
||||
data.setByte( "paintedColor", (byte) paintedColor.ordinal() );
|
||||
this.cm.writeToNBT( data );
|
||||
data.setByte( "paintedColor", (byte) this.paintedColor.ordinal() );
|
||||
|
||||
data.setLong( "securityKey", securityKey );
|
||||
configSlot.writeToNBT( data, "config" );
|
||||
data.setLong( "securityKey", this.securityKey );
|
||||
this.configSlot.writeToNBT( data, "config" );
|
||||
|
||||
NBTTagCompound storedItems = new NBTTagCompound();
|
||||
|
||||
int offset = 0;
|
||||
for (IAEItemStack ais : inventory.storedItems)
|
||||
for (IAEItemStack ais : this.inventory.storedItems)
|
||||
{
|
||||
NBTTagCompound it = new NBTTagCompound();
|
||||
ais.getItemStack().writeToNBT( it );
|
||||
@@ -185,12 +185,12 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBT_TileSecurity(NBTTagCompound data)
|
||||
{
|
||||
cm.readFromNBT( data );
|
||||
this.cm.readFromNBT( data );
|
||||
if ( data.hasKey( "paintedColor" ) )
|
||||
paintedColor = AEColor.values()[data.getByte( "paintedColor" )];
|
||||
this.paintedColor = AEColor.values()[data.getByte( "paintedColor" )];
|
||||
|
||||
securityKey = data.getLong( "securityKey" );
|
||||
configSlot.readFromNBT( data, "config" );
|
||||
this.securityKey = data.getLong( "securityKey" );
|
||||
this.configSlot.readFromNBT( data, "config" );
|
||||
|
||||
NBTTagCompound storedItems = data.getCompoundTag( "storedItems" );
|
||||
for (Object key : storedItems.func_150296_c())
|
||||
@@ -198,7 +198,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
||||
NBTBase obj = storedItems.getTag( (String) key );
|
||||
if ( obj instanceof NBTTagCompound )
|
||||
{
|
||||
inventory.storedItems.add( AEItemStack.create( ItemStack.loadItemStackFromNBT( (NBTTagCompound) obj ) ) );
|
||||
this.inventory.storedItems.add( AEItemStack.create( ItemStack.loadItemStackFromNBT( (NBTTagCompound) obj ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,8 +207,8 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
||||
{
|
||||
try
|
||||
{
|
||||
saveChanges();
|
||||
gridProxy.getGrid().postEvent( new MENetworkSecurityChange() );
|
||||
this.saveChanges();
|
||||
this.gridProxy.getGrid().postEvent( new MENetworkSecurityChange() );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -222,7 +222,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
||||
IPlayerRegistry pr = AEApi.instance().registries().players();
|
||||
|
||||
// read permissions
|
||||
for (IAEItemStack ais : inventory.storedItems)
|
||||
for (IAEItemStack ais : this.inventory.storedItems)
|
||||
{
|
||||
ItemStack is = ais.getItemStack();
|
||||
Item i = is.getItem();
|
||||
@@ -234,45 +234,45 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
||||
}
|
||||
|
||||
// make sure thea admin is Boss.
|
||||
playerPerms.put( gridProxy.getNode().getPlayerID(), EnumSet.allOf( SecurityPermissions.class ) );
|
||||
playerPerms.put( this.gridProxy.getNode().getPlayerID(), EnumSet.allOf( SecurityPermissions.class ) );
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void bootUpdate(MENetworkChannelsChanged changed)
|
||||
{
|
||||
markForUpdate();
|
||||
this.markForUpdate();
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void powerUpdate(MENetworkPowerStatusChange changed)
|
||||
{
|
||||
markForUpdate();
|
||||
this.markForUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecurityEnabled()
|
||||
{
|
||||
return isActive && gridProxy.isActive();
|
||||
return this.isActive && this.gridProxy.isActive();
|
||||
}
|
||||
|
||||
public TileSecurity() {
|
||||
gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
|
||||
gridProxy.setIdlePowerUsage( 2.0 );
|
||||
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
|
||||
this.gridProxy.setIdlePowerUsage( 2.0 );
|
||||
difference++;
|
||||
|
||||
securityKey = System.currentTimeMillis() * 10 + difference;
|
||||
this.securityKey = System.currentTimeMillis() * 10 + difference;
|
||||
if ( difference > 10 )
|
||||
difference = 0;
|
||||
|
||||
cm.registerSetting( Settings.SORT_BY, SortOrder.NAME );
|
||||
cm.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
|
||||
cm.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
|
||||
this.cm.registerSetting( Settings.SORT_BY, SortOrder.NAME );
|
||||
this.cm.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
|
||||
this.cm.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOwner()
|
||||
{
|
||||
return gridProxy.getNode().getPlayerID();
|
||||
return this.gridProxy.getNode().getPlayerID();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -289,13 +289,13 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
||||
|
||||
public boolean isActive()
|
||||
{
|
||||
return isActive;
|
||||
return this.isActive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
{
|
||||
return securityMonitor;
|
||||
return this.securityMonitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -307,18 +307,18 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
||||
@Override
|
||||
public long getLocatableSerial()
|
||||
{
|
||||
return securityKey;
|
||||
return this.securityKey;
|
||||
}
|
||||
|
||||
public boolean isPowered()
|
||||
{
|
||||
return gridProxy.isActive();
|
||||
return this.gridProxy.isActive();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConfigManager getConfigManager()
|
||||
{
|
||||
return cm;
|
||||
return this.cm;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -330,24 +330,24 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
||||
@Override
|
||||
public long getSecurityKey()
|
||||
{
|
||||
return securityKey;
|
||||
return this.securityKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColor getColor()
|
||||
{
|
||||
return paintedColor;
|
||||
return this.paintedColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recolourBlock(ForgeDirection side, AEColor newPaintedColor, EntityPlayer who)
|
||||
{
|
||||
if ( paintedColor == newPaintedColor )
|
||||
if ( this.paintedColor == newPaintedColor )
|
||||
return false;
|
||||
|
||||
paintedColor = newPaintedColor;
|
||||
markDirty();
|
||||
markForUpdate();
|
||||
this.paintedColor = newPaintedColor;
|
||||
this.markDirty();
|
||||
this.markForUpdate();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,54 +65,54 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
|
||||
@TileEvent(TileEventType.NETWORK_READ)
|
||||
public boolean readFromStream_TileVibrationChamber(ByteBuf data)
|
||||
{
|
||||
boolean wasOn = isOn;
|
||||
isOn = data.readBoolean();
|
||||
return wasOn != isOn; // TESR doesn't need updates!
|
||||
boolean wasOn = this.isOn;
|
||||
this.isOn = data.readBoolean();
|
||||
return wasOn != this.isOn; // TESR doesn't need updates!
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_WRITE)
|
||||
public void writeToStream_TileVibrationChamber(ByteBuf data)
|
||||
{
|
||||
data.writeBoolean( burnTime > 0 );
|
||||
data.writeBoolean( this.burnTime > 0 );
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public void writeToNBT_TileVibrationChamber(NBTTagCompound data)
|
||||
{
|
||||
data.setDouble( "burnTime", burnTime );
|
||||
data.setDouble( "maxBurnTime", maxBurnTime );
|
||||
data.setInteger( "burnSpeed", burnSpeed );
|
||||
data.setDouble( "burnTime", this.burnTime );
|
||||
data.setDouble( "maxBurnTime", this.maxBurnTime );
|
||||
data.setInteger( "burnSpeed", this.burnSpeed );
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBT_TileVibrationChamber(NBTTagCompound data)
|
||||
{
|
||||
burnTime = data.getDouble( "burnTime" );
|
||||
maxBurnTime = data.getDouble( "maxBurnTime" );
|
||||
burnSpeed = data.getInteger( "burnSpeed" );
|
||||
this.burnTime = data.getDouble( "burnTime" );
|
||||
this.maxBurnTime = data.getDouble( "maxBurnTime" );
|
||||
this.burnSpeed = data.getInteger( "burnSpeed" );
|
||||
}
|
||||
|
||||
public TileVibrationChamber() {
|
||||
gridProxy.setIdlePowerUsage( 0 );
|
||||
gridProxy.setFlags();
|
||||
this.gridProxy.setIdlePowerUsage( 0 );
|
||||
this.gridProxy.setFlags();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInternalInventory()
|
||||
{
|
||||
return inv;
|
||||
return this.inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added)
|
||||
{
|
||||
if ( burnTime <= 0 )
|
||||
if ( this.burnTime <= 0 )
|
||||
{
|
||||
if ( canEatFuel() )
|
||||
if ( this.canEatFuel() )
|
||||
{
|
||||
try
|
||||
{
|
||||
gridProxy.getTick().wakeDevice( gridProxy.getNode() );
|
||||
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -125,7 +125,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide(ForgeDirection side)
|
||||
{
|
||||
return sides;
|
||||
return this.sides;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -155,65 +155,65 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(IGridNode node)
|
||||
{
|
||||
if ( burnTime <= 0 )
|
||||
eatFuel();
|
||||
if ( this.burnTime <= 0 )
|
||||
this.eatFuel();
|
||||
|
||||
return new TickingRequest( TickRates.VibrationChamber.min, TickRates.VibrationChamber.max, burnTime <= 0, false );
|
||||
return new TickingRequest( TickRates.VibrationChamber.min, TickRates.VibrationChamber.max, this.burnTime <= 0, false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
|
||||
{
|
||||
if ( burnTime <= 0 )
|
||||
if ( this.burnTime <= 0 )
|
||||
{
|
||||
eatFuel();
|
||||
this.eatFuel();
|
||||
|
||||
if ( burnTime > 0 )
|
||||
if ( this.burnTime > 0 )
|
||||
return TickRateModulation.URGENT;
|
||||
|
||||
burnSpeed = 100;
|
||||
this.burnSpeed = 100;
|
||||
return TickRateModulation.SLEEP;
|
||||
}
|
||||
|
||||
burnSpeed = Math.max( 20, Math.min( burnSpeed, 200 ) );
|
||||
double dilation = burnSpeed / 100.0;
|
||||
this.burnSpeed = Math.max( 20, Math.min( this.burnSpeed, 200 ) );
|
||||
double dilation = this.burnSpeed / 100.0;
|
||||
|
||||
double timePassed = TicksSinceLastCall * dilation;
|
||||
burnTime -= timePassed;
|
||||
if ( burnTime < 0 )
|
||||
this.burnTime -= timePassed;
|
||||
if ( this.burnTime < 0 )
|
||||
{
|
||||
timePassed += burnTime;
|
||||
burnTime = 0;
|
||||
timePassed += this.burnTime;
|
||||
this.burnTime = 0;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
IEnergyGrid grid = gridProxy.getEnergy();
|
||||
double newPower = timePassed * powerPerTick;
|
||||
IEnergyGrid grid = this.gridProxy.getEnergy();
|
||||
double newPower = timePassed * this.powerPerTick;
|
||||
double overFlow = grid.injectPower( newPower, Actionable.SIMULATE );
|
||||
|
||||
// burn the over flow.
|
||||
grid.injectPower( Math.max( 0.0, newPower - overFlow ), Actionable.MODULATE );
|
||||
|
||||
if ( overFlow > 0 )
|
||||
burnSpeed -= TicksSinceLastCall;
|
||||
this.burnSpeed -= TicksSinceLastCall;
|
||||
else
|
||||
burnSpeed += TicksSinceLastCall;
|
||||
this.burnSpeed += TicksSinceLastCall;
|
||||
|
||||
burnSpeed = Math.max( 20, Math.min( burnSpeed, 200 ) );
|
||||
this.burnSpeed = Math.max( 20, Math.min( this.burnSpeed, 200 ) );
|
||||
return overFlow > 0 ? TickRateModulation.SLOWER : TickRateModulation.FASTER;
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
burnSpeed -= TicksSinceLastCall;
|
||||
burnSpeed = Math.max( 20, Math.min( burnSpeed, 200 ) );
|
||||
this.burnSpeed -= TicksSinceLastCall;
|
||||
this.burnSpeed = Math.max( 20, Math.min( this.burnSpeed, 200 ) );
|
||||
return TickRateModulation.SLOWER;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canEatFuel()
|
||||
{
|
||||
ItemStack is = getStackInSlot( 0 );
|
||||
ItemStack is = this.getStackInSlot( 0 );
|
||||
if ( is != null )
|
||||
{
|
||||
int newBurnTime = TileEntityFurnace.getItemBurnTime( is );
|
||||
@@ -225,14 +225,14 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
|
||||
|
||||
private void eatFuel()
|
||||
{
|
||||
ItemStack is = getStackInSlot( 0 );
|
||||
ItemStack is = this.getStackInSlot( 0 );
|
||||
if ( is != null )
|
||||
{
|
||||
int newBurnTime = TileEntityFurnace.getItemBurnTime( is );
|
||||
if ( newBurnTime > 0 && is.stackSize > 0 )
|
||||
{
|
||||
burnTime += newBurnTime;
|
||||
maxBurnTime = burnTime;
|
||||
this.burnTime += newBurnTime;
|
||||
this.maxBurnTime = this.burnTime;
|
||||
is.stackSize--;
|
||||
if ( is.stackSize <= 0 )
|
||||
{
|
||||
@@ -241,18 +241,18 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
|
||||
if ( is.getItem().hasContainerItem( is ) )
|
||||
container = is.getItem().getContainerItem( is );
|
||||
|
||||
setInventorySlotContents( 0, container );
|
||||
this.setInventorySlotContents( 0, container );
|
||||
}
|
||||
else
|
||||
setInventorySlotContents( 0, is );
|
||||
this.setInventorySlotContents( 0, is );
|
||||
}
|
||||
}
|
||||
|
||||
if ( burnTime > 0 )
|
||||
if ( this.burnTime > 0 )
|
||||
{
|
||||
try
|
||||
{
|
||||
gridProxy.getTick().wakeDevice( gridProxy.getNode() );
|
||||
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -260,10 +260,10 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
|
||||
}
|
||||
}
|
||||
|
||||
if ( (!isOn && burnTime > 0) || (isOn && burnTime <= 0) )
|
||||
if ( (!this.isOn && this.burnTime > 0) || (this.isOn && this.burnTime <= 0) )
|
||||
{
|
||||
isOn = burnTime > 0;
|
||||
markForUpdate();
|
||||
this.isOn = this.burnTime > 0;
|
||||
this.markForUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user