final variables and parameters
This commit is contained in:
@@ -63,13 +63,13 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_WRITE )
|
||||
public void writeToNBT_TileSpatialIOPort( NBTTagCompound data )
|
||||
public void writeToNBT_TileSpatialIOPort( final NBTTagCompound data )
|
||||
{
|
||||
data.setInteger( "lastRedstoneState", this.lastRedstoneState.ordinal() );
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_READ )
|
||||
public void readFromNBT_TileSpatialIOPort( NBTTagCompound data )
|
||||
public void readFromNBT_TileSpatialIOPort( final NBTTagCompound data )
|
||||
{
|
||||
if( data.hasKey( "lastRedstoneState" ) )
|
||||
{
|
||||
@@ -89,7 +89,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
|
||||
|
||||
public void updateRedstoneState()
|
||||
{
|
||||
YesNo currentState = this.worldObj.isBlockIndirectlyGettingPowered( pos ) != 0 ? YesNo.YES : YesNo.NO;
|
||||
final YesNo currentState = this.worldObj.isBlockIndirectlyGettingPowered( pos ) != 0 ? YesNo.YES : YesNo.NO;
|
||||
if( this.lastRedstoneState != currentState )
|
||||
{
|
||||
this.lastRedstoneState = currentState;
|
||||
@@ -104,7 +104,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
ItemStack cell = this.getStackInSlot( 0 );
|
||||
final ItemStack cell = this.getStackInSlot( 0 );
|
||||
if( this.isSpatialCell( cell ) )
|
||||
{
|
||||
TickHandler.INSTANCE.addCallable( null, this );// this needs to be cross world synced.
|
||||
@@ -112,38 +112,38 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSpatialCell( ItemStack cell )
|
||||
private boolean isSpatialCell( final ItemStack cell )
|
||||
{
|
||||
if( cell != null && cell.getItem() instanceof ISpatialStorageCell )
|
||||
{
|
||||
ISpatialStorageCell sc = (ISpatialStorageCell) cell.getItem();
|
||||
final ISpatialStorageCell sc = (ISpatialStorageCell) cell.getItem();
|
||||
return sc != null && sc.isSpatialStorage( cell );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void call( World world ) throws Exception
|
||||
public Void call( final World world ) throws Exception
|
||||
{
|
||||
ItemStack cell = this.getStackInSlot( 0 );
|
||||
final ItemStack cell = this.getStackInSlot( 0 );
|
||||
if( this.isSpatialCell( cell ) && this.getStackInSlot( 1 ) == null )
|
||||
{
|
||||
IGrid gi = this.gridProxy.getGrid();
|
||||
IEnergyGrid energy = this.gridProxy.getEnergy();
|
||||
final IGrid gi = this.gridProxy.getGrid();
|
||||
final IEnergyGrid energy = this.gridProxy.getEnergy();
|
||||
|
||||
ISpatialStorageCell sc = (ISpatialStorageCell) cell.getItem();
|
||||
final ISpatialStorageCell sc = (ISpatialStorageCell) cell.getItem();
|
||||
|
||||
SpatialPylonCache spc = gi.getCache( ISpatialCache.class );
|
||||
final SpatialPylonCache spc = gi.getCache( ISpatialCache.class );
|
||||
if( spc.hasRegion() && spc.isValidRegion() )
|
||||
{
|
||||
double req = spc.requiredPower();
|
||||
double pr = energy.extractAEPower( req, Actionable.SIMULATE, PowerMultiplier.CONFIG );
|
||||
final double req = spc.requiredPower();
|
||||
final double pr = energy.extractAEPower( req, Actionable.SIMULATE, PowerMultiplier.CONFIG );
|
||||
if( Math.abs( pr - req ) < req * 0.001 )
|
||||
{
|
||||
MENetworkEvent res = gi.postEvent( new MENetworkSpatialEvent( this, req ) );
|
||||
final MENetworkEvent res = gi.postEvent( new MENetworkSpatialEvent( this, req ) );
|
||||
if( !res.isCanceled() )
|
||||
{
|
||||
TransitionResult tr = sc.doSpatialTransition( cell, this.worldObj, spc.getMin(), spc.getMax(), true );
|
||||
final TransitionResult tr = sc.doSpatialTransition( cell, this.worldObj, spc.getMin(), spc.getMax(), true );
|
||||
if( tr.success )
|
||||
{
|
||||
energy.extractAEPower( req, Actionable.MODULATE, PowerMultiplier.CONFIG );
|
||||
@@ -159,7 +159,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
public AECableType getCableConnectionType( final AEPartLocation dir )
|
||||
{
|
||||
return AECableType.SMART;
|
||||
}
|
||||
@@ -177,31 +177,31 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot( int i, ItemStack itemstack )
|
||||
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
|
||||
{
|
||||
return ( i == 0 && this.isSpatialCell( itemstack ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory( IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added )
|
||||
public void onChangeInventory( final IInventory inv, final int slot, final InvOperation mc, final ItemStack removed, final ItemStack added )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, EnumFacing side )
|
||||
public boolean canInsertItem( final int slotIndex, final ItemStack insertingItem, final EnumFacing side )
|
||||
{
|
||||
return this.isItemValidForSlot( slotIndex, insertingItem );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, EnumFacing side )
|
||||
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final EnumFacing side )
|
||||
{
|
||||
return slotIndex == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide( EnumFacing side )
|
||||
public int[] getAccessibleSlotsBySide( final EnumFacing side )
|
||||
{
|
||||
return this.sides;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnect( boolean b )
|
||||
public void disconnect( final boolean b )
|
||||
{
|
||||
if( this.cluster != null )
|
||||
{
|
||||
@@ -119,7 +119,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
|
||||
return true;
|
||||
}
|
||||
|
||||
public void updateStatus( SpatialPylonCluster c )
|
||||
public void updateStatus( final SpatialPylonCluster c )
|
||||
{
|
||||
this.cluster = c;
|
||||
this.gridProxy.setValidSides( c == null ? EnumSet.noneOf( EnumFacing.class ) : EnumSet.allOf( EnumFacing.class ) );
|
||||
@@ -128,7 +128,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
|
||||
|
||||
public void recalculateDisplay()
|
||||
{
|
||||
int oldBits = this.displayBits;
|
||||
final int oldBits = this.displayBits;
|
||||
|
||||
this.displayBits = 0;
|
||||
|
||||
@@ -175,7 +175,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
|
||||
this.displayBits |= DISPLAY_ENABLED;
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// nothing?
|
||||
}
|
||||
@@ -191,7 +191,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
|
||||
public void markForUpdate()
|
||||
{
|
||||
super.markForUpdate();
|
||||
boolean hasLight = this.getLightValue() > 0;
|
||||
final boolean hasLight = this.getLightValue() > 0;
|
||||
if( hasLight != this.didHaveLight )
|
||||
{
|
||||
this.didHaveLight = hasLight;
|
||||
@@ -216,27 +216,27 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.NETWORK_READ )
|
||||
public boolean readFromStream_TileSpatialPylon( ByteBuf data )
|
||||
public boolean readFromStream_TileSpatialPylon( final ByteBuf data )
|
||||
{
|
||||
int old = this.displayBits;
|
||||
final int old = this.displayBits;
|
||||
this.displayBits = data.readByte();
|
||||
return old != this.displayBits;
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.NETWORK_WRITE )
|
||||
public void writeToStream_TileSpatialPylon( ByteBuf data )
|
||||
public void writeToStream_TileSpatialPylon( final ByteBuf data )
|
||||
{
|
||||
data.writeByte( this.displayBits );
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void powerRender( MENetworkPowerStatusChange c )
|
||||
public void powerRender( final MENetworkPowerStatusChange c )
|
||||
{
|
||||
this.recalculateDisplay();
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void activeRender( MENetworkChannelsChanged c )
|
||||
public void activeRender( final MENetworkChannelsChanged c )
|
||||
{
|
||||
this.recalculateDisplay();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user