Changed access to use this qualifier

This commit is contained in:
yueh
2014-12-29 15:13:47 +01:00
parent 2a5e57a59b
commit f471513bd0
604 changed files with 11573 additions and 11573 deletions
+13 -13
View File
@@ -36,7 +36,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
@TileEvent(TileEventType.WORLD_NBT_READ)
public void readFromNBT_AEBaseInvTile(net.minecraft.nbt.NBTTagCompound data)
{
IInventory inv = getInternalInventory();
IInventory inv = this.getInternalInventory();
NBTTagCompound opt = data.getCompoundTag( "inv" );
for (int x = 0; x < inv.getSizeInventory(); x++)
{
@@ -48,12 +48,12 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
@TileEvent(TileEventType.WORLD_NBT_WRITE)
public void writeToNBT_AEBaseInvTile(net.minecraft.nbt.NBTTagCompound data)
{
IInventory inv = getInternalInventory();
IInventory inv = this.getInternalInventory();
NBTTagCompound opt = new NBTTagCompound();
for (int x = 0; x < inv.getSizeInventory(); x++)
{
NBTTagCompound item = new NBTTagCompound();
ItemStack is = getStackInSlot( x );
ItemStack is = this.getStackInSlot( x );
if ( is != null )
is.writeToNBT( item );
opt.setTag( "item" + x, item );
@@ -64,19 +64,19 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
@Override
public int getSizeInventory()
{
return getInternalInventory().getSizeInventory();
return this.getInternalInventory().getSizeInventory();
}
@Override
public ItemStack getStackInSlot(int i)
{
return getInternalInventory().getStackInSlot( i );
return this.getInternalInventory().getStackInSlot( i );
}
@Override
public ItemStack decrStackSize(int i, int j)
{
return getInternalInventory().decrStackSize( i, j );
return this.getInternalInventory().decrStackSize( i, j );
}
@Override
@@ -88,7 +88,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
@Override
public void setInventorySlotContents(int i, ItemStack itemstack)
{
getInternalInventory().setInventorySlotContents( i, itemstack );
this.getInternalInventory().setInventorySlotContents( i, itemstack );
}
@Override
@@ -123,7 +123,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
@Override
public boolean canInsertItem(int i, ItemStack itemstack, int j)
{
return isItemValidForSlot( i, itemstack );
return this.isItemValidForSlot( i, itemstack );
}
@Override
@@ -142,13 +142,13 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
@Override
final public int[] getAccessibleSlotsFromSide(int side)
{
Block blk = worldObj.getBlock( xCoord, yCoord, zCoord );
Block blk = this.worldObj.getBlock( this.xCoord, this.yCoord, this.zCoord );
if ( blk instanceof AEBaseBlock )
{
ForgeDirection mySide = ForgeDirection.getOrientation( side );
return getAccessibleSlotsBySide( ((AEBaseBlock) blk).mapRotation( this, mySide ) );
return this.getAccessibleSlotsBySide( ((AEBaseBlock) blk).mapRotation( this, mySide ) );
}
return getAccessibleSlotsBySide( ForgeDirection.getOrientation( side ) );
return this.getAccessibleSlotsBySide( ForgeDirection.getOrientation( side ) );
}
/**
@@ -157,7 +157,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
@Override
public String getInventoryName()
{
return getCustomName();
return this.getCustomName();
}
/**
@@ -166,7 +166,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
@Override
public boolean hasCustomInventoryName()
{
return hasCustomName();
return this.hasCustomName();
}
}
+57 -57
View File
@@ -81,7 +81,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
public boolean notLoaded()
{
return !worldObj.blockExists( xCoord, yCoord, zCoord );
return !this.worldObj.blockExists( this.xCoord, this.yCoord, this.zCoord );
}
public TileEntity getTile()
@@ -104,13 +104,13 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
protected boolean hasHandlerFor(TileEventType type)
{
List<AETileEventHandler> list = getHandlerListFor( type );
List<AETileEventHandler> list = this.getHandlerListFor( type );
return list != null && !list.isEmpty();
}
protected List<AETileEventHandler> getHandlerListFor(TileEventType type)
{
Class clz = getClass();
Class clz = this.getClass();
EnumMap<TileEventType, List<AETileEventHandler>> handlerSet = handlers.get( clz );
if ( handlerSet == null )
@@ -122,7 +122,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
TileEvent te = m.getAnnotation( TileEvent.class );
if ( te != null )
{
addHandler( handlerSet, te.value(), m );
this.addHandler( handlerSet, te.value(), m );
}
}
}
@@ -148,7 +148,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
@Override
final public boolean canUpdate()
{
return hasHandlerFor( TileEventType.TICK );
return this.hasHandlerFor( TileEventType.TICK );
}
final public void Tick()
@@ -159,15 +159,15 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
@Override
final public void updateEntity()
{
for (AETileEventHandler h : getHandlerListFor( TileEventType.TICK ))
for (AETileEventHandler h : this.getHandlerListFor( TileEventType.TICK ))
h.Tick( this );
}
@Override
public void onChunkUnload()
{
if ( !isInvalid() )
invalidate();
if ( !this.isInvalid() )
this.invalidate();
}
/**
@@ -175,8 +175,8 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
*/
public void onChunkLoad()
{
if ( isInvalid() )
validate();
if ( this.isInvalid() )
this.validate();
}
@Override
@@ -185,16 +185,16 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
{
super.writeToNBT( data );
if ( canBeRotated() )
if ( this.canBeRotated() )
{
data.setString( "orientation_forward", forward.name() );
data.setString( "orientation_up", up.name() );
data.setString( "orientation_forward", this.forward.name() );
data.setString( "orientation_up", this.up.name() );
}
if ( customName != null )
data.setString( "customName", customName );
if ( this.customName != null )
data.setString( "customName", this.customName );
for (AETileEventHandler h : getHandlerListFor( TileEventType.WORLD_NBT_WRITE ))
for (AETileEventHandler h : this.getHandlerListFor( TileEventType.WORLD_NBT_WRITE ))
h.writeToNBT( this, data );
}
@@ -205,23 +205,23 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
super.readFromNBT( data );
if ( data.hasKey( "customName" ) )
customName = data.getString( "customName" );
this.customName = data.getString( "customName" );
else
customName = null;
this.customName = null;
try
{
if ( canBeRotated() )
if ( this.canBeRotated() )
{
forward = ForgeDirection.valueOf( data.getString( "orientation_forward" ) );
up = ForgeDirection.valueOf( data.getString( "orientation_up" ) );
this.forward = ForgeDirection.valueOf( data.getString( "orientation_forward" ) );
this.up = ForgeDirection.valueOf( data.getString( "orientation_up" ) );
}
}
catch (IllegalArgumentException ignored)
{
}
for (AETileEventHandler h : getHandlerListFor( TileEventType.WORLD_NBT_READ ))
for (AETileEventHandler h : this.getHandlerListFor( TileEventType.WORLD_NBT_READ ))
{
h.readFromNBT( this, data );
}
@@ -231,13 +231,13 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
{
try
{
if ( canBeRotated() )
if ( this.canBeRotated() )
{
byte orientation = (byte) ((up.ordinal() << 3) | forward.ordinal());
byte orientation = (byte) ((this.up.ordinal() << 3) | this.forward.ordinal());
data.writeByte( orientation );
}
for (AETileEventHandler h : getHandlerListFor( TileEventType.NETWORK_WRITE ))
for (AETileEventHandler h : this.getHandlerListFor( TileEventType.NETWORK_WRITE ))
h.writeToStream( this, data );
}
catch (Throwable t)
@@ -253,26 +253,26 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
try
{
if ( canBeRotated() )
if ( this.canBeRotated() )
{
ForgeDirection old_Forward = forward;
ForgeDirection old_Up = up;
ForgeDirection old_Forward = this.forward;
ForgeDirection old_Up = this.up;
byte orientation = data.readByte();
forward = ForgeDirection.getOrientation( orientation & 0x7 );
up = ForgeDirection.getOrientation( orientation >> 3 );
this.forward = ForgeDirection.getOrientation( orientation & 0x7 );
this.up = ForgeDirection.getOrientation( orientation >> 3 );
output = !forward.equals( old_Forward ) || !up.equals( old_Up );
output = !this.forward.equals( old_Forward ) || !this.up.equals( old_Up );
}
renderFragment = 100;
for (AETileEventHandler h : getHandlerListFor( TileEventType.NETWORK_READ ))
this.renderFragment = 100;
for (AETileEventHandler h : this.getHandlerListFor( TileEventType.NETWORK_READ ))
if ( h.readFromStream( this, data ) )
output = true;
if ( (renderFragment & 1) == 1 )
if ( (this.renderFragment & 1) == 1 )
output = true;
renderFragment = 0;
this.renderFragment = 0;
}
catch (Throwable t)
{
@@ -296,29 +296,29 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
@Override
public ForgeDirection getForward()
{
return forward;
return this.forward;
}
@Override
public ForgeDirection getUp()
{
return up;
return this.up;
}
@Override
public void setOrientation(ForgeDirection inForward, ForgeDirection inUp)
{
forward = inForward;
up = inUp;
markForUpdate();
Platform.notifyBlocksOfNeighbors( worldObj, xCoord, yCoord, zCoord );
this.forward = inForward;
this.up = inUp;
this.markForUpdate();
Platform.notifyBlocksOfNeighbors( this.worldObj, this.xCoord, this.yCoord, this.zCoord );
}
public void onPlacement(ItemStack stack, EntityPlayer player, int side)
{
if ( stack.hasTagCompound() )
{
uploadSettings( SettingsFrom.DISMANTLE_ITEM, stack.getTagCompound() );
this.uploadSettings( SettingsFrom.DISMANTLE_ITEM, stack.getTagCompound() );
}
}
@@ -331,7 +331,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
try
{
writeToStream( stream );
this.writeToStream( stream );
if ( stream.readableBytes() == 0 )
return null;
}
@@ -342,7 +342,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
stream.capacity( stream.readableBytes() );
data.setByteArray( "X", stream.array() );
return new S35PacketUpdateTileEntity( xCoord, yCoord, zCoord, 64, data );
return new S35PacketUpdateTileEntity( this.xCoord, this.yCoord, this.zCoord, 64, data );
}
@Override
@@ -352,22 +352,22 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
if ( pkt.func_148853_f() == 64 )
{
ByteBuf stream = Unpooled.copiedBuffer( pkt.func_148857_g().getByteArray( "X" ) );
if ( readFromStream( stream ) )
markForUpdate();
if ( this.readFromStream( stream ) )
this.markForUpdate();
}
}
public void markForUpdate()
{
if ( renderFragment > 0 )
renderFragment = renderFragment | 1;
if ( this.renderFragment > 0 )
this.renderFragment = this.renderFragment | 1;
else
{
// TODO: Optimize Network Load
if ( worldObj != null )
if ( this.worldObj != null )
{
AELog.blockUpdate( xCoord, yCoord, zCoord, this );
worldObj.markBlockForUpdate( xCoord, yCoord, zCoord );
AELog.blockUpdate( this.xCoord, this.yCoord, this.zCoord, this );
this.worldObj.markBlockForUpdate( this.xCoord, this.yCoord, this.zCoord );
}
}
}
@@ -453,10 +453,10 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
{
NBTTagCompound output = new NBTTagCompound();
if ( hasCustomName() )
if ( this.hasCustomName() )
{
NBTTagCompound dsp = new NBTTagCompound();
dsp.setString( "Name", getCustomName() );
dsp.setString( "Name", this.getCustomName() );
output.setTag( "display", dsp );
}
@@ -487,8 +487,8 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
public void securityBreak()
{
worldObj.func_147480_a( xCoord, yCoord, zCoord, true );
disableDrops();
this.worldObj.func_147480_a( this.xCoord, this.yCoord, this.zCoord, true );
this.disableDrops();
}
public void saveChanges()
@@ -509,13 +509,13 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
@Override
public String getCustomName()
{
return hasCustomName() ? customName : getClass().getSimpleName();
return this.hasCustomName() ? this.customName : this.getClass().getSimpleName();
}
@Override
public boolean hasCustomName()
{
return customName != null && customName.length() > 0;
return this.customName != null && this.customName.length() > 0;
}
}
@@ -49,31 +49,31 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
@TileEvent(TileEventType.NETWORK_READ)
public boolean readFromStream_TileCraftingMonitorTile(ByteBuf data) throws IOException
{
AEColor oldPaintedColor = paintedColor;
paintedColor = AEColor.values()[data.readByte()];
AEColor oldPaintedColor = this.paintedColor;
this.paintedColor = AEColor.values()[data.readByte()];
boolean hasItem = data.readBoolean();
if ( hasItem )
dspPlay = AEItemStack.loadItemStackFromPacket( data );
this.dspPlay = AEItemStack.loadItemStackFromPacket( data );
else
dspPlay = null;
this.dspPlay = null;
updateList = true;
return oldPaintedColor != paintedColor; // tesr!
this.updateList = true;
return oldPaintedColor != this.paintedColor; // tesr!
}
@TileEvent(TileEventType.NETWORK_WRITE)
public void writeToStream_TileCraftingMonitorTile(ByteBuf data) throws IOException
{
data.writeByte( paintedColor.ordinal() );
data.writeByte( this.paintedColor.ordinal() );
if ( dspPlay == null )
if ( this.dspPlay == null )
data.writeBoolean( false );
else
{
data.writeBoolean( true );
dspPlay.writeToPacket( data );
this.dspPlay.writeToPacket( data );
}
}
@@ -81,13 +81,13 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
public void readFromNBT_TileCraftingMonitorTile(NBTTagCompound data)
{
if ( data.hasKey( "paintedColor" ) )
paintedColor = AEColor.values()[data.getByte( "paintedColor" )];
this.paintedColor = AEColor.values()[data.getByte( "paintedColor" )];
}
@TileEvent(TileEventType.WORLD_NBT_WRITE)
public void writeToNBT_TileCraftingMonitorTile(NBTTagCompound data)
{
data.setByte( "paintedColor", (byte) paintedColor.ordinal() );
data.setByte( "paintedColor", (byte) this.paintedColor.ordinal() );
}
@Override
@@ -104,47 +104,47 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
public void setJob(IAEItemStack is)
{
if ( (is == null) != (dspPlay == null) )
if ( (is == null) != (this.dspPlay == null) )
{
dspPlay = is == null ? null : is.copy();
markForUpdate();
this.dspPlay = is == null ? null : is.copy();
this.markForUpdate();
}
else if ( is != null && dspPlay != null )
else if ( is != null && this.dspPlay != null )
{
if ( is.getStackSize() != dspPlay.getStackSize() )
if ( is.getStackSize() != this.dspPlay.getStackSize() )
{
dspPlay = is.copy();
markForUpdate();
this.dspPlay = is.copy();
this.markForUpdate();
}
}
}
public IAEItemStack getJobProgress()
{
return dspPlay;// AEItemStack.create( new ItemStack( Items.diamond, 64 ) );
return this.dspPlay;// AEItemStack.create( new ItemStack( Items.diamond, 64 ) );
}
@Override
public boolean requiresTESR()
{
return getJobProgress() != null;
return this.getJobProgress() != null;
}
@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;
}
}
@@ -58,10 +58,10 @@ public class TileCraftingStorageTile extends TileCraftingTile
@Override
public int getStorageBytes()
{
if ( worldObj == null || notLoaded() )
if ( this.worldObj == null || this.notLoaded() )
return 0;
switch (worldObj.getBlockMetadata( xCoord, yCoord, zCoord ) & 3)
switch (this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord ) & 3)
{
default:
case 0:
@@ -68,7 +68,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
@Override
protected AENetworkProxy createProxy()
{
return new AENetworkProxyMultiblock( this, "proxy", getItemFromTile( this ), true );
return new AENetworkProxyMultiblock( this, "proxy", this.getItemFromTile( this ), true );
}
@Override
@@ -81,58 +81,58 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
public void updateStatus(CraftingCPUCluster c)
{
if ( cluster != null && cluster != c )
cluster.breakCluster();
if ( this.cluster != null && this.cluster != c )
this.cluster.breakCluster();
cluster = c;
updateMeta( true );
this.cluster = c;
this.updateMeta( true );
}
public void updateMultiBlock()
{
calc.calculateMultiblock( worldObj, getLocation() );
this.calc.calculateMultiblock( this.worldObj, this.getLocation() );
}
@Override
public void setName(String name)
{
super.setName( name );
if ( cluster != null )
cluster.updateName();
if ( this.cluster != null )
this.cluster.updateName();
}
@TileEvent(TileEventType.WORLD_NBT_WRITE)
public void writeToNBT_TileCraftingTile(NBTTagCompound data)
{
data.setBoolean( "core", isCoreBlock );
if ( isCoreBlock && cluster != null )
cluster.writeToNBT( data );
data.setBoolean( "core", this.isCoreBlock );
if ( this.isCoreBlock && this.cluster != null )
this.cluster.writeToNBT( data );
}
@TileEvent(TileEventType.WORLD_NBT_READ)
public void readFromNBT_TileCraftingTile(NBTTagCompound data)
{
isCoreBlock = data.getBoolean( "core" );
if ( isCoreBlock )
this.isCoreBlock = data.getBoolean( "core" );
if ( this.isCoreBlock )
{
if ( cluster != null )
cluster.readFromNBT( data );
if ( this.cluster != null )
this.cluster.readFromNBT( data );
else
previousState = (NBTTagCompound) data.copy();
this.previousState = (NBTTagCompound) data.copy();
}
}
public TileCraftingTile() {
gridProxy.setFlags( GridFlags.MULTIBLOCK, GridFlags.REQUIRE_CHANNEL );
gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.gridProxy.setFlags( GridFlags.MULTIBLOCK, GridFlags.REQUIRE_CHANNEL );
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
}
@Override
public void onReady()
{
super.onReady();
gridProxy.setVisualRepresentation( getItemFromTile( this ) );
updateMultiBlock();
this.gridProxy.setVisualRepresentation( this.getItemFromTile( this ) );
this.updateMultiBlock();
}
@Override
@@ -145,56 +145,56 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
@Override
public void disconnect(boolean update)
{
if ( cluster != null )
if ( this.cluster != null )
{
cluster.destroy();
this.cluster.destroy();
if ( update )
updateMeta( true );
this.updateMeta( true );
}
}
@MENetworkEventSubscribe
public void onPowerStateChange(MENetworkChannelsChanged ev)
{
updateMeta( false );
this.updateMeta( false );
}
@MENetworkEventSubscribe
public void onPowerStateChange(MENetworkPowerStatusChange ev)
{
updateMeta( false );
this.updateMeta( false );
}
public void updateMeta(boolean updateFormed)
{
if ( worldObj == null || notLoaded() )
if ( this.worldObj == null || this.notLoaded() )
return;
boolean formed = isFormed();
boolean formed = this.isFormed();
boolean power = false;
if ( gridProxy.isReady() )
power = gridProxy.isActive();
if ( this.gridProxy.isReady() )
power = this.gridProxy.isActive();
int current = worldObj.getBlockMetadata( xCoord, yCoord, zCoord );
int current = this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord );
int newMeta = (current & 3) | (formed ? 8 : 0) | (power ? 4 : 0);
if ( current != newMeta )
worldObj.setBlockMetadataWithNotify( xCoord, yCoord, zCoord, newMeta, 2 );
this.worldObj.setBlockMetadataWithNotify( this.xCoord, this.yCoord, this.zCoord, newMeta, 2 );
if ( updateFormed )
{
if ( formed )
gridProxy.setValidSides( EnumSet.allOf( ForgeDirection.class ) );
this.gridProxy.setValidSides( EnumSet.allOf( ForgeDirection.class ) );
else
gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
}
}
@Override
public IAECluster getCluster()
{
return cluster;
return this.cluster;
}
@Override
@@ -207,22 +207,22 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
public boolean isPowered()
{
if ( Platform.isClient() )
return (worldObj.getBlockMetadata( xCoord, yCoord, zCoord ) & 4) == 4;
return gridProxy.isActive();
return (this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord ) & 4) == 4;
return this.gridProxy.isActive();
}
public boolean isFormed()
{
if ( Platform.isClient() )
return (worldObj.getBlockMetadata( xCoord, yCoord, zCoord ) & 8) == 8;
return cluster != null;
return (this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord ) & 8) == 8;
return this.cluster != null;
}
public boolean isAccelerator()
{
if ( worldObj == null )
if ( this.worldObj == null )
return false;
return (worldObj.getBlockMetadata( xCoord, yCoord, zCoord ) & 3) == 1;
return (this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord ) & 3) == 1;
}
public boolean isStatus()
@@ -244,20 +244,20 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
public boolean isActive()
{
if ( Platform.isServer() )
return gridProxy.isActive();
return isPowered() && isFormed();
return this.gridProxy.isActive();
return this.isPowered() && this.isFormed();
}
public void breakCluster()
{
if ( cluster != null )
if ( this.cluster != null )
{
cluster.cancel();
IMEInventory<IAEItemStack> inv = cluster.getInventory();
this.cluster.cancel();
IMEInventory<IAEItemStack> inv = this.cluster.getInventory();
LinkedList<WorldCoord> places = new LinkedList<WorldCoord>();
Iterator<IGridHost> i = cluster.getTiles();
Iterator<IGridHost> i = this.cluster.getTiles();
while (i.hasNext())
{
IGridHost h = i.next();
@@ -271,7 +271,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
WorldCoord wc = new WorldCoord( te );
wc.add( d, 1 );
if ( worldObj.isAirBlock( wc.x, wc.y, wc.z ) )
if ( this.worldObj.isAirBlock( wc.x, wc.y, wc.z ) )
places.add( wc );
}
@@ -289,19 +289,19 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
ais.setStackSize( ais.getItemStack().getMaxStackSize() );
while (true)
{
IAEItemStack g = inv.extractItems( ais.copy(), Actionable.MODULATE, cluster.getActionSource() );
IAEItemStack g = inv.extractItems( ais.copy(), Actionable.MODULATE, this.cluster.getActionSource() );
if ( g == null )
break;
WorldCoord wc = places.poll();
places.add( wc );
Platform.spawnDrops( worldObj, wc.x, wc.y, wc.z, Collections.singletonList( g.getItemStack() ) );
Platform.spawnDrops( this.worldObj, wc.x, wc.y, wc.z, Collections.singletonList( g.getItemStack() ) );
}
}
cluster.destroy();
this.cluster.destroy();
}
}
}
@@ -81,7 +81,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
private final InventoryCrafting craftingInv = new InventoryCrafting( new ContainerNull(), 3, 3 );
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 9 + 2 );
private final IConfigManager settings = new ConfigManager( this );
private final UpgradeInventory upgrades = new UpgradeInventory( assemblerStack, this, getUpgradeSlots() );
private final UpgradeInventory upgrades = new UpgradeInventory( assemblerStack, this, this.getUpgradeSlots() );
private ForgeDirection pushDirection = ForgeDirection.UNKNOWN;
private ItemStack myPattern = null;
@@ -96,23 +96,23 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
@Override
public boolean pushPattern(ICraftingPatternDetails patternDetails, InventoryCrafting table, ForgeDirection where)
{
if ( myPattern == null )
if ( this.myPattern == null )
{
boolean isEmpty = true;
for (int x = 0; x < inv.getSizeInventory(); x++)
isEmpty = inv.getStackInSlot( x ) == null && isEmpty;
for (int x = 0; x < this.inv.getSizeInventory(); x++)
isEmpty = this.inv.getStackInSlot( x ) == null && isEmpty;
if ( isEmpty && patternDetails.isCraftable() )
{
forcePlan = true;
myPlan = patternDetails;
pushDirection = where;
this.forcePlan = true;
this.myPlan = patternDetails;
this.pushDirection = where;
for (int x = 0; x < table.getSizeInventory(); x++)
inv.setInventorySlotContents( x, table.getStackInSlot( x ) );
this.inv.setInventorySlotContents( x, table.getStackInSlot( x ) );
updateSleepiness();
markDirty();
this.updateSleepiness();
this.markDirty();
return true;
}
}
@@ -121,53 +121,53 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
private void recalculatePlan()
{
reboot = true;
this.reboot = true;
if ( forcePlan )
if ( this.forcePlan )
return;
ItemStack is = inv.getStackInSlot( 10 );
ItemStack is = this.inv.getStackInSlot( 10 );
if ( is != null && is.getItem() instanceof ItemEncodedPattern )
{
if ( !Platform.isSameItem( is, myPattern ) )
if ( !Platform.isSameItem( is, this.myPattern ) )
{
World w = getWorldObj();
World w = this.getWorldObj();
ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
ICraftingPatternDetails ph = iep.getPatternForItem( is, w );
if ( ph != null && ph.isCraftable() )
{
progress = 0;
myPattern = is;
myPlan = ph;
this.progress = 0;
this.myPattern = is;
this.myPlan = ph;
}
}
}
else
{
progress = 0;
forcePlan = false;
myPlan = null;
myPattern = null;
pushDirection = ForgeDirection.UNKNOWN;
this.progress = 0;
this.forcePlan = false;
this.myPlan = null;
this.myPattern = null;
this.pushDirection = ForgeDirection.UNKNOWN;
}
updateSleepiness();
this.updateSleepiness();
}
private void updateSleepiness()
{
boolean wasEnabled = isAwake;
isAwake = myPlan != null && hasMats() || canPush();
if ( wasEnabled != isAwake )
boolean wasEnabled = this.isAwake;
this.isAwake = this.myPlan != null && this.hasMats() || this.canPush();
if ( wasEnabled != this.isAwake )
{
try
{
if ( isAwake )
gridProxy.getTick().wakeDevice( gridProxy.getNode() );
if ( this.isAwake )
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
else
gridProxy.getTick().sleepDevice( gridProxy.getNode() );
this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
}
catch (GridAccessException e)
{
@@ -178,13 +178,13 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
private boolean canPush()
{
return inv.getStackInSlot( 9 ) != null;
return this.inv.getStackInSlot( 9 ) != null;
}
@Override
public int getInstalledUpgrades(Upgrades u)
{
return upgrades.getInstalledUpgrades( u );
return this.upgrades.getInstalledUpgrades( u );
}
protected int getUpgradeSlots()
@@ -195,35 +195,35 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
@TileEvent(TileEventType.NETWORK_READ)
public boolean readFromStream_TileMolecularAssembler(ByteBuf data)
{
boolean oldPower = isPowered;
isPowered = data.readBoolean();
return isPowered != oldPower;
boolean oldPower = this.isPowered;
this.isPowered = data.readBoolean();
return this.isPowered != oldPower;
}
@TileEvent(TileEventType.NETWORK_WRITE)
public void writeToStream_TileMolecularAssembler(ByteBuf data)
{
data.writeBoolean( isPowered );
data.writeBoolean( this.isPowered );
}
@TileEvent(TileEventType.WORLD_NBT_WRITE)
public void writeToNBT_TileMolecularAssembler(NBTTagCompound data)
{
if ( forcePlan && myPlan != null )
if ( this.forcePlan && this.myPlan != null )
{
ItemStack pattern = myPlan.getPattern();
ItemStack pattern = this.myPlan.getPattern();
if ( pattern != null )
{
NBTTagCompound compound = new NBTTagCompound();
pattern.writeToNBT( compound );
data.setTag( "myPlan", compound );
data.setInteger( "pushDirection", pushDirection.ordinal() );
data.setInteger( "pushDirection", this.pushDirection.ordinal() );
}
}
upgrades.writeToNBT( data, "upgrades" );
inv.writeToNBT( data, "inv" );
settings.writeToNBT( data );
this.upgrades.writeToNBT( data, "upgrades" );
this.inv.writeToNBT( data, "inv" );
this.settings.writeToNBT( data );
}
@TileEvent(TileEventType.WORLD_NBT_READ)
@@ -235,28 +235,28 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
if ( myPat != null && myPat.getItem() instanceof ItemEncodedPattern )
{
World w = getWorldObj();
World w = this.getWorldObj();
ItemEncodedPattern iep = (ItemEncodedPattern) myPat.getItem();
ICraftingPatternDetails ph = iep.getPatternForItem( myPat, w );
if ( ph != null && ph.isCraftable() )
{
forcePlan = true;
myPlan = ph;
pushDirection = ForgeDirection.getOrientation( data.getInteger( "pushDirection" ) );
this.forcePlan = true;
this.myPlan = ph;
this.pushDirection = ForgeDirection.getOrientation( data.getInteger( "pushDirection" ) );
}
}
}
upgrades.readFromNBT( data, "upgrades" );
inv.readFromNBT( data, "inv" );
settings.readFromNBT( data );
recalculatePlan();
this.upgrades.readFromNBT( data, "upgrades" );
this.inv.readFromNBT( data, "inv" );
this.settings.readFromNBT( data );
this.recalculatePlan();
}
public TileMolecularAssembler() {
settings.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
inv.setMaxStackSize( 1 );
gridProxy.setIdlePowerUsage( 0.0 );
this.settings.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
this.inv.setMaxStackSize( 1 );
this.gridProxy.setIdlePowerUsage( 0.0 );
}
@Override
@@ -265,8 +265,8 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
if ( i >= 9 )
return false;
if ( hasPattern() )
return myPlan.isValidItemForSlot( i, itemstack, getWorldObj() );
if ( this.hasPattern() )
return this.myPlan.isValidItemForSlot( i, itemstack, this.getWorldObj() );
return false;
}
@@ -274,12 +274,12 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
@Override
public boolean acceptsPlans()
{
return inv.getStackInSlot( 10 ) == null;
return this.inv.getStackInSlot( 10 ) == null;
}
private boolean hasPattern()
{
return myPlan != null && inv.getStackInSlot( 10 ) != null;
return this.myPlan != null && this.inv.getStackInSlot( 10 ) != null;
}
@Override
@@ -291,14 +291,14 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
@Override
public IInventory getInternalInventory()
{
return inv;
return this.inv;
}
@Override
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added)
{
if ( inv == this.inv )
recalculatePlan();
this.recalculatePlan();
}
@Override
@@ -322,17 +322,17 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
@Override
public IConfigManager getConfigManager()
{
return settings;
return this.settings;
}
@Override
public IInventory getInventoryByName(String name)
{
if ( name.equals( "upgrades" ) )
return upgrades;
return this.upgrades;
if ( name.equals( "mac" ) )
return inv;
return this.inv;
return null;
}
@@ -351,7 +351,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
public int getCraftingProgress()
{
return (int) progress;
return (int) this.progress;
}
@Override
@@ -359,9 +359,9 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
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 );
}
@@ -370,114 +370,114 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
@Override
public TickingRequest getTickingRequest(IGridNode node)
{
recalculatePlan();
updateSleepiness();
return new TickingRequest( 1, 1, !isAwake, false );
this.recalculatePlan();
this.updateSleepiness();
return new TickingRequest( 1, 1, !this.isAwake, false );
}
private boolean hasMats()
{
if ( myPlan == null )
if ( this.myPlan == null )
return false;
for (int x = 0; x < craftingInv.getSizeInventory(); x++)
craftingInv.setInventorySlotContents( x, inv.getStackInSlot( x ) );
for (int x = 0; x < this.craftingInv.getSizeInventory(); x++)
this.craftingInv.setInventorySlotContents( x, this.inv.getStackInSlot( x ) );
return myPlan.getOutput( craftingInv, getWorldObj() ) != null;
return this.myPlan.getOutput( this.craftingInv, this.getWorldObj() ) != null;
}
@Override
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
{
if ( inv.getStackInSlot( 9 ) != null )
if ( this.inv.getStackInSlot( 9 ) != null )
{
pushOut( inv.getStackInSlot( 9 ) );
this.pushOut( this.inv.getStackInSlot( 9 ) );
// did it eject?
if ( inv.getStackInSlot( 9 ) == null )
markDirty();
if ( this.inv.getStackInSlot( 9 ) == null )
this.markDirty();
ejectHeldItems();
updateSleepiness();
progress = 0;
return isAwake ? TickRateModulation.IDLE : TickRateModulation.SLEEP;
this.ejectHeldItems();
this.updateSleepiness();
this.progress = 0;
return this.isAwake ? TickRateModulation.IDLE : TickRateModulation.SLEEP;
}
if ( myPlan == null )
if ( this.myPlan == null )
{
updateSleepiness();
this.updateSleepiness();
return TickRateModulation.SLEEP;
}
if ( reboot )
if ( this.reboot )
TicksSinceLastCall = 1;
if ( !isAwake )
if ( !this.isAwake )
return TickRateModulation.SLEEP;
reboot = false;
this.reboot = false;
int speed = 10;
switch (upgrades.getInstalledUpgrades( Upgrades.SPEED ))
switch (this.upgrades.getInstalledUpgrades( Upgrades.SPEED ))
{
case 0:
progress += userPower( TicksSinceLastCall, speed = 10, 1.0 );
this.progress += this.userPower( TicksSinceLastCall, speed = 10, 1.0 );
break;
case 1:
progress += userPower( TicksSinceLastCall, speed = 13, 1.3 );
this.progress += this.userPower( TicksSinceLastCall, speed = 13, 1.3 );
break;
case 2:
progress += userPower( TicksSinceLastCall, speed = 17, 1.7 );
this.progress += this.userPower( TicksSinceLastCall, speed = 17, 1.7 );
break;
case 3:
progress += userPower( TicksSinceLastCall, speed = 20, 2.0 );
this.progress += this.userPower( TicksSinceLastCall, speed = 20, 2.0 );
break;
case 4:
progress += userPower( TicksSinceLastCall, speed = 25, 2.5 );
this.progress += this.userPower( TicksSinceLastCall, speed = 25, 2.5 );
break;
case 5:
progress += userPower( TicksSinceLastCall, speed = 50, 5.0 );
this.progress += this.userPower( TicksSinceLastCall, speed = 50, 5.0 );
break;
}
if ( progress >= 100 )
if ( this.progress >= 100 )
{
for (int x = 0; x < craftingInv.getSizeInventory(); x++)
craftingInv.setInventorySlotContents( x, inv.getStackInSlot( x ) );
for (int x = 0; x < this.craftingInv.getSizeInventory(); x++)
this.craftingInv.setInventorySlotContents( x, this.inv.getStackInSlot( x ) );
progress = 0;
ItemStack output = myPlan.getOutput( craftingInv, getWorldObj() );
this.progress = 0;
ItemStack output = this.myPlan.getOutput( this.craftingInv, this.getWorldObj() );
if ( output != null )
{
FMLCommonHandler.instance().firePlayerCraftingEvent( Platform.getPlayer( (WorldServer) getWorldObj() ), output, craftingInv );
FMLCommonHandler.instance().firePlayerCraftingEvent( Platform.getPlayer( (WorldServer) this.getWorldObj() ), output, this.craftingInv );
pushOut( output.copy() );
this.pushOut( output.copy() );
for (int x = 0; x < craftingInv.getSizeInventory(); x++)
inv.setInventorySlotContents( x, Platform.getContainerItem( craftingInv.getStackInSlot( x ) ) );
for (int x = 0; x < this.craftingInv.getSizeInventory(); x++)
this.inv.setInventorySlotContents( x, Platform.getContainerItem( this.craftingInv.getStackInSlot( x ) ) );
if ( inv.getStackInSlot( 10 ) == null )
if ( this.inv.getStackInSlot( 10 ) == null )
{
forcePlan = false;
myPlan = null;
pushDirection = ForgeDirection.UNKNOWN;
this.forcePlan = false;
this.myPlan = null;
this.pushDirection = ForgeDirection.UNKNOWN;
}
ejectHeldItems();
this.ejectHeldItems();
try
{
TargetPoint where = new TargetPoint( worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 32 );
TargetPoint where = new TargetPoint( this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, 32 );
IAEItemStack item = AEItemStack.create( output );
NetworkHandler.instance.sendToAllAround( new PacketAssemblerAnimation( xCoord, yCoord, zCoord, (byte) speed, item ), where );
NetworkHandler.instance.sendToAllAround( new PacketAssemblerAnimation( this.xCoord, this.yCoord, this.zCoord, (byte) speed, item ), where );
}
catch (IOException e)
{
// ;P
}
markDirty();
updateSleepiness();
return isAwake ? TickRateModulation.IDLE : TickRateModulation.SLEEP;
this.markDirty();
this.updateSleepiness();
return this.isAwake ? TickRateModulation.IDLE : TickRateModulation.SLEEP;
}
}
@@ -486,18 +486,18 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
private void ejectHeldItems()
{
if ( inv.getStackInSlot( 9 ) == null )
if ( this.inv.getStackInSlot( 9 ) == null )
{
for (int x = 0; x < 9; x++)
{
ItemStack is = inv.getStackInSlot( x );
ItemStack is = this.inv.getStackInSlot( x );
if ( is != null )
{
if ( myPlan == null || !myPlan.isValidItemForSlot( x, is, worldObj ) )
if ( this.myPlan == null || !this.myPlan.isValidItemForSlot( x, is, this.worldObj ) )
{
inv.setInventorySlotContents( 9, is );
inv.setInventorySlotContents( x, null );
markDirty();
this.inv.setInventorySlotContents( 9, is );
this.inv.setInventorySlotContents( x, null );
this.markDirty();
return;
}
}
@@ -509,7 +509,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
try
{
return (int) (gridProxy.getEnergy().extractAEPower( ticksPassed * bonusValue * acceleratorTax, Actionable.MODULATE, PowerMultiplier.CONFIG ) / acceleratorTax);
return (int) (this.gridProxy.getEnergy().extractAEPower( ticksPassed * bonusValue * acceleratorTax, Actionable.MODULATE, PowerMultiplier.CONFIG ) / acceleratorTax);
}
catch (GridAccessException e)
{
@@ -519,21 +519,21 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
private void pushOut(ItemStack output)
{
if ( pushDirection == ForgeDirection.UNKNOWN )
if ( this.pushDirection == ForgeDirection.UNKNOWN )
{
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS)
output = pushTo( output, d );
output = this.pushTo( output, d );
}
else
output = pushTo( output, pushDirection );
output = this.pushTo( output, this.pushDirection );
if ( output == null && forcePlan )
if ( output == null && this.forcePlan )
{
forcePlan = false;
recalculatePlan();
this.forcePlan = false;
this.recalculatePlan();
}
inv.setInventorySlotContents( 9, output );
this.inv.setInventorySlotContents( 9, output );
}
private ItemStack pushTo(ItemStack output, ForgeDirection d)
@@ -541,7 +541,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
if ( output == null )
return output;
TileEntity te = getWorldObj().getTileEntity( xCoord + d.offsetX, yCoord + d.offsetY, zCoord + d.offsetZ );
TileEntity te = this.getWorldObj().getTileEntity( this.xCoord + d.offsetX, this.yCoord + d.offsetY, this.zCoord + d.offsetZ );
if ( te == null )
return output;
@@ -556,7 +556,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
int newSize = output == null ? 0 : output.stackSize;
if ( size != newSize )
markDirty();
this.markDirty();
return output;
}
@@ -566,7 +566,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
@MENetworkEventSubscribe
public void onPowerEvent(MENetworkPowerStatusChange p)
{
updatePowerState();
this.updatePowerState();
}
private void updatePowerState()
@@ -575,30 +575,30 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
try
{
newState = gridProxy.isActive() && gridProxy.getEnergy().extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.0001;
newState = this.gridProxy.isActive() && this.gridProxy.getEnergy().extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.0001;
}
catch (GridAccessException ignored)
{
}
if ( newState != isPowered )
if ( newState != this.isPowered )
{
isPowered = newState;
markForUpdate();
this.isPowered = newState;
this.markForUpdate();
}
}
@Override
public boolean isPowered()
{
return isPowered;
return this.isPowered;
}
@Override
public boolean isActive()
{
return isPowered;
return this.isPowered;
}
}
@@ -39,7 +39,7 @@ public class AETileEventHandler
public AETileEventHandler( Method m, TileEventType which )
{
method = m;
this.method = m;
}
// TICK
@@ -47,7 +47,7 @@ public class AETileEventHandler
{
try
{
method.invoke( tile );
this.method.invoke( tile );
}
catch ( IllegalAccessException e )
{
@@ -68,7 +68,7 @@ public class AETileEventHandler
{
try
{
method.invoke( tile, data );
this.method.invoke( tile, data );
}
catch ( IllegalAccessException e )
{
@@ -89,7 +89,7 @@ public class AETileEventHandler
{
try
{
method.invoke( tile, data );
this.method.invoke( tile, data );
}
catch ( IllegalAccessException e )
{
@@ -110,7 +110,7 @@ public class AETileEventHandler
{
try
{
method.invoke( tile, data );
this.method.invoke( tile, data );
}
catch ( IllegalAccessException e )
{
@@ -138,7 +138,7 @@ public class AETileEventHandler
{
try
{
return ( Boolean ) method.invoke( tile, data );
return ( Boolean ) this.method.invoke( tile, data );
}
catch ( IllegalAccessException e )
{
@@ -34,55 +34,55 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH
@TileEvent(TileEventType.WORLD_NBT_READ)
public void readFromNBT_AENetwork(NBTTagCompound data)
{
gridProxy.readFromNBT( data );
this.gridProxy.readFromNBT( data );
}
@TileEvent(TileEventType.WORLD_NBT_WRITE)
public void writeToNBT_AENetwork(NBTTagCompound data)
{
gridProxy.writeToNBT( data );
this.gridProxy.writeToNBT( data );
}
protected final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", getItemFromTile( this ), true );
protected final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true );
@Override
public AENetworkProxy getProxy()
{
return gridProxy;
return this.gridProxy;
}
@Override
public IGridNode getGridNode(ForgeDirection dir)
{
return gridProxy.getNode();
return this.gridProxy.getNode();
}
@Override
public void onReady()
{
super.onReady();
gridProxy.onReady();
this.gridProxy.onReady();
}
@Override
public void onChunkUnload()
{
super.onChunkUnload();
gridProxy.onChunkUnload();
this.gridProxy.onChunkUnload();
}
@Override
public void validate()
{
super.validate();
gridProxy.validate();
this.gridProxy.validate();
}
@Override
public void invalidate()
{
super.invalidate();
gridProxy.invalidate();
this.gridProxy.invalidate();
}
@Override
@@ -94,6 +94,6 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH
@Override
public IGridNode getActionableNode()
{
return gridProxy.getNode();
return this.gridProxy.getNode();
}
}
@@ -36,21 +36,21 @@ public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IA
@TileEvent(TileEventType.WORLD_NBT_READ)
public void readFromNBT_AENetwork(NBTTagCompound data)
{
gridProxy.readFromNBT( data );
this.gridProxy.readFromNBT( data );
}
@TileEvent(TileEventType.WORLD_NBT_WRITE)
public void writeToNBT_AENetwork(NBTTagCompound data)
{
gridProxy.writeToNBT( data );
this.gridProxy.writeToNBT( data );
}
protected final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", getItemFromTile( this ), true );
protected final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true );
@Override
public AENetworkProxy getProxy()
{
return gridProxy;
return this.gridProxy;
}
@Override
@@ -68,35 +68,35 @@ public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IA
@Override
public IGridNode getGridNode(ForgeDirection dir)
{
return gridProxy.getNode();
return this.gridProxy.getNode();
}
@Override
public void onReady()
{
super.onReady();
gridProxy.onReady();
this.gridProxy.onReady();
}
@Override
public void onChunkUnload()
{
super.onChunkUnload();
gridProxy.onChunkUnload();
this.gridProxy.onChunkUnload();
}
@Override
public void validate()
{
super.validate();
gridProxy.validate();
this.gridProxy.validate();
}
@Override
public void invalidate()
{
super.invalidate();
gridProxy.invalidate();
this.gridProxy.invalidate();
}
@Override
@@ -108,6 +108,6 @@ public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IA
@Override
public IGridNode getActionableNode()
{
return gridProxy.getNode();
return this.gridProxy.getNode();
}
}
@@ -36,54 +36,54 @@ public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxy
@TileEvent(TileEventType.WORLD_NBT_READ)
public void readFromNBT_AENetwork(NBTTagCompound data)
{
gridProxy.readFromNBT( data );
this.gridProxy.readFromNBT( data );
}
@TileEvent(TileEventType.WORLD_NBT_WRITE)
public void writeToNBT_AENetwork(NBTTagCompound data)
{
gridProxy.writeToNBT( data );
this.gridProxy.writeToNBT( data );
}
final protected AENetworkProxy gridProxy = createProxy();
final protected AENetworkProxy gridProxy = this.createProxy();
protected AENetworkProxy createProxy()
{
return new AENetworkProxy( this, "proxy", getItemFromTile( this ), true );
return new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true );
}
@Override
public IGridNode getGridNode(ForgeDirection dir)
{
return gridProxy.getNode();
return this.gridProxy.getNode();
}
@Override
public void onReady()
{
super.onReady();
gridProxy.onReady();
this.gridProxy.onReady();
}
@Override
public void onChunkUnload()
{
super.onChunkUnload();
gridProxy.onChunkUnload();
this.gridProxy.onChunkUnload();
}
@Override
public void validate()
{
super.validate();
gridProxy.validate();
this.gridProxy.validate();
}
@Override
public void invalidate()
{
super.invalidate();
gridProxy.invalidate();
this.gridProxy.invalidate();
}
@Override
@@ -107,12 +107,12 @@ public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxy
@Override
public AENetworkProxy getProxy()
{
return gridProxy;
return this.gridProxy;
}
@Override
public IGridNode getActionableNode()
{
return gridProxy.getNode();
return this.gridProxy.getNode();
}
}
@@ -52,33 +52,33 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
@TileEvent(TileEventType.TICK)
public void Tick_TileCrank()
{
if ( rotation > 0 )
if ( this.rotation > 0 )
{
visibleRotation -= 360 / (ticksPerRotation);
charge++;
if ( charge >= ticksPerRotation )
this.visibleRotation -= 360 / (this.ticksPerRotation);
this.charge++;
if ( this.charge >= this.ticksPerRotation )
{
charge -= ticksPerRotation;
ICrankable g = getGrinder();
this.charge -= this.ticksPerRotation;
ICrankable g = this.getGrinder();
if ( g != null )
g.applyTurn();
}
rotation--;
this.rotation--;
}
}
@TileEvent(TileEventType.NETWORK_READ)
public boolean readFromStream_TileCrank(ByteBuf data)
{
rotation = data.readInt();
this.rotation = data.readInt();
return false;
}
@TileEvent(TileEventType.NETWORK_WRITE)
public void writeToStream_TileCrank(ByteBuf data)
{
data.writeInt( rotation );
data.writeInt( this.rotation );
}
public ICrankable getGrinder()
@@ -86,8 +86,8 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
if ( Platform.isClient() )
return null;
ForgeDirection grinder = getUp().getOpposite();
TileEntity te = worldObj.getTileEntity( xCoord + grinder.offsetX, yCoord + grinder.offsetY, zCoord + grinder.offsetZ );
ForgeDirection grinder = this.getUp().getOpposite();
TileEntity te = this.worldObj.getTileEntity( this.xCoord + grinder.offsetX, this.yCoord + grinder.offsetY, this.zCoord + grinder.offsetZ );
if ( te instanceof ICrankable )
return (ICrankable) te;
return null;
@@ -97,7 +97,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
public void setOrientation(ForgeDirection inForward, ForgeDirection inUp)
{
super.setOrientation( inForward, inUp );
getBlockType().onNeighborBlockChange( worldObj, xCoord, yCoord, zCoord, Platform.air );
this.getBlockType().onNeighborBlockChange( this.worldObj, this.xCoord, this.yCoord, this.zCoord, Platform.air );
}
/**
@@ -108,24 +108,24 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
if ( Platform.isClient() )
return false;
if ( rotation < 3 )
if ( this.rotation < 3 )
{
ICrankable g = getGrinder();
ICrankable g = this.getGrinder();
if ( g != null )
{
if ( g.canTurn() )
{
hits = 0;
rotation += ticksPerRotation;
this.hits = 0;
this.rotation += this.ticksPerRotation;
this.markForUpdate();
return true;
}
else
{
hits++;
if ( hits > 10 )
this.hits++;
if ( this.hits > 10 )
{
worldObj.func_147480_a( xCoord, yCoord, zCoord, false );
this.worldObj.func_147480_a( this.xCoord, this.yCoord, this.zCoord, false );
// worldObj.destroyBlock( xCoord, yCoord, zCoord, false );
}
}
@@ -138,18 +138,18 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
{
double xOff = -0.15 * getUp().offsetX;
double yOff = -0.15 * getUp().offsetY;
double zOff = -0.15 * getUp().offsetZ;
double xOff = -0.15 * this.getUp().offsetX;
double yOff = -0.15 * this.getUp().offsetY;
double zOff = -0.15 * this.getUp().offsetZ;
return Collections.singletonList( AxisAlignedBB.getBoundingBox( xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85 ) );
}
@Override
public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e)
{
double xOff = -0.15 * getUp().offsetX;
double yOff = -0.15 * getUp().offsetY;
double zOff = -0.15 * getUp().offsetZ;
double xOff = -0.15 * this.getUp().offsetX;
double yOff = -0.15 * this.getUp().offsetY;
double zOff = -0.15 * this.getUp().offsetZ;
out.add( AxisAlignedBB.getBoundingBox( xOff + 0.15, yOff + 0.15, zOff + 0.15,// ahh
xOff + 0.85, yOff + 0.85, zOff + 0.85 ) );
}
@@ -48,7 +48,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
public void setOrientation(ForgeDirection inForward, ForgeDirection inUp)
{
super.setOrientation( inForward, inUp );
getBlockType().onNeighborBlockChange( worldObj, xCoord, yCoord, zCoord, Platform.air );
this.getBlockType().onNeighborBlockChange( this.worldObj, this.xCoord, this.yCoord, this.zCoord, Platform.air );
}
private void addItem(InventoryAdaptor sia, ItemStack output)
@@ -59,14 +59,14 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
ItemStack notAdded = sia.addItems( output );
if ( notAdded != null )
{
WorldCoord wc = new WorldCoord( xCoord, yCoord, zCoord );
WorldCoord wc = new WorldCoord( this.xCoord, this.yCoord, this.zCoord );
wc.add( getForward(), 1 );
wc.add( this.getForward(), 1 );
List<ItemStack> out = new ArrayList<ItemStack>();
out.add( notAdded );
Platform.spawnDrops( worldObj, wc.x, wc.y, wc.z, out );
Platform.spawnDrops( this.worldObj, wc.x, wc.y, wc.z, out );
}
}
@@ -88,13 +88,13 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
@Override
public IInventory getInternalInventory()
{
return inv;
return this.inv;
}
@Override
public int[] getAccessibleSlotsBySide(ForgeDirection side)
{
return sides;
return this.sides;
}
@Override
@@ -111,7 +111,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
if ( null == this.getStackInSlot( 6 ) ) // Add if there isn't one...
{
IInventory src = new WrapperInventoryRange( this, inputs, true );
IInventory src = new WrapperInventoryRange( this, this.inputs, true );
for (int x = 0; x < src.getSizeInventory(); x++)
{
ItemStack item = src.getStackInSlot( x );
@@ -147,27 +147,27 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
if ( Platform.isClient() )
return;
points++;
this.points++;
ItemStack processing = this.getStackInSlot( 6 );
IGrinderEntry r = AEApi.instance().registries().grinder().getRecipeForInput( processing );
if ( r != null )
{
if ( r.getEnergyCost() > points )
if ( r.getEnergyCost() > this.points )
return;
points = 0;
this.points = 0;
InventoryAdaptor sia = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this, 3, 3, true ), ForgeDirection.EAST );
addItem( sia, r.getOutput() );
this.addItem( sia, r.getOutput() );
float chance = (Platform.getRandomInt() % 2000) / 2000.0f;
if ( chance <= r.getOptionalChance() )
addItem( sia, r.getOptionalOutput() );
this.addItem( sia, r.getOptionalOutput() );
chance = (Platform.getRandomInt() % 2000) / 2000.0f;
if ( chance <= r.getSecondOptionalChance() )
addItem( sia, r.getSecondOptionalOutput() );
this.addItem( sia, r.getSecondOptionalOutput() );
this.setInventorySlotContents( 6, null );
}
@@ -176,7 +176,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
@Override
public boolean canCrankAttach(ForgeDirection directionToCrank)
{
return getUp().equals( directionToCrank );
return this.getUp().equals( directionToCrank );
}
}
@@ -43,57 +43,57 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
public boolean isEmpty()
{
for (int x = 0; x < getSizeInventory(); x++)
if ( getStackInSlot( x ) != null )
for (int x = 0; x < this.getSizeInventory(); x++)
if ( this.getStackInSlot( x ) != null )
return false;
return true;
}
public AppEngInternalAEInventory(IAEAppEngInventory _te, int s) {
te = _te;
size = s;
maxStack = 64;
inv = new IAEItemStack[s];
this.te = _te;
this.size = s;
this.maxStack = 64;
this.inv = new IAEItemStack[s];
}
public void setMaxStackSize(int s)
{
maxStack = s;
this.maxStack = s;
}
public IAEItemStack getAEStackInSlot(int var1)
{
return inv[var1];
return this.inv[var1];
}
@Override
public ItemStack getStackInSlot(int var1)
{
if ( inv[var1] == null )
if ( this.inv[var1] == null )
return null;
return inv[var1].getItemStack();
return this.inv[var1].getItemStack();
}
@Override
public ItemStack decrStackSize(int slot, int qty)
{
if ( inv[slot] != null )
if ( this.inv[slot] != null )
{
ItemStack split = getStackInSlot( slot );
ItemStack split = this.getStackInSlot( slot );
ItemStack ns = null;
if ( qty >= split.stackSize )
{
ns = getStackInSlot( slot );
inv[slot] = null;
ns = this.getStackInSlot( slot );
this.inv[slot] = null;
}
else
ns = split.splitStack( qty );
if ( te != null && Platform.isServer() )
if ( this.te != null && Platform.isServer() )
{
te.onChangeInventory( this, slot, InvOperation.decreaseStackSize, ns, null );
this.te.onChangeInventory( this, slot, InvOperation.decreaseStackSize, ns, null );
}
return ns;
@@ -111,10 +111,10 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
@Override
public void setInventorySlotContents(int slot, ItemStack newItemStack)
{
ItemStack oldStack = getStackInSlot( slot );
inv[slot] = AEApi.instance().storage().createItemStack( newItemStack );
ItemStack oldStack = this.getStackInSlot( slot );
this.inv[slot] = AEApi.instance().storage().createItemStack( newItemStack );
if ( te != null && Platform.isServer() )
if ( this.te != null && Platform.isServer() )
{
ItemStack removed = oldStack;
ItemStack added = newItemStack;
@@ -139,23 +139,23 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
}
}
te.onChangeInventory( this, slot, InvOperation.setInventorySlotContents, removed, added );
this.te.onChangeInventory( this, slot, InvOperation.setInventorySlotContents, removed, added );
}
}
@Override
public void markDirty()
{
if ( te != null && Platform.isServer() )
if ( this.te != null && Platform.isServer() )
{
te.onChangeInventory( this, -1, InvOperation.markDirty, null, null );
this.te.onChangeInventory( this, -1, InvOperation.markDirty, null, null );
}
}
@Override
public int getInventoryStackLimit()
{
return maxStack > 64 ? 64 : maxStack;
return this.maxStack > 64 ? 64 : this.maxStack;
}
@Override
@@ -176,15 +176,15 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
public void writeToNBT(NBTTagCompound target)
{
for (int x = 0; x < size; x++)
for (int x = 0; x < this.size; x++)
{
try
{
NBTTagCompound c = new NBTTagCompound();
if ( inv[x] != null )
if ( this.inv[x] != null )
{
inv[x].writeToNBT( c );
this.inv[x].writeToNBT( c );
}
target.setTag( "#" + x, c );
@@ -197,14 +197,14 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
public void readFromNBT(NBTTagCompound target)
{
for (int x = 0; x < size; x++)
for (int x = 0; x < this.size; x++)
{
try
{
NBTTagCompound c = target.getCompoundTag( "#" + x );
if ( c != null )
inv[x] = AEItemStack.loadItemStackFromNBT( c );
this.inv[x] = AEItemStack.loadItemStackFromNBT( c );
}
catch (Exception e)
@@ -217,7 +217,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
public void writeToNBT(NBTTagCompound data, String name)
{
NBTTagCompound c = new NBTTagCompound();
writeToNBT( c );
this.writeToNBT( c );
data.setTag( name, c );
}
@@ -225,13 +225,13 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
{
NBTTagCompound c = data.getCompoundTag( name );
if ( c != null )
readFromNBT( c );
this.readFromNBT( c );
}
@Override
public int getSizeInventory()
{
return size;
return this.size;
}
@Override
@@ -47,57 +47,57 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
public boolean isEmpty()
{
for (int x = 0; x < getSizeInventory(); x++)
if ( getStackInSlot( x ) != null )
for (int x = 0; x < this.getSizeInventory(); x++)
if ( this.getStackInSlot( x ) != null )
return false;
return true;
}
public AppEngInternalInventory(IAEAppEngInventory _te, int s) {
te = _te;
size = s;
maxStack = 64;
inv = new ItemStack[s];
this.te = _te;
this.size = s;
this.maxStack = 64;
this.inv = new ItemStack[s];
}
protected boolean eventsEnabled()
{
return Platform.isServer() || enableClientEvents;
return Platform.isServer() || this.enableClientEvents;
}
public void setMaxStackSize(int s)
{
maxStack = s;
this.maxStack = s;
}
@Override
public ItemStack getStackInSlot(int var1)
{
return inv[var1];
return this.inv[var1];
}
@Override
public ItemStack decrStackSize(int slot, int qty)
{
if ( inv[slot] != null )
if ( this.inv[slot] != null )
{
ItemStack split = getStackInSlot( slot );
ItemStack split = this.getStackInSlot( slot );
ItemStack ns = null;
if ( qty >= split.stackSize )
{
ns = inv[slot];
inv[slot] = null;
ns = this.inv[slot];
this.inv[slot] = null;
}
else
ns = split.splitStack( qty );
if ( te != null && eventsEnabled() )
if ( this.te != null && this.eventsEnabled() )
{
te.onChangeInventory( this, slot, InvOperation.decreaseStackSize, ns, null );
this.te.onChangeInventory( this, slot, InvOperation.decreaseStackSize, ns, null );
}
markDirty();
this.markDirty();
return ns;
}
@@ -113,10 +113,10 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
@Override
public void setInventorySlotContents(int slot, ItemStack newItemStack)
{
ItemStack oldStack = inv[slot];
inv[slot] = newItemStack;
ItemStack oldStack = this.inv[slot];
this.inv[slot] = newItemStack;
if ( te != null && eventsEnabled() )
if ( this.te != null && this.eventsEnabled() )
{
ItemStack removed = oldStack;
ItemStack added = newItemStack;
@@ -141,34 +141,34 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
}
}
te.onChangeInventory( this, slot, InvOperation.setInventorySlotContents, removed, added );
this.te.onChangeInventory( this, slot, InvOperation.setInventorySlotContents, removed, added );
markDirty();
this.markDirty();
}
}
@Override
public void markDirty()
{
if ( te != null && eventsEnabled() )
if ( this.te != null && this.eventsEnabled() )
{
te.onChangeInventory( this, -1, InvOperation.markDirty, null, null );
this.te.onChangeInventory( this, -1, InvOperation.markDirty, null, null );
}
}
// for guis...
public void markDirty(int slotIndex)
{
if ( te != null && eventsEnabled() )
if ( this.te != null && this.eventsEnabled() )
{
te.onChangeInventory( this, slotIndex, InvOperation.markDirty, null, null );
this.te.onChangeInventory( this, slotIndex, InvOperation.markDirty, null, null );
}
}
@Override
public int getInventoryStackLimit()
{
return maxStack > 64 ? 64 : maxStack;
return this.maxStack > 64 ? 64 : this.maxStack;
}
@Override
@@ -189,15 +189,15 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
public void writeToNBT(NBTTagCompound target)
{
for (int x = 0; x < size; x++)
for (int x = 0; x < this.size; x++)
{
try
{
NBTTagCompound c = new NBTTagCompound();
if ( inv[x] != null )
if ( this.inv[x] != null )
{
inv[x].writeToNBT( c );
this.inv[x].writeToNBT( c );
}
target.setTag( "#" + x, c );
@@ -210,14 +210,14 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
public void readFromNBT(NBTTagCompound target)
{
for (int x = 0; x < size; x++)
for (int x = 0; x < this.size; x++)
{
try
{
NBTTagCompound c = target.getCompoundTag( "#" + x );
if ( c != null )
inv[x] = ItemStack.loadItemStackFromNBT( c );
this.inv[x] = ItemStack.loadItemStackFromNBT( c );
}
catch (Exception e)
@@ -230,7 +230,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
public void writeToNBT(NBTTagCompound data, String name)
{
NBTTagCompound c = new NBTTagCompound();
writeToNBT( c );
this.writeToNBT( c );
data.setTag( name, c );
}
@@ -238,13 +238,13 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
{
NBTTagCompound c = data.getCompoundTag( name );
if ( c != null )
readFromNBT( c );
this.readFromNBT( c );
}
@Override
public int getSizeInventory()
{
return size;
return this.size;
}
@Override
@@ -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
+46 -46
View File
@@ -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 );
}
}
+53 -53
View File
@@ -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();
}
}
}
@@ -64,54 +64,54 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@TileEvent(TileEventType.WORLD_NBT_READ)
public void readFromNBT_TileCableBus(NBTTagCompound data)
{
cb.readFromNBT( data );
this.cb.readFromNBT( data );
}
@TileEvent(TileEventType.WORLD_NBT_WRITE)
public void writeToNBT_TileCableBus(NBTTagCompound data)
{
cb.writeToNBT( data );
this.cb.writeToNBT( data );
}
@TileEvent(TileEventType.NETWORK_READ)
public boolean readFromStream_TileCableBus(ByteBuf data) throws IOException
{
boolean ret = cb.readFromStream( data );
boolean ret = this.cb.readFromStream( data );
int newLV = cb.getLightValue();
if ( newLV != oldLV )
int newLV = this.cb.getLightValue();
if ( newLV != this.oldLV )
{
oldLV = newLV;
worldObj.func_147451_t( xCoord, yCoord, zCoord );
this.oldLV = newLV;
this.worldObj.func_147451_t( this.xCoord, this.yCoord, this.zCoord );
// worldObj.updateAllLightTypes( xCoord, yCoord, zCoord );
}
updateTileSetting();
this.updateTileSetting();
return ret;
}
@TileEvent(TileEventType.NETWORK_WRITE)
public void writeToStream_TileCableBus(ByteBuf data) throws IOException
{
cb.writeToStream( data );
this.cb.writeToStream( data );
}
@Override
public boolean isInWorld()
{
return cb.isInWorld();
return this.cb.isInWorld();
}
protected void updateTileSetting()
{
if ( cb.requiresDynamicRender )
if ( this.cb.requiresDynamicRender )
{
TileCableBus tcb;
try
{
tcb = (TileCableBus) BlockCableBus.tesrTile.newInstance();
tcb.copyFrom( this );
getWorldObj().setTileEntity( xCoord, yCoord, zCoord, tcb );
this.getWorldObj().setTileEntity( this.xCoord, this.yCoord, this.zCoord, tcb );
}
catch (Throwable ignored)
{
@@ -122,9 +122,9 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
protected void copyFrom(TileCableBus oldTile)
{
CableBusContainer tmpCB = cb;
cb = oldTile.cb;
oldLV = oldTile.oldLV;
CableBusContainer tmpCB = this.cb;
this.cb = oldTile.cb;
this.oldLV = oldTile.oldLV;
oldTile.cb = tmpCB;
}
@@ -132,20 +132,20 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
public void onReady()
{
super.onReady();
if ( cb.isEmpty() )
if ( this.cb.isEmpty() )
{
if ( worldObj.getTileEntity( xCoord, yCoord, zCoord ) == this )
worldObj.func_147480_a( xCoord, yCoord, zCoord, true );
if ( this.worldObj.getTileEntity( this.xCoord, this.yCoord, this.zCoord ) == this )
this.worldObj.func_147480_a( this.xCoord, this.yCoord, this.zCoord, true );
}
else
cb.addToWorld();
this.cb.addToWorld();
}
@Override
public void onChunkUnload()
{
super.onChunkUnload();
cb.removeFromWorld();
this.cb.removeFromWorld();
}
@Override
@@ -159,7 +159,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
public void invalidate()
{
super.invalidate();
cb.removeFromWorld();
this.cb.removeFromWorld();
}
@Override
@@ -177,43 +177,43 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public void getDrops(World w, int x, int y, int z, ArrayList drops)
{
cb.getDrops( drops );
this.cb.getDrops( drops );
}
@Override
public void getNoDrops(World w, int x, int y, int z, ArrayList<ItemStack> drops)
{
cb.getNoDrops( drops );
this.cb.getNoDrops( drops );
}
@Override
public IGridNode getGridNode(ForgeDirection dir)
{
return cb.getGridNode( dir );
return this.cb.getGridNode( dir );
}
@Override
public boolean canAddPart(ItemStack is, ForgeDirection side)
{
return cb.canAddPart( is, side );
return this.cb.canAddPart( is, side );
}
@Override
public ForgeDirection addPart(ItemStack is, ForgeDirection side, EntityPlayer player)
{
return cb.addPart( is, side, player );
return this.cb.addPart( is, side, player );
}
@Override
public void removePart(ForgeDirection side, boolean suppressUpdate)
{
cb.removePart( side, suppressUpdate );
this.cb.removePart( side, suppressUpdate );
}
@Override
public IPart getPart(ForgeDirection side)
{
return cb.getPart( side );
return this.cb.getPart( side );
}
@Override
@@ -231,57 +231,57 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(World w, int x, int y, int z, Entity e, boolean visual)
{
return cb.getSelectedBoundingBoxesFromPool( false, true, e, visual );
return this.cb.getSelectedBoundingBoxesFromPool( false, true, e, visual );
}
@Override
public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e)
{
for (AxisAlignedBB bx : getSelectedBoundingBoxesFromPool( w, x, y, z, e, false ))
for (AxisAlignedBB bx : this.getSelectedBoundingBoxesFromPool( w, x, y, z, e, false ))
out.add( AxisAlignedBB.getBoundingBox( bx.minX, bx.minY, bx.minZ, bx.maxX, bx.maxY, bx.maxZ ) );
}
@Override
public AECableType getCableConnectionType(ForgeDirection side)
{
return cb.getCableConnectionType( side );
return this.cb.getCableConnectionType( side );
}
@Override
public AEColor getColor()
{
return cb.getColor();
return this.cb.getColor();
}
@Override
public IFacadeContainer getFacadeContainer()
{
return cb.getFacadeContainer();
return this.cb.getFacadeContainer();
}
@Override
public void clearContainer()
{
cb = new CableBusContainer( this );
this.cb = new CableBusContainer( this );
}
@Override
public boolean isBlocked(ForgeDirection side)
{
return !ImmibisMicroblocks_isSideOpen( side.ordinal() );
return !this.ImmibisMicroblocks_isSideOpen( side.ordinal() );
}
@Override
public void markForUpdate()
{
if ( worldObj == null )
if ( this.worldObj == null )
return;
int newLV = cb.getLightValue();
if ( newLV != oldLV )
int newLV = this.cb.getLightValue();
if ( newLV != this.oldLV )
{
oldLV = newLV;
worldObj.func_147451_t( xCoord, yCoord, zCoord );
this.oldLV = newLV;
this.worldObj.func_147451_t( this.xCoord, this.yCoord, this.zCoord );
// worldObj.updateAllLightTypes( xCoord, yCoord, zCoord );
}
@@ -291,20 +291,20 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public SelectedPart selectPart(Vec3 pos)
{
return cb.selectPart( pos );
return this.cb.selectPart( pos );
}
@Override
public void partChanged()
{
notifyNeighbors();
this.notifyNeighbors();
}
@Override
public void notifyNeighbors()
{
if ( worldObj != null && worldObj.blockExists( xCoord, yCoord, zCoord ) && !CableBusContainer.isLoading() )
Platform.notifyBlocksOfNeighbors( worldObj, xCoord, yCoord, zCoord );
if ( this.worldObj != null && this.worldObj.blockExists( this.xCoord, this.yCoord, this.zCoord ) && !CableBusContainer.isLoading() )
Platform.notifyBlocksOfNeighbors( this.worldObj, this.xCoord, this.yCoord, this.zCoord );
}
@Override
@@ -316,25 +316,25 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public boolean hasRedstone(ForgeDirection side)
{
return cb.hasRedstone( side );
return this.cb.hasRedstone( side );
}
@Override
public boolean isEmpty()
{
return cb.isEmpty();
return this.cb.isEmpty();
}
@Override
public boolean requiresTESR()
{
return cb.requiresDynamicRender;
return this.cb.requiresDynamicRender;
}
@Override
public Set<LayerFlags> getLayerFlags()
{
return cb.getLayerFlags();
return this.cb.getLayerFlags();
}
@Override
@@ -347,7 +347,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
return;
}
getWorldObj().setBlock( xCoord, yCoord, zCoord, Platform.air );
this.getWorldObj().setBlock( this.xCoord, this.yCoord, this.zCoord, Platform.air );
}
/**
@@ -363,13 +363,13 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
public void ImmibisMicroblocks_onMicroblocksChanged()
{
cb.updateConnections();
this.cb.updateConnections();
}
@Override
public boolean recolourBlock(ForgeDirection side, AEColor colour, EntityPlayer who)
{
return cb.recolourBlock( side, colour, who );
return this.cb.recolourBlock( side, colour, who );
}
}
@@ -26,14 +26,14 @@ public class TileCableBusTESR extends TileCableBus
@Override
protected void updateTileSetting()
{
if ( !cb.requiresDynamicRender )
if ( !this.cb.requiresDynamicRender )
{
TileCableBus tcb;
try
{
tcb = (TileCableBus) BlockCableBus.noTesrTile.newInstance();
tcb.copyFrom( this );
getWorldObj().setTileEntity( xCoord, yCoord, zCoord, tcb );
this.getWorldObj().setTileEntity( this.xCoord, this.yCoord, this.zCoord, tcb );
}
catch (Throwable ignored)
{
@@ -43,10 +43,10 @@ public class TileController extends AENetworkPowerTile
boolean isValid = false;
public TileController() {
internalMaxPower = 8000;
internalPublicPowerStorage = true;
gridProxy.setIdlePowerUsage( 3 );
gridProxy.setFlags( GridFlags.CANNOT_CARRY, GridFlags.DENSE_CAPACITY );
this.internalMaxPower = 8000;
this.internalPublicPowerStorage = true;
this.gridProxy.setIdlePowerUsage( 3 );
this.gridProxy.setFlags( GridFlags.CANNOT_CARRY, GridFlags.DENSE_CAPACITY );
}
@Override
@@ -60,7 +60,7 @@ public class TileController extends AENetworkPowerTile
{
try
{
return gridProxy.getEnergy().getEnergyDemand( 8000 );
return this.gridProxy.getEnergy().getEnergyDemand( 8000 );
}
catch (GridAccessException e)
{
@@ -74,7 +74,7 @@ public class TileController extends AENetworkPowerTile
{
try
{
double ret = gridProxy.getEnergy().injectPower( AEUnits, mode );
double ret = this.gridProxy.getEnergy().injectPower( AEUnits, mode );
if ( mode == Actionable.SIMULATE )
return ret;
return 0;
@@ -91,7 +91,7 @@ public class TileController extends AENetworkPowerTile
{
try
{
gridProxy.getGrid().postEvent( new MENetworkPowerStorage( this, x ) );
this.gridProxy.getGrid().postEvent( new MENetworkPowerStorage( this, x ) );
}
catch (GridAccessException e)
{
@@ -102,64 +102,64 @@ public class TileController extends AENetworkPowerTile
@MENetworkEventSubscribe
public void onControllerChange(MENetworkControllerChange status)
{
updateMeta();
this.updateMeta();
}
@MENetworkEventSubscribe
public void onPowerChange(MENetworkPowerStatusChange status)
{
updateMeta();
this.updateMeta();
}
@Override
public void onReady()
{
onNeighborChange( true );
this.onNeighborChange( true );
super.onReady();
}
public void onNeighborChange(boolean force)
{
boolean xx = worldObj.getTileEntity( xCoord - 1, yCoord, zCoord ) instanceof TileController
&& worldObj.getTileEntity( xCoord + 1, yCoord, zCoord ) instanceof TileController;
boolean yy = worldObj.getTileEntity( xCoord, yCoord - 1, zCoord ) instanceof TileController
&& worldObj.getTileEntity( xCoord, yCoord + 1, zCoord ) instanceof TileController;
boolean zz = worldObj.getTileEntity( xCoord, yCoord, zCoord - 1 ) instanceof TileController
&& worldObj.getTileEntity( xCoord, yCoord, zCoord + 1 ) instanceof TileController;
boolean xx = this.worldObj.getTileEntity( this.xCoord - 1, this.yCoord, this.zCoord ) instanceof TileController
&& this.worldObj.getTileEntity( this.xCoord + 1, this.yCoord, this.zCoord ) instanceof TileController;
boolean yy = this.worldObj.getTileEntity( this.xCoord, this.yCoord - 1, this.zCoord ) instanceof TileController
&& this.worldObj.getTileEntity( this.xCoord, this.yCoord + 1, this.zCoord ) instanceof TileController;
boolean zz = this.worldObj.getTileEntity( this.xCoord, this.yCoord, this.zCoord - 1 ) instanceof TileController
&& this.worldObj.getTileEntity( this.xCoord, this.yCoord, this.zCoord + 1 ) instanceof TileController;
// int meta = world.getBlockMetadata( xCoord, yCoord, zCoord );
// boolean hasPower = meta > 0;
// boolean isConflict = meta == 2;
boolean oldValid = isValid;
boolean oldValid = this.isValid;
isValid = (xx && !yy && !zz) || (!xx && yy && !zz) || (!xx && !yy && zz) || ((xx ? 1 : 0) + (yy ? 1 : 0) + (zz ? 1 : 0) <= 1);
this.isValid = (xx && !yy && !zz) || (!xx && yy && !zz) || (!xx && !yy && zz) || ((xx ? 1 : 0) + (yy ? 1 : 0) + (zz ? 1 : 0) <= 1);
if ( oldValid != isValid || force )
if ( oldValid != this.isValid || force )
{
if ( isValid )
gridProxy.setValidSides( EnumSet.allOf( ForgeDirection.class ) );
if ( this.isValid )
this.gridProxy.setValidSides( EnumSet.allOf( ForgeDirection.class ) );
else
gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
}
updateMeta();
this.updateMeta();
}
private void updateMeta()
{
if ( !gridProxy.isReady() )
if ( !this.gridProxy.isReady() )
return;
int meta = 0;
try
{
if ( gridProxy.getEnergy().isNetworkPowered() )
if ( this.gridProxy.getEnergy().isNetworkPowered() )
{
meta = 1;
if ( gridProxy.getPath().getControllerState() == ControllerState.CONTROLLER_CONFLICT )
if ( this.gridProxy.getPath().getControllerState() == ControllerState.CONTROLLER_CONFLICT )
meta = 2;
}
}
@@ -168,7 +168,7 @@ public class TileController extends AENetworkPowerTile
meta = 0;
}
worldObj.setBlockMetadataWithNotify( xCoord, yCoord, zCoord, meta, 2 );
this.worldObj.setBlockMetadataWithNotify( this.xCoord, this.yCoord, this.zCoord, meta, 2 );
}
final int sides[] = new int[] {};
@@ -189,7 +189,7 @@ public class TileController extends AENetworkPowerTile
@Override
public int[] getAccessibleSlotsBySide(ForgeDirection side)
{
return sides;
return this.sides;
}
}
@@ -30,7 +30,7 @@ public class TileCreativeEnergyCell extends AENetworkTile implements IAEPowerSto
{
public TileCreativeEnergyCell() {
gridProxy.setIdlePowerUsage( 0 );
this.gridProxy.setIdlePowerUsage( 0 );
}
@Override
@@ -22,7 +22,7 @@ public class TileDenseEnergyCell extends TileEnergyCell
{
public TileDenseEnergyCell() {
internalMaxPower = 200000 * 8;
this.internalMaxPower = 200000 * 8;
}
}
@@ -47,16 +47,16 @@ public class TileEnergyAcceptor extends AENetworkPowerTile
@TileEvent(TileEventType.TICK)
public void Tick_TileEnergyAcceptor()
{
if ( internalCurrentPower > 0 )
if ( this.internalCurrentPower > 0 )
{
try
{
IEnergyGrid eg = gridProxy.getEnergy();
double powerRequested = internalCurrentPower - eg.injectPower( internalCurrentPower, Actionable.SIMULATE );
IEnergyGrid eg = this.gridProxy.getEnergy();
double powerRequested = this.internalCurrentPower - eg.injectPower( this.internalCurrentPower, Actionable.SIMULATE );
if ( powerRequested > 0 )
{
eg.injectPower( extractAEPower( powerRequested, Actionable.MODULATE, PowerMultiplier.ONE ), Actionable.MODULATE );
eg.injectPower( this.extractAEPower( powerRequested, Actionable.MODULATE, PowerMultiplier.ONE ), Actionable.MODULATE );
}
}
catch (GridAccessException e)
@@ -72,7 +72,7 @@ public class TileEnergyAcceptor extends AENetworkPowerTile
{
try
{
IEnergyGrid grid = gridProxy.getEnergy();
IEnergyGrid grid = this.gridProxy.getEnergy();
return grid.getEnergyDemand( maxRequired );
}
catch (GridAccessException e)
@@ -86,7 +86,7 @@ public class TileEnergyAcceptor extends AENetworkPowerTile
{
try
{
IEnergyGrid grid = gridProxy.getEnergy();
IEnergyGrid grid = this.gridProxy.getEnergy();
double leftOver = grid.injectPower( newPower, mode );
if ( mode == Actionable.SIMULATE )
return leftOver;
@@ -99,8 +99,8 @@ public class TileEnergyAcceptor extends AENetworkPowerTile
}
public TileEnergyAcceptor() {
gridProxy.setIdlePowerUsage( 0.0 );
internalMaxPower = 100;
this.gridProxy.setIdlePowerUsage( 0.0 );
this.internalMaxPower = 100;
}
@Override
@@ -118,7 +118,7 @@ public class TileEnergyAcceptor extends AENetworkPowerTile
@Override
public int[] getAccessibleSlotsBySide(ForgeDirection side)
{
return sides;
return this.sides;
}
}
@@ -49,38 +49,38 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
private void changePowerLevel()
{
if ( notLoaded() )
if ( this.notLoaded() )
return;
byte boundMetadata = (byte) (8.0 * (internalCurrentPower / internalMaxPower));
byte boundMetadata = (byte) (8.0 * (this.internalCurrentPower / this.internalMaxPower));
if ( boundMetadata > 7 )
boundMetadata = 7;
if ( boundMetadata < 0 )
boundMetadata = 0;
if ( currentMeta != boundMetadata )
if ( this.currentMeta != boundMetadata )
{
currentMeta = boundMetadata;
worldObj.setBlockMetadataWithNotify( xCoord, yCoord, zCoord, currentMeta, 2 );
this.currentMeta = boundMetadata;
this.worldObj.setBlockMetadataWithNotify( this.xCoord, this.yCoord, this.zCoord, this.currentMeta, 2 );
}
}
@TileEvent(TileEventType.WORLD_NBT_WRITE)
public void writeToNBT_TileEnergyCell(NBTTagCompound data)
{
if ( !worldObj.isRemote )
data.setDouble( "internalCurrentPower", internalCurrentPower );
if ( !this.worldObj.isRemote )
data.setDouble( "internalCurrentPower", this.internalCurrentPower );
}
@TileEvent(TileEventType.WORLD_NBT_READ)
public void readFromNBT_TileEnergyCell(NBTTagCompound data)
{
internalCurrentPower = data.getDouble( "internalCurrentPower" );
this.internalCurrentPower = data.getDouble( "internalCurrentPower" );
}
public TileEnergyCell() {
gridProxy.setIdlePowerUsage( 0 );
this.gridProxy.setIdlePowerUsage( 0 );
}
@Override
@@ -94,29 +94,29 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
{
if ( mode == Actionable.SIMULATE )
{
double fakeBattery = internalCurrentPower + amt;
if ( fakeBattery > internalMaxPower )
double fakeBattery = this.internalCurrentPower + amt;
if ( fakeBattery > this.internalMaxPower )
{
return fakeBattery - internalMaxPower;
return fakeBattery - this.internalMaxPower;
}
return 0;
}
if ( internalCurrentPower < 0.01 && amt > 0.01 )
gridProxy.getNode().getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.PROVIDE_POWER ) );
if ( this.internalCurrentPower < 0.01 && amt > 0.01 )
this.gridProxy.getNode().getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.PROVIDE_POWER ) );
internalCurrentPower += amt;
if ( internalCurrentPower > internalMaxPower )
this.internalCurrentPower += amt;
if ( this.internalCurrentPower > this.internalMaxPower )
{
amt = internalCurrentPower - internalMaxPower;
internalCurrentPower = internalMaxPower;
amt = this.internalCurrentPower - this.internalMaxPower;
this.internalCurrentPower = this.internalMaxPower;
changePowerLevel();
this.changePowerLevel();
return amt;
}
changePowerLevel();
this.changePowerLevel();
return 0;
}
@@ -124,18 +124,18 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
{
if ( mode == Actionable.SIMULATE )
{
if ( internalCurrentPower > amt )
if ( this.internalCurrentPower > amt )
return amt;
return internalCurrentPower;
return this.internalCurrentPower;
}
boolean wasFull = internalCurrentPower >= internalMaxPower - 0.001;
boolean wasFull = this.internalCurrentPower >= this.internalMaxPower - 0.001;
if ( wasFull && amt > 0.001 )
{
try
{
gridProxy.getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) );
this.gridProxy.getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) );
}
catch (GridAccessException ignored)
{
@@ -143,37 +143,37 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
}
}
if ( internalCurrentPower > amt )
if ( this.internalCurrentPower > amt )
{
internalCurrentPower -= amt;
this.internalCurrentPower -= amt;
changePowerLevel();
this.changePowerLevel();
return amt;
}
amt = internalCurrentPower;
internalCurrentPower = 0;
amt = this.internalCurrentPower;
this.internalCurrentPower = 0;
changePowerLevel();
this.changePowerLevel();
return amt;
}
@Override
final public double extractAEPower(double amt, Actionable mode, PowerMultiplier pm)
{
return pm.divide( extractAEPower( pm.multiply( amt ), mode ) );
return pm.divide( this.extractAEPower( pm.multiply( amt ), mode ) );
}
@Override
public double getAEMaxPower()
{
return internalMaxPower;
return this.internalMaxPower;
}
@Override
public double getAECurrentPower()
{
return internalCurrentPower;
return this.internalCurrentPower;
}
@Override
@@ -192,8 +192,8 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
public void onReady()
{
super.onReady();
currentMeta = (byte) worldObj.getBlockMetadata( xCoord, yCoord, zCoord );
changePowerLevel();
this.currentMeta = (byte) this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord );
this.changePowerLevel();
}
@Override
@@ -202,8 +202,8 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
if ( from == SettingsFrom.DISMANTLE_ITEM )
{
NBTTagCompound tag = new NBTTagCompound();
tag.setDouble( "internalCurrentPower", internalCurrentPower );
tag.setDouble( "internalMaxPower", internalMaxPower ); // used for tool tip.
tag.setDouble( "internalCurrentPower", this.internalCurrentPower );
tag.setDouble( "internalMaxPower", this.internalMaxPower ); // used for tool tip.
return tag;
}
return null;
@@ -214,7 +214,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
{
if ( from == SettingsFrom.DISMANTLE_ITEM )
{
internalCurrentPower = compound.getDouble( "internalCurrentPower" );
this.internalCurrentPower = compound.getDouble( "internalCurrentPower" );
}
}
}
@@ -61,57 +61,57 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
public TileWireless()
{
gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
}
@Override
public void setOrientation( ForgeDirection inForward, ForgeDirection inUp )
{
super.setOrientation( inForward, inUp );
gridProxy.setValidSides( EnumSet.of( getForward().getOpposite() ) );
this.gridProxy.setValidSides( EnumSet.of( this.getForward().getOpposite() ) );
}
@MENetworkEventSubscribe
public void chanRender( MENetworkChannelsChanged c )
{
markForUpdate();
this.markForUpdate();
}
@MENetworkEventSubscribe
public void powerRender( MENetworkPowerStatusChange c )
{
markForUpdate();
this.markForUpdate();
}
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileWireless( ByteBuf data )
{
int old = clientFlags;
clientFlags = data.readByte();
int old = this.clientFlags;
this.clientFlags = data.readByte();
return old != clientFlags;
return old != this.clientFlags;
}
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileWireless( ByteBuf data )
{
clientFlags = 0;
this.clientFlags = 0;
try
{
if ( gridProxy.getEnergy().isNetworkPowered() )
clientFlags |= POWERED_FLAG;
if ( this.gridProxy.getEnergy().isNetworkPowered() )
this.clientFlags |= POWERED_FLAG;
if ( gridProxy.getNode().meetsChannelRequirements() )
clientFlags |= CHANNEL_FLAG;
if ( this.gridProxy.getNode().meetsChannelRequirements() )
this.clientFlags |= CHANNEL_FLAG;
}
catch ( GridAccessException e )
{
// meh
}
data.writeByte( ( byte ) clientFlags );
data.writeByte( ( byte ) this.clientFlags );
}
@Override
@@ -129,46 +129,46 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
@Override
public IInventory getInternalInventory()
{
return inv;
return this.inv;
}
@Override
public void onReady()
{
updatePower();
this.updatePower();
super.onReady();
}
@Override
public void markDirty()
{
updatePower();
this.updatePower();
}
private void updatePower()
{
gridProxy.setIdlePowerUsage( AEConfig.instance.wireless_getPowerDrain( getBoosters() ) );
this.gridProxy.setIdlePowerUsage( AEConfig.instance.wireless_getPowerDrain( this.getBoosters() ) );
}
@Override
public int[] getAccessibleSlotsBySide( ForgeDirection side )
{
return sides;
return this.sides;
}
@Override
public double getRange()
{
return AEConfig.instance.wireless_getMaxRange( getBoosters() );
return AEConfig.instance.wireless_getMaxRange( this.getBoosters() );
}
@Override
public boolean isActive()
{
if ( Platform.isClient() )
return isPowered() && ( CHANNEL_FLAG == ( clientFlags & CHANNEL_FLAG ) );
return this.isPowered() && ( CHANNEL_FLAG == ( this.clientFlags & CHANNEL_FLAG ) );
return gridProxy.isActive();
return this.gridProxy.isActive();
}
@Override
@@ -176,7 +176,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
{
try
{
return gridProxy.getGrid();
return this.gridProxy.getGrid();
}
catch ( GridAccessException e )
{
@@ -186,7 +186,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
private int getBoosters()
{
ItemStack boosters = inv.getStackInSlot( 0 );
ItemStack boosters = this.inv.getStackInSlot( 0 );
return boosters == null ? 0 : boosters.stackSize;
}
@@ -205,7 +205,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
@Override
public boolean isPowered()
{
return POWERED_FLAG == ( clientFlags & POWERED_FLAG );
return POWERED_FLAG == ( this.clientFlags & POWERED_FLAG );
}
}
@@ -49,45 +49,45 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
protected void setPowerSides(EnumSet<ForgeDirection> sides)
{
internalPowerSides = sides;
this.internalPowerSides = sides;
// trigger re-calc!
}
protected EnumSet<ForgeDirection> getPowerSides()
{
return internalPowerSides.clone();
return this.internalPowerSides.clone();
}
@TileEvent(TileEventType.WORLD_NBT_WRITE)
public void writeToNBT_AERootPoweredTile(NBTTagCompound data)
{
data.setDouble( "internalCurrentPower", internalCurrentPower );
data.setDouble( "internalCurrentPower", this.internalCurrentPower );
}
@TileEvent(TileEventType.WORLD_NBT_READ)
public void readFromNBT_AERootPoweredTile(NBTTagCompound data)
{
internalCurrentPower = data.getDouble( "internalCurrentPower" );
this.internalCurrentPower = data.getDouble( "internalCurrentPower" );
}
final protected double getExternalPowerDemand(PowerUnits externalUnit, double maxPowerRequired)
{
return PowerUnits.AE.convertTo( externalUnit, Math.max( 0.0, getFunnelPowerDemand( externalUnit.convertTo( PowerUnits.AE, maxPowerRequired ) ) ) );
return PowerUnits.AE.convertTo( externalUnit, Math.max( 0.0, this.getFunnelPowerDemand( externalUnit.convertTo( PowerUnits.AE, maxPowerRequired ) ) ) );
}
protected double getFunnelPowerDemand(double maxRequired)
{
return internalMaxPower - internalCurrentPower;
return this.internalMaxPower - this.internalCurrentPower;
}
final public double injectExternalPower(PowerUnits input, double amt)
{
return PowerUnits.AE.convertTo( input, funnelPowerIntoStorage( input.convertTo( PowerUnits.AE, amt ), Actionable.MODULATE ) );
return PowerUnits.AE.convertTo( input, this.funnelPowerIntoStorage( input.convertTo( PowerUnits.AE, amt ), Actionable.MODULATE ) );
}
protected double funnelPowerIntoStorage(double AEUnits, Actionable mode)
{
return injectAEPower( AEUnits, mode );
return this.injectAEPower( AEUnits, mode );
}
@Override
@@ -98,23 +98,23 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
if ( mode == Actionable.SIMULATE )
{
double fakeBattery = internalCurrentPower + amt;
double fakeBattery = this.internalCurrentPower + amt;
if ( fakeBattery > internalMaxPower )
return fakeBattery - internalMaxPower;
if ( fakeBattery > this.internalMaxPower )
return fakeBattery - this.internalMaxPower;
return 0;
}
else
{
if ( internalCurrentPower < 0.01 && amt > 0.01 )
PowerEvent( PowerEventType.PROVIDE_POWER );
if ( this.internalCurrentPower < 0.01 && amt > 0.01 )
this.PowerEvent( PowerEventType.PROVIDE_POWER );
internalCurrentPower += amt;
if ( internalCurrentPower > internalMaxPower )
this.internalCurrentPower += amt;
if ( this.internalCurrentPower > this.internalMaxPower )
{
amt = internalCurrentPower - internalMaxPower;
internalCurrentPower = internalMaxPower;
amt = this.internalCurrentPower - this.internalMaxPower;
this.internalCurrentPower = this.internalMaxPower;
return amt;
}
@@ -131,55 +131,55 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
{
if ( mode == Actionable.SIMULATE )
{
if ( internalCurrentPower > amt )
if ( this.internalCurrentPower > amt )
return amt;
return internalCurrentPower;
return this.internalCurrentPower;
}
boolean wasFull = internalCurrentPower >= internalMaxPower - 0.001;
boolean wasFull = this.internalCurrentPower >= this.internalMaxPower - 0.001;
if ( wasFull && amt > 0.001 )
{
PowerEvent( PowerEventType.REQUEST_POWER );
this.PowerEvent( PowerEventType.REQUEST_POWER );
}
if ( internalCurrentPower > amt )
if ( this.internalCurrentPower > amt )
{
internalCurrentPower -= amt;
this.internalCurrentPower -= amt;
return amt;
}
amt = internalCurrentPower;
internalCurrentPower = 0;
amt = this.internalCurrentPower;
this.internalCurrentPower = 0;
return amt;
}
@Override
final public double extractAEPower(double amt, Actionable mode, PowerMultiplier multiplier)
{
return multiplier.divide( extractAEPower( multiplier.multiply( amt ), mode ) );
return multiplier.divide( this.extractAEPower( multiplier.multiply( amt ), mode ) );
}
@Override
final public double getAEMaxPower()
{
return internalMaxPower;
return this.internalMaxPower;
}
@Override
final public double getAECurrentPower()
{
return internalCurrentPower;
return this.internalCurrentPower;
}
@Override
final public boolean isAEPublicPowerStorage()
{
return internalPublicPowerStorage;
return this.internalPublicPowerStorage;
}
@Override
final public AccessRestriction getPowerFlow()
{
return internalPowerFlow;
return this.internalPowerFlow;
}
}
+13 -13
View File
@@ -40,13 +40,13 @@ public abstract class IC2 extends MinecraftJoules6 implements IEnergySink
@Override
final public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction)
{
return getPowerSides().contains( direction );
return this.getPowerSides().contains( direction );
}
@Override
final public double getDemandedEnergy()
{
return getExternalPowerDemand( PowerUnits.EU, Double.MAX_VALUE );
return this.getExternalPowerDemand( PowerUnits.EU, Double.MAX_VALUE );
}
@Override
@@ -54,8 +54,8 @@ public abstract class IC2 extends MinecraftJoules6 implements IEnergySink
{
// just store the excess in the current block, if I return the waste,
// IC2 will just disintegrate it - Oct 20th 2013
double overflow = PowerUnits.EU.convertTo( PowerUnits.AE, injectExternalPower( PowerUnits.EU, amount ) );
internalCurrentPower += overflow;
double overflow = PowerUnits.EU.convertTo( PowerUnits.AE, this.injectExternalPower( PowerUnits.EU, amount ) );
this.internalCurrentPower += overflow;
return 0; // see above comment.
}
@@ -69,29 +69,29 @@ public abstract class IC2 extends MinecraftJoules6 implements IEnergySink
public void invalidate()
{
super.invalidate();
removeFromENet();
this.removeFromENet();
}
@Override
public void onChunkUnload()
{
super.onChunkUnload();
removeFromENet();
this.removeFromENet();
}
@Override
public void onReady()
{
super.onReady();
addToENet();
this.addToENet();
}
@Override
protected void setPowerSides(EnumSet<ForgeDirection> sides)
{
super.setPowerSides( sides );
removeFromENet();
addToENet();
this.removeFromENet();
this.addToENet();
}
private void addToENet()
@@ -99,10 +99,10 @@ public abstract class IC2 extends MinecraftJoules6 implements IEnergySink
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.IC2 ) )
{
IIC2 ic2Integration = (IIC2) AppEng.instance.getIntegration( IntegrationType.IC2 );
if ( !isInIC2 && Platform.isServer() && ic2Integration != null )
if ( !this.isInIC2 && Platform.isServer() && ic2Integration != null )
{
ic2Integration.addToEnergyNet( this );
isInIC2 = true;
this.isInIC2 = true;
}
}
}
@@ -112,10 +112,10 @@ public abstract class IC2 extends MinecraftJoules6 implements IEnergySink
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.IC2 ) )
{
IIC2 ic2Integration = (IIC2) AppEng.instance.getIntegration( IntegrationType.IC2 );
if ( isInIC2 && Platform.isServer() && ic2Integration != null )
if ( this.isInIC2 && Platform.isServer() && ic2Integration != null )
{
ic2Integration.removeFromEnergyNet( this );
isInIC2 = false;
this.isInIC2 = false;
}
}
}
@@ -33,8 +33,8 @@ public abstract class MekJoules extends RedstoneFlux implements IStrictEnergyAcc
@Override
public void setEnergy(double energy) {
double extra = injectExternalPower( PowerUnits.MK, energy );
internalCurrentPower += PowerUnits.MK.convertTo(PowerUnits.AE, extra );
double extra = this.injectExternalPower( PowerUnits.MK, energy );
this.internalCurrentPower += PowerUnits.MK.convertTo(PowerUnits.AE, extra );
}
@Override
@@ -45,17 +45,17 @@ public abstract class MekJoules extends RedstoneFlux implements IStrictEnergyAcc
@Override
public double transferEnergyToAcceptor(ForgeDirection side, double amount)
{
double demand = getExternalPowerDemand( PowerUnits.MK, Double.MAX_VALUE );
double demand = this.getExternalPowerDemand( PowerUnits.MK, Double.MAX_VALUE );
if ( amount > demand )
amount = demand;
double overflow = injectExternalPower( PowerUnits.MK, amount );
double overflow = this.injectExternalPower( PowerUnits.MK, amount );
return amount - overflow;
}
@Override
public boolean canReceiveEnergy(ForgeDirection side) {
return getPowerSides().contains(side);
return this.getPowerSides().contains(side);
}
}
@@ -44,8 +44,8 @@ public abstract class MinecraftJoules5 extends AERootPoweredTile implements IPow
@TileEvent(TileEventType.TICK)
public void Tick_MinecraftJoules5()
{
if ( bcPowerWrapper != null )
bcPowerWrapper.Tick();
if ( this.bcPowerWrapper != null )
this.bcPowerWrapper.Tick();
}
public MinecraftJoules5() {
@@ -58,9 +58,9 @@ public abstract class MinecraftJoules5 extends AERootPoweredTile implements IPow
IMJ5 mjIntegration = (IMJ5) AppEng.instance.getIntegration( IntegrationType.MJ5 );
if ( mjIntegration != null )
{
bcPowerWrapper = (BaseMJPerdition) mjIntegration.createPerdition( this );
if ( bcPowerWrapper != null )
bcPowerWrapper.configure( 1, 380, 1.0f / 5.0f, 1000 );
this.bcPowerWrapper = (BaseMJPerdition) mjIntegration.createPerdition( this );
if ( this.bcPowerWrapper != null )
this.bcPowerWrapper.configure( 1, 380, 1.0f / 5.0f, 1000 );
}
}
}
@@ -75,8 +75,8 @@ public abstract class MinecraftJoules5 extends AERootPoweredTile implements IPow
@Method(iname = "MJ5")
final public PowerReceiver getPowerReceiver(ForgeDirection side)
{
if ( getPowerSides().contains( side ) && bcPowerWrapper != null )
return bcPowerWrapper.getPowerReceiver();
if ( this.getPowerSides().contains( side ) && this.bcPowerWrapper != null )
return this.bcPowerWrapper.getPowerReceiver();
return null;
}
@@ -84,17 +84,17 @@ public abstract class MinecraftJoules5 extends AERootPoweredTile implements IPow
@Method(iname = "MJ5")
final public void doWork(PowerHandler workProvider)
{
float required = (float) getExternalPowerDemand( PowerUnits.MJ, bcPowerWrapper.getPowerReceiver().getEnergyStored() );
double failed = injectExternalPower( PowerUnits.MJ, bcPowerWrapper.useEnergy( 0.0f, required, true ) );
float required = (float) this.getExternalPowerDemand( PowerUnits.MJ, this.bcPowerWrapper.getPowerReceiver().getEnergyStored() );
double failed = this.injectExternalPower( PowerUnits.MJ, this.bcPowerWrapper.useEnergy( 0.0f, required, true ) );
if ( failed > 0.01 )
bcPowerWrapper.addEnergy( (float) failed );
this.bcPowerWrapper.addEnergy( (float) failed );
}
@Override
@Method(iname = "MJ5")
final public World getWorld()
{
return worldObj;
return this.worldObj;
}
}
@@ -41,18 +41,18 @@ public abstract class MinecraftJoules6 extends MinecraftJoules5 implements IBatt
@Method(iname = "MJ6")
public double getEnergyRequested()
{
return getExternalPowerDemand( PowerUnits.MJ, Double.MAX_VALUE );
return this.getExternalPowerDemand( PowerUnits.MJ, Double.MAX_VALUE );
}
@Override
@Method(iname = "MJ6")
public double addEnergy(double amount)
{
double demand = getExternalPowerDemand( PowerUnits.MJ, Double.MAX_VALUE );
double demand = this.getExternalPowerDemand( PowerUnits.MJ, Double.MAX_VALUE );
if ( amount > demand )
amount = demand;
double overflow = injectExternalPower( PowerUnits.MJ, amount );
double overflow = this.injectExternalPower( PowerUnits.MJ, amount );
return amount - overflow;
}
@@ -60,7 +60,7 @@ public abstract class MinecraftJoules6 extends MinecraftJoules5 implements IBatt
@Method(iname = "MJ6")
public double addEnergy(double amount, boolean ignoreCycleLimit)
{
double overflow = injectExternalPower( PowerUnits.MJ, amount );
double overflow = this.injectExternalPower( PowerUnits.MJ, amount );
return amount - overflow;
}
@@ -68,21 +68,21 @@ public abstract class MinecraftJoules6 extends MinecraftJoules5 implements IBatt
@Method(iname = "MJ6")
public double getEnergyStored()
{
return PowerUnits.AE.convertTo( PowerUnits.MJ, internalCurrentPower );
return PowerUnits.AE.convertTo( PowerUnits.MJ, this.internalCurrentPower );
}
@Override
@Method(iname = "MJ6")
public void setEnergyStored(double mj)
{
internalCurrentPower = PowerUnits.MJ.convertTo( PowerUnits.AE, mj );
this.internalCurrentPower = PowerUnits.MJ.convertTo( PowerUnits.AE, mj );
}
@Override
@Method(iname = "MJ6")
public double maxCapacity()
{
return PowerUnits.AE.convertTo( PowerUnits.MJ, internalMaxPower );
return PowerUnits.AE.convertTo( PowerUnits.MJ, this.internalMaxPower );
}
@Override
@@ -103,7 +103,7 @@ public abstract class MinecraftJoules6 extends MinecraftJoules5 implements IBatt
@Method(iname = "MJ6")
public IBatteryObject reconfigure(double maxCapacity, double maxReceivedPerCycle, double minimumConsumption)
{
return getMjBattery( "" );
return this.getMjBattery( "" );
}
@Override
@@ -40,26 +40,26 @@ public abstract class RotaryCraft extends IC2 implements ShaftPowerReceiver
@Method(iname = "RotaryCraft")
public void Tick_RotaryCraft()
{
if ( worldObj != null && !worldObj.isRemote && power > 0 )
injectExternalPower( PowerUnits.WA, power );
if ( this.worldObj != null && !this.worldObj.isRemote && this.power > 0 )
this.injectExternalPower( PowerUnits.WA, this.power );
}
@Override
final public int getOmega()
{
return omega;
return this.omega;
}
@Override
final public int getTorque()
{
return torque;
return this.torque;
}
@Override
final public long getPower()
{
return power;
return this.power;
}
@Override
@@ -71,44 +71,44 @@ public abstract class RotaryCraft extends IC2 implements ShaftPowerReceiver
@Override
final public int getIORenderAlpha()
{
return alpha;
return this.alpha;
}
@Override
final public void setIORenderAlpha(int io)
{
alpha = io;
this.alpha = io;
}
@Override
final public int getMachineX()
{
return xCoord;
return this.xCoord;
}
@Override
final public int getMachineY()
{
return yCoord;
return this.yCoord;
}
@Override
final public int getMachineZ()
{
return zCoord;
return this.zCoord;
}
@Override
final public void setOmega(int o)
{
omega = o;
this.omega = o;
}
@Override
final public void setTorque(int t)
{
torque = t;
this.torque = t;
}
@Override
@@ -117,27 +117,27 @@ public abstract class RotaryCraft extends IC2 implements ShaftPowerReceiver
if ( Platform.isClient() )
return;
power = p;
this.power = p;
}
final public boolean canReadFromBlock(int x, int y, int z)
{
ForgeDirection side = ForgeDirection.UNKNOWN;
if ( x == xCoord - 1 )
if ( x == this.xCoord - 1 )
side = ForgeDirection.WEST;
else if ( x == xCoord + 1 )
else if ( x == this.xCoord + 1 )
side = ForgeDirection.EAST;
else if ( z == zCoord - 1 )
else if ( z == this.zCoord - 1 )
side = ForgeDirection.NORTH;
else if ( z == zCoord + 1 )
else if ( z == this.zCoord + 1 )
side = ForgeDirection.SOUTH;
else if ( y == yCoord - 1 )
else if ( y == this.yCoord - 1 )
side = ForgeDirection.DOWN;
else if ( y == yCoord + 1 )
else if ( y == this.yCoord + 1 )
side = ForgeDirection.UP;
return getPowerSides().contains( side );
return this.getPowerSides().contains( side );
}
@Override
@@ -149,15 +149,15 @@ public abstract class RotaryCraft extends IC2 implements ShaftPowerReceiver
@Override
final public void noInputMachine()
{
power = 0;
torque = 0;
omega = 0;
this.power = 0;
this.torque = 0;
this.omega = 0;
}
@Override
final public boolean canReadFrom(ForgeDirection side)
{
return getPowerSides().contains( side );
return this.getPowerSides().contains( side );
}
@Override
@@ -70,25 +70,25 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
@TileEvent(TileEventType.TICK)
public void Tick_TileQuantumBridge()
{
if ( updateStatus )
if ( this.updateStatus )
{
updateStatus = false;
if ( cluster != null )
cluster.updateStatus( true );
markForUpdate();
this.updateStatus = false;
if ( this.cluster != null )
this.cluster.updateStatus( true );
this.markForUpdate();
}
}
@TileEvent(TileEventType.NETWORK_WRITE)
public void writeToStream_TileQuantumBridge(ByteBuf data)
{
int out = constructed;
int out = this.constructed;
if ( getStackInSlot( 0 ) != null && constructed != -1 )
out = out | hasSingularity;
if ( this.getStackInSlot( 0 ) != null && this.constructed != -1 )
out = out | this.hasSingularity;
if ( gridProxy.isActive() && constructed != -1 )
out = out | powered;
if ( this.gridProxy.isActive() && this.constructed != -1 )
out = out | this.powered;
data.writeByte( (byte) out );
}
@@ -96,121 +96,121 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
@TileEvent(TileEventType.NETWORK_READ)
public boolean readFromStream_TileQuantumBridge(ByteBuf data)
{
int oldValue = constructed;
constructed = data.readByte();
bridgePowered = (constructed | powered) == powered;
return constructed != oldValue;
int oldValue = this.constructed;
this.constructed = data.readByte();
this.bridgePowered = (this.constructed | this.powered) == this.powered;
return this.constructed != oldValue;
}
public TileQuantumBridge() {
gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
gridProxy.setFlags( GridFlags.DENSE_CAPACITY );
gridProxy.setIdlePowerUsage( 22 );
inv.setMaxStackSize( 1 );
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.gridProxy.setFlags( GridFlags.DENSE_CAPACITY );
this.gridProxy.setIdlePowerUsage( 22 );
this.inv.setMaxStackSize( 1 );
}
@Override
public IInventory getInternalInventory()
{
return inv;
return this.inv;
}
@MENetworkEventSubscribe
public void PowerSwitch(MENetworkPowerStatusChange c)
{
updateStatus = true;
this.updateStatus = true;
}
@Override
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added)
{
if ( cluster != null )
cluster.updateStatus( true );
if ( this.cluster != null )
this.cluster.updateStatus( true );
}
@Override
public int[] getAccessibleSlotsBySide(ForgeDirection side)
{
if ( isCenter() )
return sidesLink;
return sidesRing;
if ( this.isCenter() )
return this.sidesLink;
return this.sidesRing;
}
@Override
public void disconnect(boolean affectWorld)
{
if ( cluster != null )
if ( this.cluster != null )
{
if ( !affectWorld )
cluster.updateStatus = false;
this.cluster.updateStatus = false;
cluster.destroy();
this.cluster.destroy();
}
cluster = null;
this.cluster = null;
if ( affectWorld )
gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
}
@Override
public IAECluster getCluster()
{
return cluster;
return this.cluster;
}
@Override
public boolean isValid()
{
return !isInvalid();
return !this.isInvalid();
}
@Override
public void onReady()
{
super.onReady();
if ( worldObj.getBlock( xCoord, yCoord, zCoord ) == AEApi.instance().blocks().blockQuantumRing.block() )
gridProxy.setVisualRepresentation( ring );
if ( this.worldObj.getBlock( this.xCoord, this.yCoord, this.zCoord ) == AEApi.instance().blocks().blockQuantumRing.block() )
this.gridProxy.setVisualRepresentation( ring );
}
@Override
public void invalidate()
{
disconnect( false );
this.disconnect( false );
super.invalidate();
}
@Override
public void onChunkUnload()
{
disconnect( false );
this.disconnect( false );
super.onChunkUnload();
}
public void updateStatus(QuantumCluster c, byte flags, boolean affectWorld)
{
cluster = c;
this.cluster = c;
if ( affectWorld )
{
if ( constructed != flags )
if ( this.constructed != flags )
{
constructed = flags;
markForUpdate();
this.constructed = flags;
this.markForUpdate();
}
if ( isCorner() || isCenter() )
if ( this.isCorner() || this.isCenter() )
{
gridProxy.setValidSides( getConnections() );
this.gridProxy.setValidSides( this.getConnections() );
}
else
gridProxy.setValidSides( EnumSet.allOf( ForgeDirection.class ) );
this.gridProxy.setValidSides( EnumSet.allOf( ForgeDirection.class ) );
}
}
public long getQEFrequency()
{
ItemStack is = inv.getStackInSlot( 0 );
ItemStack is = this.inv.getStackInSlot( 0 );
if ( is != null )
{
NBTTagCompound c = is.getTagCompound();
@@ -222,22 +222,22 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
public boolean isCenter()
{
return getBlockType() == AEApi.instance().blocks().blockQuantumLink.block();
return this.getBlockType() == AEApi.instance().blocks().blockQuantumLink.block();
}
public boolean isCorner()
{
return (constructed & corner) == corner && constructed != -1;
return (this.constructed & this.corner) == this.corner && this.constructed != -1;
}
public boolean isPowered()
{
if ( Platform.isClient() )
return (constructed & powered) == powered && constructed != -1;
return (this.constructed & this.powered) == this.powered && this.constructed != -1;
try
{
return gridProxy.getEnergy().isNetworkPowered();
return this.gridProxy.getEnergy().isNetworkPowered();
}
catch (GridAccessException e)
{
@@ -249,7 +249,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
public boolean isFormed()
{
return constructed != -1;
return this.constructed != -1;
}
@Override
@@ -266,7 +266,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
public void neighborUpdate()
{
calc.calculateMultiblock( worldObj, getLocation() );
this.calc.calculateMultiblock( this.worldObj, this.getLocation() );
}
public EnumSet<ForgeDirection> getConnections()
@@ -275,7 +275,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS)
{
TileEntity te = worldObj.getTileEntity( xCoord + d.offsetX, yCoord + d.offsetY, zCoord + d.offsetZ );
TileEntity te = this.worldObj.getTileEntity( this.xCoord + d.offsetX, this.yCoord + d.offsetY, this.zCoord + d.offsetZ );
if ( te instanceof TileQuantumBridge )
set.add( d );
}
@@ -285,15 +285,15 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
public boolean hasQES()
{
if ( constructed == -1 )
if ( this.constructed == -1 )
return false;
return (constructed & hasSingularity) == hasSingularity;
return (this.constructed & this.hasSingularity) == this.hasSingularity;
}
public void breakCluster()
{
if ( cluster != null )
cluster.destroy();
if ( this.cluster != null )
this.cluster.destroy();
}
}
@@ -56,45 +56,45 @@ public class TileSpatialIOPort extends AENetworkInvTile implements Callable
@TileEvent(TileEventType.WORLD_NBT_WRITE)
public void writeToNBT_TileSpatialIOPort(NBTTagCompound data)
{
data.setInteger( "lastRedstoneState", lastRedstoneState.ordinal() );
data.setInteger( "lastRedstoneState", this.lastRedstoneState.ordinal() );
}
@TileEvent(TileEventType.WORLD_NBT_READ)
public void readFromNBT_TileSpatialIOPort(NBTTagCompound data)
{
if ( data.hasKey( "lastRedstoneState" ) )
lastRedstoneState = YesNo.values()[data.getInteger( "lastRedstoneState" )];
this.lastRedstoneState = YesNo.values()[data.getInteger( "lastRedstoneState" )];
}
public TileSpatialIOPort() {
gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
}
public void updateRedstoneState()
{
YesNo currentState = worldObj.isBlockIndirectlyGettingPowered( xCoord, yCoord, zCoord ) ? YesNo.YES : YesNo.NO;
if ( lastRedstoneState != currentState )
YesNo currentState = this.worldObj.isBlockIndirectlyGettingPowered( this.xCoord, this.yCoord, this.zCoord ) ? YesNo.YES : YesNo.NO;
if ( this.lastRedstoneState != currentState )
{
lastRedstoneState = currentState;
if ( lastRedstoneState == YesNo.YES )
triggerTransition();
this.lastRedstoneState = currentState;
if ( this.lastRedstoneState == YesNo.YES )
this.triggerTransition();
}
}
public boolean getRedstoneState()
{
if ( lastRedstoneState == YesNo.UNDECIDED )
updateRedstoneState();
if ( this.lastRedstoneState == YesNo.UNDECIDED )
this.updateRedstoneState();
return lastRedstoneState == YesNo.YES;
return this.lastRedstoneState == YesNo.YES;
}
private void triggerTransition()
{
if ( Platform.isServer() )
{
ItemStack cell = getStackInSlot( 0 );
if ( isSpatialCell( cell ) )
ItemStack cell = this.getStackInSlot( 0 );
if ( this.isSpatialCell( cell ) )
{
TickHandler.instance.addCallable( null, this );// this needs to be cross world synced.
}
@@ -105,11 +105,11 @@ public class TileSpatialIOPort extends AENetworkInvTile implements Callable
public Object call() throws Exception
{
ItemStack cell = getStackInSlot( 0 );
if ( isSpatialCell( cell ) && getStackInSlot( 1 ) == null )
ItemStack cell = this.getStackInSlot( 0 );
if ( this.isSpatialCell( cell ) && this.getStackInSlot( 1 ) == null )
{
IGrid gi = gridProxy.getGrid();
IEnergyGrid energy = gridProxy.getEnergy();
IGrid gi = this.gridProxy.getGrid();
IEnergyGrid energy = this.gridProxy.getEnergy();
ISpatialStorageCell sc = (ISpatialStorageCell) cell.getItem();
@@ -123,12 +123,12 @@ public class TileSpatialIOPort extends AENetworkInvTile implements Callable
MENetworkEvent res = gi.postEvent( new MENetworkSpatialEvent( this, req ) );
if ( !res.isCanceled() )
{
TransitionResult tr = sc.doSpatialTransition( cell, worldObj, spc.getMin(), spc.getMax(), true );
TransitionResult tr = sc.doSpatialTransition( cell, this.worldObj, spc.getMin(), spc.getMax(), true );
if ( tr.success )
{
energy.extractAEPower( req, Actionable.MODULATE, PowerMultiplier.CONFIG );
setInventorySlotContents( 0, null );
setInventorySlotContents( 1, cell );
this.setInventorySlotContents( 0, null );
this.setInventorySlotContents( 1, cell );
}
}
}
@@ -153,13 +153,13 @@ public class TileSpatialIOPort extends AENetworkInvTile implements Callable
@Override
public IInventory getInternalInventory()
{
return inv;
return this.inv;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack)
{
return (i == 0 && isSpatialCell( itemstack ));
return (i == 0 && this.isSpatialCell( itemstack ));
}
private boolean isSpatialCell(ItemStack cell)
@@ -175,7 +175,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements Callable
@Override
public boolean canInsertItem(int i, ItemStack itemstack, int j)
{
return isItemValidForSlot( i, itemstack );
return this.isItemValidForSlot( i, itemstack );
}
@Override
@@ -193,7 +193,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements Callable
@Override
public int[] getAccessibleSlotsBySide(ForgeDirection side)
{
return sides;
return this.sides;
}
}
@@ -61,7 +61,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
@Override
protected AENetworkProxy createProxy()
{
return new AENetworkProxyMultiblock( this, "proxy", getItemFromTile( this ), true );
return new AENetworkProxyMultiblock( this, "proxy", this.getItemFromTile( this ), true );
}
@Override
@@ -73,46 +73,46 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
@TileEvent(TileEventType.NETWORK_READ)
public boolean readFromStream_TileSpatialPylon(ByteBuf data)
{
int old = displayBits;
displayBits = data.readByte();
return old != displayBits;
int old = this.displayBits;
this.displayBits = data.readByte();
return old != this.displayBits;
}
@TileEvent(TileEventType.NETWORK_WRITE)
public void writeToStream_TileSpatialPylon(ByteBuf data)
{
data.writeByte( displayBits );
data.writeByte( this.displayBits );
}
public TileSpatialPylon() {
gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL, GridFlags.MULTIBLOCK );
gridProxy.setIdlePowerUsage( 0.5 );
gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL, GridFlags.MULTIBLOCK );
this.gridProxy.setIdlePowerUsage( 0.5 );
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
}
@Override
public void onReady()
{
super.onReady();
onNeighborBlockChange();
this.onNeighborBlockChange();
}
@Override
public void markForUpdate()
{
super.markForUpdate();
boolean hasLight = getLightValue() > 0;
if ( hasLight != didHaveLight )
boolean hasLight = this.getLightValue() > 0;
if ( hasLight != this.didHaveLight )
{
didHaveLight = hasLight;
worldObj.func_147451_t( xCoord, yCoord, zCoord );
this.didHaveLight = hasLight;
this.worldObj.func_147451_t( this.xCoord, this.yCoord, this.zCoord );
// worldObj.updateAllLightTypes( xCoord, yCoord, zCoord );
}
}
public int getLightValue()
{
if ( (displayBits & DISPLAY_POWERED_ENABLED) == DISPLAY_POWERED_ENABLED )
if ( (this.displayBits & this.DISPLAY_POWERED_ENABLED) == this.DISPLAY_POWERED_ENABLED )
{
return 8;
}
@@ -122,78 +122,78 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
@MENetworkEventSubscribe
public void powerRender(MENetworkPowerStatusChange c)
{
recalculateDisplay();
this.recalculateDisplay();
}
@MENetworkEventSubscribe
public void activeRender(MENetworkChannelsChanged c)
{
recalculateDisplay();
this.recalculateDisplay();
}
@Override
public void invalidate()
{
disconnect( false );
this.disconnect( false );
super.invalidate();
}
@Override
public void onChunkUnload()
{
disconnect( false );
this.disconnect( false );
super.onChunkUnload();
}
public void onNeighborBlockChange()
{
calc.calculateMultiblock( worldObj, getLocation() );
this.calc.calculateMultiblock( this.worldObj, this.getLocation() );
}
@Override
public SpatialPylonCluster getCluster()
{
return cluster;
return this.cluster;
}
public void recalculateDisplay()
{
int oldBits = displayBits;
int oldBits = this.displayBits;
displayBits = 0;
this.displayBits = 0;
if ( cluster != null )
if ( this.cluster != null )
{
if ( cluster.min.equals( getLocation() ) )
displayBits = DISPLAY_END_MIN;
else if ( cluster.max.equals( getLocation() ) )
displayBits = DISPLAY_END_MAX;
if ( this.cluster.min.equals( this.getLocation() ) )
this.displayBits = this.DISPLAY_END_MIN;
else if ( this.cluster.max.equals( this.getLocation() ) )
this.displayBits = this.DISPLAY_END_MAX;
else
displayBits = DISPLAY_MIDDLE;
this.displayBits = this.DISPLAY_MIDDLE;
switch (cluster.currentAxis)
switch (this.cluster.currentAxis)
{
case X:
displayBits |= DISPLAY_X;
this.displayBits |= this.DISPLAY_X;
break;
case Y:
displayBits |= DISPLAY_Y;
this.displayBits |= this.DISPLAY_Y;
break;
case Z:
displayBits |= DISPLAY_Z;
this.displayBits |= this.DISPLAY_Z;
break;
default:
displayBits = 0;
this.displayBits = 0;
break;
}
try
{
if ( gridProxy.getEnergy().isNetworkPowered() )
displayBits |= DISPLAY_POWERED_ENABLED;
if ( this.gridProxy.getEnergy().isNetworkPowered() )
this.displayBits |= this.DISPLAY_POWERED_ENABLED;
if ( cluster.isValid && gridProxy.isActive() )
displayBits |= DISPLAY_ENABLED;
if ( this.cluster.isValid && this.gridProxy.isActive() )
this.displayBits |= this.DISPLAY_ENABLED;
}
catch (GridAccessException e)
{
@@ -202,24 +202,24 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
}
if ( oldBits != displayBits )
markForUpdate();
if ( oldBits != this.displayBits )
this.markForUpdate();
}
public void updateStatus(SpatialPylonCluster c)
{
cluster = c;
gridProxy.setValidSides( c == null ? EnumSet.noneOf( ForgeDirection.class ) : EnumSet.allOf( ForgeDirection.class ) );
recalculateDisplay();
this.cluster = c;
this.gridProxy.setValidSides( c == null ? EnumSet.noneOf( ForgeDirection.class ) : EnumSet.allOf( ForgeDirection.class ) );
this.recalculateDisplay();
}
@Override
public void disconnect(boolean b)
{
if ( cluster != null )
if ( this.cluster != null )
{
cluster.destroy();
updateStatus( null );
this.cluster.destroy();
this.updateStatus( null );
}
}
@@ -231,7 +231,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
public int getDisplayBits()
{
return displayBits;
return this.displayBits;
}
}
+156 -156
View File
@@ -121,23 +121,23 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
private void recalculateDisplay()
{
int oldState = state;
int oldState = this.state;
for (int x = 0; x < getCellCount(); x++)
state |= (getCellStatus( x ) << (3 * x));
for (int x = 0; x < this.getCellCount(); x++)
this.state |= (this.getCellStatus( x ) << (3 * x));
if ( isPowered() )
state |= 0x40;
if ( this.isPowered() )
this.state |= 0x40;
else
state &= ~0x40;
this.state &= ~0x40;
boolean currentActive = gridProxy.isActive();
if ( wasActive != currentActive )
boolean currentActive = this.gridProxy.isActive();
if ( this.wasActive != currentActive )
{
wasActive = currentActive;
this.wasActive = currentActive;
try
{
gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch (GridAccessException e)
{
@@ -145,8 +145,8 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
}
if ( oldState != state )
markForUpdate();
if ( oldState != this.state )
this.markForUpdate();
}
@Override
@@ -156,7 +156,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
try
{
gridProxy.getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) );
this.gridProxy.getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) );
}
catch (GridAccessException e)
{
@@ -164,59 +164,59 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
}
else
recalculateDisplay();
this.recalculateDisplay();
}
@TileEvent(TileEventType.TICK)
public void Tick_TileChest()
{
if ( worldObj.isRemote )
if ( this.worldObj.isRemote )
return;
double idleUsage = gridProxy.getIdlePowerUsage();
double idleUsage = this.gridProxy.getIdlePowerUsage();
try
{
if ( !gridProxy.getEnergy().isNetworkPowered() )
if ( !this.gridProxy.getEnergy().isNetworkPowered() )
{
double powerUsed = extractAEPower( idleUsage, Actionable.MODULATE, PowerMultiplier.CONFIG ); // drain
if ( powerUsed + 0.1 >= idleUsage != (state & 0x40) > 0 )
recalculateDisplay();
double powerUsed = this.extractAEPower( idleUsage, Actionable.MODULATE, PowerMultiplier.CONFIG ); // drain
if ( powerUsed + 0.1 >= idleUsage != (this.state & 0x40) > 0 )
this.recalculateDisplay();
}
}
catch (GridAccessException e)
{
double powerUsed = extractAEPower( gridProxy.getIdlePowerUsage(), Actionable.MODULATE, PowerMultiplier.CONFIG ); // drain
if ( powerUsed + 0.1 >= idleUsage != (state & 0x40) > 0 )
recalculateDisplay();
double powerUsed = this.extractAEPower( this.gridProxy.getIdlePowerUsage(), Actionable.MODULATE, PowerMultiplier.CONFIG ); // drain
if ( powerUsed + 0.1 >= idleUsage != (this.state & 0x40) > 0 )
this.recalculateDisplay();
}
if ( inv.getStackInSlot( 0 ) != null )
if ( this.inv.getStackInSlot( 0 ) != null )
{
tryToStoreContents();
this.tryToStoreContents();
}
}
@TileEvent(TileEventType.NETWORK_WRITE)
public void writeToStream_TileChest(ByteBuf data)
{
if ( worldObj.getTotalWorldTime() - lastStateChange > 8 )
state = 0;
if ( this.worldObj.getTotalWorldTime() - this.lastStateChange > 8 )
this.state = 0;
else
state &= 0x24924924; // just keep the blinks...
this.state &= 0x24924924; // just keep the blinks...
for (int x = 0; x < getCellCount(); x++)
state |= (getCellStatus( x ) << (3 * x));
for (int x = 0; x < this.getCellCount(); x++)
this.state |= (this.getCellStatus( x ) << (3 * x));
if ( isPowered() )
state |= 0x40;
if ( this.isPowered() )
this.state |= 0x40;
else
state &= ~0x40;
this.state &= ~0x40;
data.writeByte( state );
data.writeByte( paintedColor.ordinal() );
data.writeByte( this.state );
data.writeByte( this.paintedColor.ordinal() );
ItemStack is = inv.getStackInSlot( 1 );
ItemStack is = this.inv.getStackInSlot( 1 );
if ( is == null )
{
@@ -231,64 +231,64 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@TileEvent(TileEventType.NETWORK_READ)
public boolean readFromStream_TileChest(ByteBuf data)
{
int oldState = state;
ItemStack oldType = storageType;
int oldState = this.state;
ItemStack oldType = this.storageType;
state = data.readByte();
AEColor oldPaintedColor = paintedColor;
paintedColor = AEColor.values()[data.readByte()];
this.state = data.readByte();
AEColor oldPaintedColor = this.paintedColor;
this.paintedColor = AEColor.values()[data.readByte()];
int item = data.readInt();
if ( item == 0 )
storageType = null;
this.storageType = null;
else
storageType = new ItemStack( Item.getItemById( item & 0xffff ), 1, item >> Platform.DEF_OFFSET );
this.storageType = new ItemStack( Item.getItemById( item & 0xffff ), 1, item >> Platform.DEF_OFFSET );
lastStateChange = worldObj.getTotalWorldTime();
this.lastStateChange = this.worldObj.getTotalWorldTime();
return oldPaintedColor != paintedColor || (state & 0xDB6DB6DB) != (oldState & 0xDB6DB6DB) || !Platform.isSameItemPrecise( oldType, storageType );
return oldPaintedColor != this.paintedColor || (this.state & 0xDB6DB6DB) != (oldState & 0xDB6DB6DB) || !Platform.isSameItemPrecise( oldType, this.storageType );
}
@TileEvent(TileEventType.WORLD_NBT_READ)
public void readFromNBT_TileChest(NBTTagCompound data)
{
config.readFromNBT( data );
priority = data.getInteger( "priority" );
this.config.readFromNBT( data );
this.priority = data.getInteger( "priority" );
if ( data.hasKey( "paintedColor" ) )
paintedColor = AEColor.values()[data.getByte( "paintedColor" )];
this.paintedColor = AEColor.values()[data.getByte( "paintedColor" )];
}
@TileEvent(TileEventType.WORLD_NBT_WRITE)
public void writeToNBT_TileChest(NBTTagCompound data)
{
config.writeToNBT( data );
data.setInteger( "priority", priority );
data.setByte( "paintedColor", (byte) paintedColor.ordinal() );
this.config.writeToNBT( data );
data.setInteger( "priority", this.priority );
data.setByte( "paintedColor", (byte) this.paintedColor.ordinal() );
}
@MENetworkEventSubscribe
public void powerRender(MENetworkPowerStatusChange c)
{
recalculateDisplay();
this.recalculateDisplay();
}
@MENetworkEventSubscribe
public void channelRender(MENetworkChannelsChanged c)
{
recalculateDisplay();
this.recalculateDisplay();
}
public TileChest()
{
internalMaxPower = PowerMultiplier.CONFIG.multiply( 40 );
gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
config.registerSetting( Settings.SORT_BY, SortOrder.NAME );
config.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
config.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
this.internalMaxPower = PowerMultiplier.CONFIG.multiply( 40 );
this.gridProxy.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 );
internalPublicPowerStorage = true;
internalPowerFlow = AccessRestriction.WRITE;
this.internalPublicPowerStorage = true;
this.internalPowerFlow = AccessRestriction.WRITE;
}
boolean isCached = false;
@@ -300,13 +300,13 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public IMEMonitor getItemInventory()
{
return itemCell;
return this.itemCell;
}
@Override
public IMEMonitor getFluidInventory()
{
return fluidCell;
return this.fluidCell;
}
class ChestNetNotifier<T extends IAEStack<T>> implements IMEMonitorHandlerReceiver<T>
@@ -322,12 +322,12 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public void postChange(IBaseMonitor<T> monitor, Iterable<T> change, BaseActionSource source)
{
if ( source == mySrc || (source instanceof PlayerSource && ((PlayerSource) source).via == TileChest.this) )
if ( source == TileChest.this.mySrc || (source instanceof PlayerSource && ((PlayerSource) source).via == TileChest.this) )
{
try
{
if ( gridProxy.isActive() )
gridProxy.getStorage().postAlterationOfStoredItems( chan, change, mySrc );
if ( TileChest.this.gridProxy.isActive() )
TileChest.this.gridProxy.getStorage().postAlterationOfStoredItems( this.chan, change, TileChest.this.mySrc );
}
catch (GridAccessException e)
{
@@ -335,16 +335,16 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
}
blinkCell( 0 );
TileChest.this.blinkCell( 0 );
}
@Override
public boolean isValid(Object verificationToken)
{
if ( chan == StorageChannel.ITEMS )
return verificationToken == itemCell;
if ( chan == StorageChannel.FLUIDS )
return verificationToken == fluidCell;
if ( this.chan == StorageChannel.ITEMS )
return verificationToken == TileChest.this.itemCell;
if ( this.chan == StorageChannel.FLUIDS )
return verificationToken == TileChest.this.fluidCell;
return false;
}
@@ -366,7 +366,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
public IMEInventoryHandler<T> getInternalHandler()
{
IMEInventoryHandler<T> h = getHandler();
IMEInventoryHandler<T> h = this.getHandler();
if ( h instanceof MEInventoryHandler )
return (IMEInventoryHandler<T>) ((MEInventoryHandler) h).getInternal();
return this.getHandler();
@@ -374,11 +374,11 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
private boolean securityCheck(EntityPlayer player, SecurityPermissions requiredPermission)
{
if ( getTile() instanceof IActionHost && requiredPermission != null )
if ( TileChest.this.getTile() instanceof IActionHost && requiredPermission != null )
{
boolean requirePower = false;
IGridNode gn = ((IActionHost) getTile()).getActionableNode();
IGridNode gn = ((IActionHost) TileChest.this.getTile()).getActionableNode();
if ( gn != null )
{
IGrid g = gn.getGrid();
@@ -407,7 +407,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public T injectItems(T input, Actionable mode, BaseActionSource src)
{
if ( src.isPlayer() && !securityCheck(((PlayerSource) src).player, SecurityPermissions.INJECT) )
if ( src.isPlayer() && !this.securityCheck(((PlayerSource) src).player, SecurityPermissions.INJECT) )
return input;
return super.injectItems(input, mode, src);
}
@@ -415,7 +415,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public T extractItems(T request, Actionable mode, BaseActionSource src)
{
if ( src.isPlayer() && !securityCheck(((PlayerSource) src).player, SecurityPermissions.EXTRACT) )
if ( src.isPlayer() && !this.securityCheck(((PlayerSource) src).player, SecurityPermissions.EXTRACT) )
return null;
return super.extractItems(request, mode, src);
}
@@ -427,7 +427,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
return null;
MEInventoryHandler ih = new MEInventoryHandler( h, h.getChannel() );
ih.myPriority = priority;
ih.myPriority = this.priority;
MEMonitorHandler<StackType> g = new ChestMonitorHandler<StackType>( ih );
g.addListener( new ChestNetNotifier( h.getChannel() ), g );
@@ -437,32 +437,32 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
public IMEInventoryHandler getHandler(StorageChannel channel) throws ChestNoHandler
{
if ( !isCached )
if ( !this.isCached )
{
itemCell = null;
fluidCell = null;
this.itemCell = null;
this.fluidCell = null;
ItemStack is = inv.getStackInSlot( 1 );
ItemStack is = this.inv.getStackInSlot( 1 );
if ( is != null )
{
isCached = true;
cellHandler = AEApi.instance().registries().cell().getHandler( is );
if ( cellHandler != null )
this.isCached = true;
this.cellHandler = AEApi.instance().registries().cell().getHandler( is );
if ( this.cellHandler != null )
{
double power = 1.0;
IMEInventoryHandler<IAEItemStack> itemCell = cellHandler.getCellInventory( is, this, StorageChannel.ITEMS );
IMEInventoryHandler<IAEFluidStack> fluidCell = cellHandler.getCellInventory( is, this, StorageChannel.FLUIDS );
IMEInventoryHandler<IAEItemStack> itemCell = this.cellHandler.getCellInventory( is, this, StorageChannel.ITEMS );
IMEInventoryHandler<IAEFluidStack> fluidCell = this.cellHandler.getCellInventory( is, this, StorageChannel.FLUIDS );
if ( itemCell != null )
power += cellHandler.cellIdleDrain( is, itemCell );
power += this.cellHandler.cellIdleDrain( is, itemCell );
else if ( fluidCell != null )
power += cellHandler.cellIdleDrain( is, fluidCell );
power += this.cellHandler.cellIdleDrain( is, fluidCell );
gridProxy.setIdlePowerUsage( power );
this.gridProxy.setIdlePowerUsage( power );
this.itemCell = wrap( itemCell );
this.fluidCell = wrap( fluidCell );
this.itemCell = this.wrap( itemCell );
this.fluidCell = this.wrap( fluidCell );
}
}
}
@@ -470,13 +470,13 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
switch (channel)
{
case FLUIDS:
if ( fluidCell == null )
if ( this.fluidCell == null )
throw noHandler;
return fluidCell;
return this.fluidCell;
case ITEMS:
if ( itemCell == null )
if ( this.itemCell == null )
throw noHandler;
return itemCell;
return this.itemCell;
default:
}
@@ -486,7 +486,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public IInventory getInternalInventory()
{
return inv;
return this.inv;
}
@Override
@@ -494,16 +494,16 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
if ( slot == 1 )
{
itemCell = null;
fluidCell = null;
isCached = false; // recalculate the storage cell.
this.itemCell = null;
this.fluidCell = null;
this.isCached = false; // recalculate the storage cell.
try
{
gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
IStorageGrid gs = gridProxy.getStorage();
Platform.postChanges( gs, removed, added, mySrc );
IStorageGrid gs = this.gridProxy.getStorage();
Platform.postChanges( gs, removed, added, this.mySrc );
}
catch (GridAccessException ignored)
{
@@ -511,10 +511,10 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
// update the neighbors
if ( worldObj != null )
if ( this.worldObj != null )
{
Platform.notifyBlocksOfNeighbors( worldObj, xCoord, yCoord, zCoord );
markForUpdate();
Platform.notifyBlocksOfNeighbors( this.worldObj, this.xCoord, this.yCoord, this.zCoord );
this.markForUpdate();
}
}
}
@@ -522,24 +522,24 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public void setInventorySlotContents(int i, ItemStack itemstack)
{
inv.setInventorySlotContents( i, itemstack );
tryToStoreContents();
this.inv.setInventorySlotContents( i, itemstack );
this.tryToStoreContents();
}
private void tryToStoreContents()
{
try
{
if ( getStackInSlot( 0 ) != null )
if ( this.getStackInSlot( 0 ) != null )
{
IMEInventory<IAEItemStack> cell = getHandler( StorageChannel.ITEMS );
IMEInventory<IAEItemStack> cell = this.getHandler( StorageChannel.ITEMS );
IAEItemStack returns = Platform.poweredInsert( this, cell, AEApi.instance().storage().createItemStack( inv.getStackInSlot( 0 ) ), mySrc );
IAEItemStack returns = Platform.poweredInsert( this, cell, AEApi.instance().storage().createItemStack( this.inv.getStackInSlot( 0 ) ), this.mySrc );
if ( returns == null )
inv.setInventorySlotContents( 0, null );
this.inv.setInventorySlotContents( 0, null );
else
inv.setInventorySlotContents( 0, returns.getItemStack() );
this.inv.setInventorySlotContents( 0, returns.getItemStack() );
}
}
catch (ChestNoHandler ignored)
@@ -567,8 +567,8 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
try
{
IMEInventory<IAEItemStack> cell = getHandler( StorageChannel.ITEMS );
IAEItemStack returns = cell.injectItems( AEApi.instance().storage().createItemStack( inv.getStackInSlot( 0 ) ), Actionable.SIMULATE, mySrc );
IMEInventory<IAEItemStack> cell = this.getHandler( StorageChannel.ITEMS );
IAEItemStack returns = cell.injectItems( AEApi.instance().storage().createItemStack( this.inv.getStackInSlot( 0 ) ), Actionable.SIMULATE, this.mySrc );
return returns == null || returns.getStackSize() != itemstack.stackSize;
}
catch (ChestNoHandler ignored)
@@ -584,11 +584,11 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
if ( ForgeDirection.SOUTH == side )
return front;
if ( isPowered() )
if ( this.isPowered() )
{
try
{
if ( getHandler( StorageChannel.ITEMS ) != null )
if ( this.getHandler( StorageChannel.ITEMS ) != null )
return sides;
}
catch (ChestNoHandler e)
@@ -602,11 +602,11 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public List<IMEInventoryHandler> getCellArray(StorageChannel channel)
{
if ( gridProxy.isActive() )
if ( this.gridProxy.isActive() )
{
try
{
return Collections.singletonList( getHandler( channel ) );
return Collections.singletonList( this.getHandler( channel ) );
}
catch (ChestNoHandler e)
{
@@ -619,7 +619,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public int getPriority()
{
return priority;
return this.priority;
}
@Override
@@ -631,40 +631,40 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public void blinkCell(int slot)
{
long now = worldObj.getTotalWorldTime();
if ( now - lastStateChange > 8 )
state = 0;
lastStateChange = now;
long now = this.worldObj.getTotalWorldTime();
if ( now - this.lastStateChange > 8 )
this.state = 0;
this.lastStateChange = now;
state |= 1 << (slot * 3 + 2);
this.state |= 1 << (slot * 3 + 2);
recalculateDisplay();
this.recalculateDisplay();
}
@Override
public boolean isCellBlinking(int slot)
{
long now = worldObj.getTotalWorldTime();
if ( now - lastStateChange > 8 )
long now = this.worldObj.getTotalWorldTime();
if ( now - this.lastStateChange > 8 )
return false;
return ((state >> (slot * 3 + 2)) & 0x01) == 0x01;
return ((this.state >> (slot * 3 + 2)) & 0x01) == 0x01;
}
@Override
public int getCellStatus(int slot)
{
if ( Platform.isClient() )
return (state >> (slot * 3)) & 3;
return (this.state >> (slot * 3)) & 3;
ItemStack cell = inv.getStackInSlot( 1 );
ItemStack cell = this.inv.getStackInSlot( 1 );
ICellHandler ch = AEApi.instance().registries().cell().getHandler( cell );
if ( ch != null )
{
try
{
IMEInventoryHandler handler = getHandler( StorageChannel.ITEMS );
IMEInventoryHandler handler = this.getHandler( StorageChannel.ITEMS );
if ( handler instanceof ChestMonitorHandler )
return ch.getStatusForCell( cell, ((ChestMonitorHandler) handler).getInternalHandler() );
}
@@ -674,7 +674,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
try
{
IMEInventoryHandler handler = getHandler( StorageChannel.FLUIDS );
IMEInventoryHandler handler = this.getHandler( StorageChannel.FLUIDS );
if ( handler instanceof ChestMonitorHandler )
return ch.getStatusForCell( cell, ((ChestMonitorHandler) handler).getInternalHandler() );
}
@@ -690,15 +690,15 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
{
double req = resource.amount / 500.0;
double available = extractAEPower( req, Actionable.SIMULATE, PowerMultiplier.CONFIG );
double available = this.extractAEPower( req, Actionable.SIMULATE, PowerMultiplier.CONFIG );
if ( available >= req - 0.01 )
{
try
{
IMEInventoryHandler h = getHandler( StorageChannel.FLUIDS );
IMEInventoryHandler h = this.getHandler( StorageChannel.FLUIDS );
extractAEPower( req, Actionable.MODULATE, PowerMultiplier.CONFIG );
IAEStack results = h.injectItems( AEFluidStack.create( resource ), doFill ? Actionable.MODULATE : Actionable.SIMULATE, mySrc );
this.extractAEPower( req, Actionable.MODULATE, PowerMultiplier.CONFIG );
IAEStack results = h.injectItems( AEFluidStack.create( resource ), doFill ? Actionable.MODULATE : Actionable.SIMULATE, this.mySrc );
if ( results == null )
return resource.amount;
@@ -729,7 +729,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
try
{
IMEInventoryHandler h = getHandler( StorageChannel.FLUIDS );
IMEInventoryHandler h = this.getHandler( StorageChannel.FLUIDS );
return h.canAccept( AEFluidStack.create( new FluidStack( fluid, 1 ) ) );
}
catch (ChestNoHandler ignored)
@@ -749,7 +749,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
try
{
IMEInventoryHandler h = getHandler( StorageChannel.FLUIDS );
IMEInventoryHandler h = this.getHandler( StorageChannel.FLUIDS );
if ( h.getChannel() == StorageChannel.FLUIDS )
return new FluidTankInfo[] { new FluidTankInfo( null, 1 ) }; // eh?
}
@@ -768,7 +768,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
IEnergyGrid eg;
try
{
eg = gridProxy.getEnergy();
eg = this.gridProxy.getEnergy();
stash = eg.extractAEPower( amt, mode, PowerMultiplier.ONE );
if ( stash >= amt )
return stash;
@@ -786,15 +786,15 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
public boolean isPowered()
{
if ( Platform.isClient() )
return (state & 0x40) == 0x40;
return (this.state & 0x40) == 0x40;
boolean gridPowered = getAECurrentPower() > 64;
boolean gridPowered = this.getAECurrentPower() > 64;
if ( !gridPowered )
{
try
{
gridPowered = gridProxy.getEnergy().isNetworkPowered();
gridPowered = this.gridProxy.getEnergy().isNetworkPowered();
}
catch (GridAccessException ignored)
{
@@ -807,30 +807,30 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public IStorageMonitorable getMonitorable(ForgeDirection side, BaseActionSource src)
{
if ( Platform.canAccess( gridProxy, src ) && side != getForward() )
if ( Platform.canAccess( this.gridProxy, src ) && side != this.getForward() )
return this;
return null;
}
public ItemStack getStorageType()
{
if ( isPowered() )
return storageType;
if ( this.isPowered() )
return this.storageType;
return null;
}
@Override
public void setPriority(int newValue)
{
priority = newValue;
this.priority = newValue;
itemCell = null;
fluidCell = null;
isCached = false; // recalculate the storage cell.
this.itemCell = null;
this.fluidCell = null;
this.isCached = false; // recalculate the storage cell.
try
{
gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch (GridAccessException e)
{
@@ -841,7 +841,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public IConfigManager getConfigManager()
{
return config;
return this.config;
}
@Override
@@ -887,24 +887,24 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@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;
}
@Override
public void saveChanges(IMEInventory cellInventory)
{
worldObj.markTileEntityChunkModified( this.xCoord, this.yCoord, this.zCoord, this );
this.worldObj.markTileEntityChunkModified( this.xCoord, this.yCoord, this.zCoord, this );
}
}
@@ -78,18 +78,18 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
{
int oldState = 0;
boolean currentActive = gridProxy.isActive();
boolean currentActive = this.gridProxy.isActive();
if ( currentActive )
state |= 0x80000000;
this.state |= 0x80000000;
else
state &= ~0x80000000;
this.state &= ~0x80000000;
if ( wasActive != currentActive )
if ( this.wasActive != currentActive )
{
wasActive = currentActive;
this.wasActive = currentActive;
try
{
gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch (GridAccessException e)
{
@@ -97,69 +97,69 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
}
}
for (int x = 0; x < getCellCount(); x++)
state |= (getCellStatus( x ) << (3 * x));
for (int x = 0; x < this.getCellCount(); x++)
this.state |= (this.getCellStatus( x ) << (3 * x));
if ( oldState != state )
markForUpdate();
if ( oldState != this.state )
this.markForUpdate();
}
@TileEvent(TileEventType.NETWORK_WRITE)
public void writeToStream_TileDrive(ByteBuf data)
{
if ( worldObj.getTotalWorldTime() - lastStateChange > 8 )
state = 0;
if ( this.worldObj.getTotalWorldTime() - this.lastStateChange > 8 )
this.state = 0;
else
state &= 0x24924924; // just keep the blinks...
this.state &= 0x24924924; // just keep the blinks...
if ( gridProxy.isActive() )
state |= 0x80000000;
if ( this.gridProxy.isActive() )
this.state |= 0x80000000;
else
state &= ~0x80000000;
this.state &= ~0x80000000;
for (int x = 0; x < getCellCount(); x++)
state |= (getCellStatus( x ) << (3 * x));
for (int x = 0; x < this.getCellCount(); x++)
this.state |= (this.getCellStatus( x ) << (3 * x));
data.writeInt( state );
data.writeInt( this.state );
}
@TileEvent(TileEventType.NETWORK_READ)
public boolean readFromStream_TileDrive(ByteBuf data)
{
int oldState = state;
state = data.readInt();
lastStateChange = worldObj.getTotalWorldTime();
return (state & 0xDB6DB6DB) != (oldState & 0xDB6DB6DB);
int oldState = this.state;
this.state = data.readInt();
this.lastStateChange = this.worldObj.getTotalWorldTime();
return (this.state & 0xDB6DB6DB) != (oldState & 0xDB6DB6DB);
}
@TileEvent(TileEventType.WORLD_NBT_READ)
public void readFromNBT_TileDrive(NBTTagCompound data)
{
isCached = false;
priority = data.getInteger( "priority" );
this.isCached = false;
this.priority = data.getInteger( "priority" );
}
@TileEvent(TileEventType.WORLD_NBT_WRITE)
public void writeToNBT_TileDrive(NBTTagCompound data)
{
data.setInteger( "priority", priority );
data.setInteger( "priority", this.priority );
}
@MENetworkEventSubscribe
public void powerRender(MENetworkPowerStatusChange c)
{
recalculateDisplay();
this.recalculateDisplay();
}
@MENetworkEventSubscribe
public void channelRender(MENetworkChannelsChanged c)
{
recalculateDisplay();
this.recalculateDisplay();
}
public TileDrive() {
mySrc = new MachineSource( this );
gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
this.mySrc = new MachineSource( this );
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
}
@Override
@@ -177,108 +177,108 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
@Override
public IInventory getInternalInventory()
{
return inv;
return this.inv;
}
@Override
public void onReady()
{
super.onReady();
updateState();
this.updateState();
}
@Override
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added)
{
if ( isCached )
if ( this.isCached )
{
isCached = false; // recalculate the storage cell.
updateState();
this.isCached = false; // recalculate the storage cell.
this.updateState();
}
try
{
gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
IStorageGrid gs = gridProxy.getStorage();
Platform.postChanges( gs, removed, added, mySrc );
IStorageGrid gs = this.gridProxy.getStorage();
Platform.postChanges( gs, removed, added, this.mySrc );
}
catch (GridAccessException ignored)
{
}
markForUpdate();
this.markForUpdate();
}
@Override
public int[] getAccessibleSlotsBySide(ForgeDirection side)
{
return sides;
return this.sides;
}
public void updateState()
{
if ( !isCached )
if ( !this.isCached )
{
items = new LinkedList();
fluids = new LinkedList();
this.items = new LinkedList();
this.fluids = new LinkedList();
double power = 2.0;
for (int x = 0; x < inv.getSizeInventory(); x++)
for (int x = 0; x < this.inv.getSizeInventory(); x++)
{
ItemStack is = inv.getStackInSlot( x );
invBySlot[x] = null;
handlersBySlot[x] = null;
ItemStack is = this.inv.getStackInSlot( x );
this.invBySlot[x] = null;
this.handlersBySlot[x] = null;
if ( is != null )
{
handlersBySlot[x] = AEApi.instance().registries().cell().getHandler( is );
this.handlersBySlot[x] = AEApi.instance().registries().cell().getHandler( is );
if ( handlersBySlot[x] != null )
if ( this.handlersBySlot[x] != null )
{
IMEInventoryHandler cell = handlersBySlot[x].getCellInventory( is, this, StorageChannel.ITEMS );
IMEInventoryHandler cell = this.handlersBySlot[x].getCellInventory( is, this, StorageChannel.ITEMS );
if ( cell != null )
{
power += handlersBySlot[x].cellIdleDrain( is, cell );
power += this.handlersBySlot[x].cellIdleDrain( is, cell );
DriveWatcher<IAEItemStack> ih = new DriveWatcher( cell, is, handlersBySlot[x], this );
ih.myPriority = priority;
invBySlot[x] = ih;
items.add( ih );
DriveWatcher<IAEItemStack> ih = new DriveWatcher( cell, is, this.handlersBySlot[x], this );
ih.myPriority = this.priority;
this.invBySlot[x] = ih;
this.items.add( ih );
}
else
{
cell = handlersBySlot[x].getCellInventory( is, this, StorageChannel.FLUIDS );
cell = this.handlersBySlot[x].getCellInventory( is, this, StorageChannel.FLUIDS );
if ( cell != null )
{
power += handlersBySlot[x].cellIdleDrain( is, cell );
power += this.handlersBySlot[x].cellIdleDrain( is, cell );
DriveWatcher<IAEItemStack> ih = new DriveWatcher( cell, is, handlersBySlot[x], this );
ih.myPriority = priority;
invBySlot[x] = ih;
fluids.add( ih );
DriveWatcher<IAEItemStack> ih = new DriveWatcher( cell, is, this.handlersBySlot[x], this );
ih.myPriority = this.priority;
this.invBySlot[x] = ih;
this.fluids.add( ih );
}
}
}
}
}
gridProxy.setIdlePowerUsage( power );
this.gridProxy.setIdlePowerUsage( power );
isCached = true;
this.isCached = true;
}
}
@Override
public List<IMEInventoryHandler> getCellArray(StorageChannel channel)
{
if ( gridProxy.isActive() )
if ( this.gridProxy.isActive() )
{
updateState();
return (List) (channel == StorageChannel.ITEMS ? items : fluids);
this.updateState();
return (List) (channel == StorageChannel.ITEMS ? this.items : this.fluids);
}
return new ArrayList();
}
@@ -286,7 +286,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
@Override
public int getPriority()
{
return priority;
return this.priority;
}
@Override
@@ -298,36 +298,36 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
@Override
public void blinkCell(int slot)
{
long now = worldObj.getTotalWorldTime();
if ( now - lastStateChange > 8 )
state = 0;
lastStateChange = now;
long now = this.worldObj.getTotalWorldTime();
if ( now - this.lastStateChange > 8 )
this.state = 0;
this.lastStateChange = now;
state |= 1 << (slot * 3 + 2);
this.state |= 1 << (slot * 3 + 2);
recalculateDisplay();
this.recalculateDisplay();
}
@Override
public boolean isCellBlinking(int slot)
{
long now = worldObj.getTotalWorldTime();
if ( now - lastStateChange > 8 )
long now = this.worldObj.getTotalWorldTime();
if ( now - this.lastStateChange > 8 )
return false;
return ((state >> (slot * 3 + 2)) & 0x01) == 0x01;
return ((this.state >> (slot * 3 + 2)) & 0x01) == 0x01;
}
@Override
public int getCellStatus(int slot)
{
if ( Platform.isClient() )
return (state >> (slot * 3)) & 3;
return (this.state >> (slot * 3)) & 3;
ItemStack cell = inv.getStackInSlot( 2 );
ICellHandler ch = handlersBySlot[slot];
ItemStack cell = this.inv.getStackInSlot( 2 );
ICellHandler ch = this.handlersBySlot[slot];
MEInventoryHandler handler = invBySlot[slot];
MEInventoryHandler handler = this.invBySlot[slot];
if ( handler == null )
return 0;
@@ -350,23 +350,23 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
public boolean isPowered()
{
if ( Platform.isClient() )
return (state & 0x80000000) == 0x80000000;
return (this.state & 0x80000000) == 0x80000000;
return gridProxy.isActive();
return this.gridProxy.isActive();
}
@Override
public void setPriority(int newValue)
{
priority = newValue;
markDirty();
this.priority = newValue;
this.markDirty();
isCached = false; // recalculate the storage cell.
updateState();
this.isCached = false; // recalculate the storage cell.
this.updateState();
try
{
gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch (GridAccessException e)
{
@@ -383,6 +383,6 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
@Override
public void saveChanges(IMEInventory cellInventory)
{
worldObj.markTileEntityChunkModified( this.xCoord, this.yCoord, this.zCoord, this );
this.worldObj.markTileEntityChunkModified( this.xCoord, this.yCoord, this.zCoord, this );
}
}
@@ -86,27 +86,27 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
@TileEvent(TileEventType.WORLD_NBT_WRITE)
public void writeToNBT_TileIOPort(NBTTagCompound data)
{
cm.writeToNBT( data );
cells.writeToNBT( data, "cells" );
upgrades.writeToNBT( data, "upgrades" );
data.setInteger( "lastRedstoneState", lastRedstoneState.ordinal() );
this.cm.writeToNBT( data );
this.cells.writeToNBT( data, "cells" );
this.upgrades.writeToNBT( data, "upgrades" );
data.setInteger( "lastRedstoneState", this.lastRedstoneState.ordinal() );
}
@TileEvent(TileEventType.WORLD_NBT_READ)
public void readFromNBT_TileIOPort(NBTTagCompound data)
{
cm.readFromNBT( data );
cells.readFromNBT( data, "cells" );
upgrades.readFromNBT( data, "upgrades" );
this.cm.readFromNBT( data );
this.cells.readFromNBT( data, "cells" );
this.upgrades.readFromNBT( data, "upgrades" );
if ( data.hasKey( "lastRedstoneState" ) )
lastRedstoneState = YesNo.values()[data.getInteger( "lastRedstoneState" )];
this.lastRedstoneState = YesNo.values()[data.getInteger( "lastRedstoneState" )];
}
public TileIOPort() {
gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
cm.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
cm.registerSetting( Settings.FULLNESS_MODE, FullnessMode.EMPTY );
cm.registerSetting( Settings.OPERATION_MODE, OperationMode.EMPTY );
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
this.cm.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
this.cm.registerSetting( Settings.FULLNESS_MODE, FullnessMode.EMPTY );
this.cm.registerSetting( Settings.OPERATION_MODE, OperationMode.EMPTY );
}
@Override
@@ -124,15 +124,15 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
@Override
public IInventory getInternalInventory()
{
return cells;
return this.cells;
}
@Override
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added)
{
if ( cells == inv )
if ( this.cells == inv )
{
updateTask();
this.updateTask();
}
}
@@ -140,10 +140,10 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
{
try
{
if ( hasWork() )
gridProxy.getTick().wakeDevice( gridProxy.getNode() );
if ( this.hasWork() )
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
else
gridProxy.getTick().sleepDevice( gridProxy.getNode() );
this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
}
catch (GridAccessException e)
{
@@ -153,56 +153,56 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
public void updateRedstoneState()
{
YesNo currentState = worldObj.isBlockIndirectlyGettingPowered( xCoord, yCoord, zCoord ) ? YesNo.YES : YesNo.NO;
if ( lastRedstoneState != currentState )
YesNo currentState = this.worldObj.isBlockIndirectlyGettingPowered( this.xCoord, this.yCoord, this.zCoord ) ? YesNo.YES : YesNo.NO;
if ( this.lastRedstoneState != currentState )
{
lastRedstoneState = currentState;
updateTask();
this.lastRedstoneState = currentState;
this.updateTask();
}
}
public boolean getRedstoneState()
{
if ( lastRedstoneState == YesNo.UNDECIDED )
updateRedstoneState();
if ( this.lastRedstoneState == YesNo.UNDECIDED )
this.updateRedstoneState();
return lastRedstoneState == YesNo.YES;
return this.lastRedstoneState == YesNo.YES;
}
private boolean isEnabled()
{
if ( getInstalledUpgrades( Upgrades.REDSTONE ) == 0 )
if ( this.getInstalledUpgrades( Upgrades.REDSTONE ) == 0 )
return true;
RedstoneMode rs = (RedstoneMode) cm.getSetting( Settings.REDSTONE_CONTROLLED );
RedstoneMode rs = (RedstoneMode) this.cm.getSetting( Settings.REDSTONE_CONTROLLED );
if ( rs == RedstoneMode.HIGH_SIGNAL )
return getRedstoneState();
return !getRedstoneState();
return this.getRedstoneState();
return !this.getRedstoneState();
}
@Override
public int[] getAccessibleSlotsBySide(ForgeDirection d)
{
if ( d == ForgeDirection.UP || d == ForgeDirection.DOWN )
return input;
return this.input;
return output;
return this.output;
}
@Override
public IConfigManager getConfigManager()
{
return cm;
return this.cm;
}
@Override
public IInventory getInventoryByName(String name)
{
if ( name.equals( "upgrades" ) )
return upgrades;
return this.upgrades;
if ( name.equals( "cells" ) )
return cells;
return this.cells;
return null;
}
@@ -210,21 +210,21 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
@Override
public int getInstalledUpgrades(Upgrades u)
{
return upgrades.getInstalledUpgrades( u );
return this.upgrades.getInstalledUpgrades( u );
}
@Override
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
{
updateTask();
this.updateTask();
}
boolean hasWork()
{
if ( isEnabled() )
if ( this.isEnabled() )
{
for (int x = 0; x < 6; x++)
if ( cells.getStackInSlot( x ) != null )
if ( this.cells.getStackInSlot( x ) != null )
return true;
}
@@ -234,18 +234,18 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
@Override
public TickingRequest getTickingRequest(IGridNode node)
{
return new TickingRequest( TickRates.IOPort.min, TickRates.IOPort.max, hasWork(), false );
return new TickingRequest( TickRates.IOPort.min, TickRates.IOPort.max, this.hasWork(), false );
}
@Override
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
{
if ( !gridProxy.isActive() )
if ( !this.gridProxy.isActive() )
return TickRateModulation.IDLE;
long ItemsToMove = 256;
switch (getInstalledUpgrades( Upgrades.SPEED ))
switch (this.getInstalledUpgrades( Upgrades.SPEED ))
{
case 1:
ItemsToMove *= 2;
@@ -260,35 +260,35 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
try
{
IMEInventory<IAEItemStack> itemNet = gridProxy.getStorage().getItemInventory();
IMEInventory<IAEFluidStack> fluidNet = gridProxy.getStorage().getFluidInventory();
IEnergySource energy = gridProxy.getEnergy();
IMEInventory<IAEItemStack> itemNet = this.gridProxy.getStorage().getItemInventory();
IMEInventory<IAEFluidStack> fluidNet = this.gridProxy.getStorage().getFluidInventory();
IEnergySource energy = this.gridProxy.getEnergy();
for (int x = 0; x < 6; x++)
{
ItemStack is = cells.getStackInSlot( x );
ItemStack is = this.cells.getStackInSlot( x );
if ( is != null )
{
if ( ItemsToMove > 0 )
{
IMEInventory<IAEItemStack> itemInv = getInv( is, StorageChannel.ITEMS );
IMEInventory<IAEFluidStack> fluidInv = getInv( is, StorageChannel.FLUIDS );
IMEInventory<IAEItemStack> itemInv = this.getInv( is, StorageChannel.ITEMS );
IMEInventory<IAEFluidStack> fluidInv = this.getInv( is, StorageChannel.FLUIDS );
if ( cm.getSetting( Settings.OPERATION_MODE ) == OperationMode.EMPTY )
if ( this.cm.getSetting( Settings.OPERATION_MODE ) == OperationMode.EMPTY )
{
if ( itemInv != null )
ItemsToMove = transferContents( energy, itemInv, itemNet, ItemsToMove, StorageChannel.ITEMS );
ItemsToMove = this.transferContents( energy, itemInv, itemNet, ItemsToMove, StorageChannel.ITEMS );
if ( fluidInv != null )
ItemsToMove = transferContents( energy, fluidInv, fluidNet, ItemsToMove, StorageChannel.FLUIDS );
ItemsToMove = this.transferContents( energy, fluidInv, fluidNet, ItemsToMove, StorageChannel.FLUIDS );
}
else
{
if ( itemInv != null )
ItemsToMove = transferContents( energy, itemNet, itemInv, ItemsToMove, StorageChannel.ITEMS );
ItemsToMove = this.transferContents( energy, itemNet, itemInv, ItemsToMove, StorageChannel.ITEMS );
if ( fluidInv != null )
ItemsToMove = transferContents( energy, fluidNet, fluidInv, ItemsToMove, StorageChannel.FLUIDS );
ItemsToMove = this.transferContents( energy, fluidNet, fluidInv, ItemsToMove, StorageChannel.FLUIDS );
}
if ( ItemsToMove > 0 && shouldMove( itemInv, fluidInv ) && !moveSlot( x ) )
if ( ItemsToMove > 0 && this.shouldMove( itemInv, fluidInv ) && !this.moveSlot( x ) )
return TickRateModulation.IDLE;
return TickRateModulation.URGENT;
@@ -310,14 +310,14 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
private boolean shouldMove(IMEInventory<IAEItemStack> itemInv, IMEInventory<IAEFluidStack> fluidInv)
{
FullnessMode fm = (FullnessMode) cm.getSetting( Settings.FULLNESS_MODE );
FullnessMode fm = (FullnessMode) this.cm.getSetting( Settings.FULLNESS_MODE );
if ( itemInv != null && fluidInv != null )
return matches( fm, itemInv ) && matches( fm, fluidInv );
return this.matches( fm, itemInv ) && this.matches( fm, fluidInv );
else if ( itemInv != null )
return matches( fm, itemInv );
return this.matches( fm, itemInv );
else if ( fluidInv != null )
return matches( fm, fluidInv );
return this.matches( fm, fluidInv );
return true;
}
@@ -341,7 +341,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
if ( test != null )
{
test.setStackSize( 1 );
return src.injectItems( test, Actionable.SIMULATE, mySrc ) != null;
return src.injectItems( test, Actionable.SIMULATE, this.mySrc ) != null;
}
return false;
}
@@ -352,17 +352,17 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
private IMEInventory getInv(ItemStack is, StorageChannel chan)
{
if ( currentCell != is )
if ( this.currentCell != is )
{
currentCell = is;
cachedFluid = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.FLUIDS );
cachedItem = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.ITEMS );
this.currentCell = is;
this.cachedFluid = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.FLUIDS );
this.cachedItem = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.ITEMS );
}
if ( StorageChannel.ITEMS == chan )
return cachedItem;
return this.cachedItem;
return cachedFluid;
return this.cachedFluid;
}
private long transferContents(IEnergySource energy, IMEInventory src, IMEInventory destination, long itemsToMove, StorageChannel chan)
@@ -384,7 +384,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
long totalStackSize = s.getStackSize();
if ( totalStackSize > 0 )
{
IAEStack stack = destination.injectItems( s, Actionable.SIMULATE, mySrc );
IAEStack stack = destination.injectItems( s, Actionable.SIMULATE, this.mySrc );
long possible = 0;
if ( stack == null )
@@ -397,16 +397,16 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
possible = Math.min( possible, itemsToMove );
s.setStackSize( possible );
IAEStack extracted = src.extractItems( s, Actionable.MODULATE, mySrc );
IAEStack extracted = src.extractItems( s, Actionable.MODULATE, this.mySrc );
if ( extracted != null )
{
possible = extracted.getStackSize();
IAEStack failed = Platform.poweredInsert( energy, destination, extracted, mySrc );
IAEStack failed = Platform.poweredInsert( energy, destination, extracted, this.mySrc );
if ( failed != null )
{
possible -= failed.getStackSize();
src.injectItems( failed, Actionable.MODULATE, mySrc );
src.injectItems( failed, Actionable.MODULATE, this.mySrc );
}
if ( possible > 0 )
@@ -428,12 +428,12 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
private boolean moveSlot(int x)
{
WrapperInventoryRange wir = new WrapperInventoryRange( this, outputSlots, true );
ItemStack result = InventoryAdaptor.getAdaptor( wir, ForgeDirection.UNKNOWN ).addItems( getStackInSlot( x ) );
WrapperInventoryRange wir = new WrapperInventoryRange( this, this.outputSlots, true );
ItemStack result = InventoryAdaptor.getAdaptor( wir, ForgeDirection.UNKNOWN ).addItems( this.getStackInSlot( x ) );
if ( result == null )
{
setInventorySlotContents( x, null );
this.setInventorySlotContents( x, null );
return true;
}
@@ -39,17 +39,17 @@ public class TileSkyChest extends AEBaseInvTile
@TileEvent(TileEventType.NETWORK_WRITE)
public void writeToStream_TileSkyChest(ByteBuf data)
{
data.writeBoolean( playerOpen > 0 );
data.writeBoolean( this.playerOpen > 0 );
}
@TileEvent(TileEventType.NETWORK_READ)
public boolean readFromStream_TileSkyChest(ByteBuf data)
{
int wasOpen = playerOpen;
playerOpen = data.readBoolean() ? 1 : 0;
int wasOpen = this.playerOpen;
this.playerOpen = data.readBoolean() ? 1 : 0;
if ( wasOpen != playerOpen )
lastEvent = System.currentTimeMillis();
if ( wasOpen != this.playerOpen )
this.lastEvent = System.currentTimeMillis();
return false; // TESR yo!
}
@@ -76,13 +76,13 @@ public class TileSkyChest extends AEBaseInvTile
@Override
public IInventory getInternalInventory()
{
return inv;
return this.inv;
}
@Override
public int[] getAccessibleSlotsBySide(ForgeDirection side)
{
return sides;
return this.sides;
}
@Override
@@ -91,12 +91,12 @@ public class TileSkyChest extends AEBaseInvTile
if ( Platform.isClient() )
return;
playerOpen++;
this.playerOpen++;
if ( playerOpen == 1 )
if ( this.playerOpen == 1 )
{
getWorldObj().playSoundEffect( xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "random.chestopen", 0.5F, getWorldObj().rand.nextFloat() * 0.1F + 0.9F );
markForUpdate();
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();
}
}
@@ -106,16 +106,16 @@ public class TileSkyChest extends AEBaseInvTile
if ( Platform.isClient() )
return;
playerOpen--;
this.playerOpen--;
if ( playerOpen < 0 )
playerOpen = 0;
if ( this.playerOpen < 0 )
this.playerOpen = 0;
if ( playerOpen == 0 )
if ( this.playerOpen == 0 )
{
getWorldObj().playSoundEffect( xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "random.chestclosed", 0.5F,
getWorldObj().rand.nextFloat() * 0.1F + 0.9F );
markForUpdate();
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();
}
}