final variables and parameters

seeing some methods it does actually help to enforce the parameters
This commit is contained in:
thatsIch
2015-09-25 23:10:56 +02:00
parent e52400bf26
commit 410d2f1e0d
819 changed files with 9390 additions and 9396 deletions
+20 -20
View File
@@ -39,13 +39,13 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
{
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_AEBaseInvTile( net.minecraft.nbt.NBTTagCompound data )
public void readFromNBT_AEBaseInvTile( final net.minecraft.nbt.NBTTagCompound data )
{
IInventory inv = this.getInternalInventory();
NBTTagCompound opt = data.getCompoundTag( "inv" );
final IInventory inv = this.getInternalInventory();
final NBTTagCompound opt = data.getCompoundTag( "inv" );
for( int x = 0; x < inv.getSizeInventory(); x++ )
{
NBTTagCompound item = opt.getCompoundTag( "item" + x );
final NBTTagCompound item = opt.getCompoundTag( "item" + x );
inv.setInventorySlotContents( x, ItemStack.loadItemStackFromNBT( item ) );
}
}
@@ -53,14 +53,14 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
public abstract IInventory getInternalInventory();
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_AEBaseInvTile( net.minecraft.nbt.NBTTagCompound data )
public void writeToNBT_AEBaseInvTile( final net.minecraft.nbt.NBTTagCompound data )
{
IInventory inv = this.getInternalInventory();
NBTTagCompound opt = new NBTTagCompound();
final IInventory inv = this.getInternalInventory();
final NBTTagCompound opt = new NBTTagCompound();
for( int x = 0; x < inv.getSizeInventory(); x++ )
{
NBTTagCompound item = new NBTTagCompound();
ItemStack is = this.getStackInSlot( x );
final NBTTagCompound item = new NBTTagCompound();
final ItemStack is = this.getStackInSlot( x );
if( is != null )
{
is.writeToNBT( item );
@@ -77,25 +77,25 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
}
@Override
public ItemStack getStackInSlot( int i )
public ItemStack getStackInSlot( final int i )
{
return this.getInternalInventory().getStackInSlot( i );
}
@Override
public ItemStack decrStackSize( int i, int j )
public ItemStack decrStackSize( final int i, final int j )
{
return this.getInternalInventory().decrStackSize( i, j );
}
@Override
public ItemStack getStackInSlotOnClosing( int i )
public ItemStack getStackInSlotOnClosing( final int i )
{
return null;
}
@Override
public void setInventorySlotContents( int i, @Nullable ItemStack itemstack )
public void setInventorySlotContents( final int i, @Nullable final ItemStack itemstack )
{
this.getInternalInventory().setInventorySlotContents( i, itemstack );
}
@@ -125,7 +125,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
}
@Override
public boolean isUseableByPlayer( EntityPlayer p )
public boolean isUseableByPlayer( final EntityPlayer p )
{
final double squaredMCReach = 64.0D;
@@ -143,7 +143,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return true;
}
@@ -152,25 +152,25 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
public abstract void onChangeInventory( IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added );
@Override
public final int[] getAccessibleSlotsFromSide( int side )
public final int[] getAccessibleSlotsFromSide( final int side )
{
Block blk = this.worldObj.getBlock( this.xCoord, this.yCoord, this.zCoord );
final Block blk = this.worldObj.getBlock( this.xCoord, this.yCoord, this.zCoord );
if( blk instanceof AEBaseBlock )
{
ForgeDirection mySide = ForgeDirection.getOrientation( side );
final ForgeDirection mySide = ForgeDirection.getOrientation( side );
return this.getAccessibleSlotsBySide( ( (AEBaseBlock) blk ).mapRotation( this, mySide ) );
}
return this.getAccessibleSlotsBySide( ForgeDirection.getOrientation( side ) );
}
@Override
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, int side )
public boolean canInsertItem( final int slotIndex, final ItemStack insertingItem, final int side )
{
return this.isItemValidForSlot( slotIndex, insertingItem );
}
@Override
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final int side )
{
return true;
}
+51 -51
View File
@@ -73,14 +73,14 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
private ForgeDirection forward = ForgeDirection.UNKNOWN;
private ForgeDirection up = ForgeDirection.UNKNOWN;
public static void registerTileItem( Class<? extends TileEntity> c, IStackSrc wat )
public static void registerTileItem( final Class<? extends TileEntity> c, final IStackSrc wat )
{
ITEM_STACKS.put( c, wat );
}
public boolean dropItems()
{
WeakReference<AEBaseTile> what = DROP_NO_ITEMS.get();
final WeakReference<AEBaseTile> what = DROP_NO_ITEMS.get();
return what == null || what.get() != this;
}
@@ -96,9 +96,9 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
@Nullable
protected ItemStack getItemFromTile( Object obj )
protected ItemStack getItemFromTile( final Object obj )
{
IStackSrc src = ITEM_STACKS.get( obj.getClass() );
final IStackSrc src = ITEM_STACKS.get( obj.getClass() );
if( src == null )
{
return null;
@@ -119,7 +119,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
@Override
// NOTE: WAS FINAL, changed for Immibis
public final void readFromNBT( NBTTagCompound data )
public final void readFromNBT( final NBTTagCompound data )
{
super.readFromNBT( data );
@@ -140,11 +140,11 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
this.up = ForgeDirection.valueOf( data.getString( "orientation_up" ) );
}
}
catch( IllegalArgumentException ignored )
catch( final IllegalArgumentException ignored )
{
}
for( AETileEventHandler h : this.getHandlerListFor( TileEventType.WORLD_NBT_READ ) )
for( final AETileEventHandler h : this.getHandlerListFor( TileEventType.WORLD_NBT_READ ) )
{
h.readFromNBT( this, data );
}
@@ -152,7 +152,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
@Override
// NOTE: WAS FINAL, changed for Immibis
public final void writeToNBT( NBTTagCompound data )
public final void writeToNBT( final NBTTagCompound data )
{
super.writeToNBT( data );
@@ -167,7 +167,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
data.setString( "customName", this.customName );
}
for( AETileEventHandler h : this.getHandlerListFor( TileEventType.WORLD_NBT_WRITE ) )
for( final AETileEventHandler h : this.getHandlerListFor( TileEventType.WORLD_NBT_WRITE ) )
{
h.writeToNBT( this, data );
}
@@ -176,7 +176,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
@Override
public final void updateEntity()
{
for( AETileEventHandler h : this.getHandlerListFor( TileEventType.TICK ) )
for( final AETileEventHandler h : this.getHandlerListFor( TileEventType.TICK ) )
{
h.tick( this );
}
@@ -185,9 +185,9 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
@Override
public Packet getDescriptionPacket()
{
NBTTagCompound data = new NBTTagCompound();
final NBTTagCompound data = new NBTTagCompound();
ByteBuf stream = Unpooled.buffer();
final ByteBuf stream = Unpooled.buffer();
try
{
@@ -197,7 +197,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
return null;
}
}
catch( Throwable t )
catch( final Throwable t )
{
AELog.error( t );
}
@@ -213,20 +213,20 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
return this.hasHandlerFor( TileEventType.TICK );
}
private boolean hasHandlerFor( TileEventType type )
private boolean hasHandlerFor( final TileEventType type )
{
List<AETileEventHandler> list = this.getHandlerListFor( type );
final List<AETileEventHandler> list = this.getHandlerListFor( type );
return !list.isEmpty();
}
@Override
public void onDataPacket( NetworkManager net, S35PacketUpdateTileEntity pkt )
public void onDataPacket( final NetworkManager net, final S35PacketUpdateTileEntity pkt )
{
// / pkt.actionType
if( pkt.func_148853_f() == 64 )
{
ByteBuf stream = Unpooled.copiedBuffer( pkt.func_148857_g().getByteArray( "X" ) );
final ByteBuf stream = Unpooled.copiedBuffer( pkt.func_148857_g().getByteArray( "X" ) );
if( this.readFromStream( stream ) )
{
this.markForUpdate();
@@ -243,7 +243,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
}
public final boolean readFromStream( ByteBuf data )
public final boolean readFromStream( final ByteBuf data )
{
boolean output = false;
@@ -252,10 +252,10 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
if( this.canBeRotated() )
{
ForgeDirection old_Forward = this.forward;
ForgeDirection old_Up = this.up;
final ForgeDirection old_Forward = this.forward;
final ForgeDirection old_Up = this.up;
byte orientation = data.readByte();
final byte orientation = data.readByte();
this.forward = ForgeDirection.getOrientation( orientation & 0x7 );
this.up = ForgeDirection.getOrientation( orientation >> 3 );
@@ -263,7 +263,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
this.renderFragment = 100;
for( AETileEventHandler h : this.getHandlerListFor( TileEventType.NETWORK_READ ) )
for( final AETileEventHandler h : this.getHandlerListFor( TileEventType.NETWORK_READ ) )
{
if( h.readFromStream( this, data ) )
{
@@ -277,7 +277,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
this.renderFragment = 0;
}
catch( Throwable t )
catch( final Throwable t )
{
AELog.error( t );
}
@@ -302,22 +302,22 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
}
public final void writeToStream( ByteBuf data )
public final void writeToStream( final ByteBuf data )
{
try
{
if( this.canBeRotated() )
{
byte orientation = (byte) ( ( this.up.ordinal() << 3 ) | this.forward.ordinal() );
final byte orientation = (byte) ( ( this.up.ordinal() << 3 ) | this.forward.ordinal() );
data.writeByte( orientation );
}
for( AETileEventHandler h : this.getHandlerListFor( TileEventType.NETWORK_WRITE ) )
for( final AETileEventHandler h : this.getHandlerListFor( TileEventType.NETWORK_WRITE ) )
{
h.writeToStream( this, data );
}
}
catch( Throwable t )
catch( final Throwable t )
{
AELog.error( t );
}
@@ -335,7 +335,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
@Nonnull
private List<AETileEventHandler> getHandlerListFor( TileEventType type )
private List<AETileEventHandler> getHandlerListFor( final TileEventType type )
{
final Map<TileEventType, List<AETileEventHandler>> eventToHandlers = this.getEventToHandlers();
final List<AETileEventHandler> handlers = this.getHandlers( eventToHandlers, type );
@@ -355,9 +355,9 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
HANDLERS.put( clazz, newStoredHandlers );
for( Method method : clazz.getMethods() )
for( final Method method : clazz.getMethods() )
{
TileEvent event = method.getAnnotation( TileEvent.class );
final TileEvent event = method.getAnnotation( TileEvent.class );
if( event != null )
{
this.addHandler( newStoredHandlers, event.value(), method );
@@ -373,7 +373,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
@Nonnull
private List<AETileEventHandler> getHandlers( Map<TileEventType, List<AETileEventHandler>> eventToHandlers, TileEventType event )
private List<AETileEventHandler> getHandlers( final Map<TileEventType, List<AETileEventHandler>> eventToHandlers, final TileEventType event )
{
final List<AETileEventHandler> oldHandlers = eventToHandlers.get( event );
@@ -390,7 +390,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
}
private void addHandler( Map<TileEventType, List<AETileEventHandler>> handlerSet, TileEventType value, Method m )
private void addHandler( final Map<TileEventType, List<AETileEventHandler>> handlerSet, final TileEventType value, final Method m )
{
List<AETileEventHandler> list = handlerSet.get( value );
@@ -416,7 +416,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
@Override
public void setOrientation( ForgeDirection inForward, ForgeDirection inUp )
public void setOrientation( final ForgeDirection inForward, final ForgeDirection inUp )
{
this.forward = inForward;
this.up = inUp;
@@ -424,7 +424,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
Platform.notifyBlocksOfNeighbors( this.worldObj, this.xCoord, this.yCoord, this.zCoord );
}
public void onPlacement( ItemStack stack, EntityPlayer player, int side )
public void onPlacement( final ItemStack stack, final EntityPlayer player, final int side )
{
if( stack.hasTagCompound() )
{
@@ -438,11 +438,11 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
* @param from source of settings
* @param compound compound of source
*/
public void uploadSettings( SettingsFrom from, NBTTagCompound compound )
public void uploadSettings( final SettingsFrom from, final NBTTagCompound compound )
{
if( compound != null && this instanceof IConfigurableObject )
{
IConfigManager cm = ( (IConfigurableObject) this ).getConfigManager();
final IConfigManager cm = ( (IConfigurableObject) this ).getConfigManager();
if( cm != null )
{
cm.readFromNBT( compound );
@@ -451,17 +451,17 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
if( this instanceof IPriorityHost )
{
IPriorityHost pHost = (IPriorityHost) this;
final IPriorityHost pHost = (IPriorityHost) this;
pHost.setPriority( compound.getInteger( "priority" ) );
}
if( this instanceof ISegmentedInventory )
{
IInventory inv = ( (ISegmentedInventory) this ).getInventoryByName( "config" );
final IInventory inv = ( (ISegmentedInventory) this ).getInventoryByName( "config" );
if( inv instanceof AppEngInternalAEInventory )
{
AppEngInternalAEInventory target = (AppEngInternalAEInventory) inv;
AppEngInternalAEInventory tmp = new AppEngInternalAEInventory( null, target.getSizeInventory() );
final AppEngInternalAEInventory target = (AppEngInternalAEInventory) inv;
final AppEngInternalAEInventory tmp = new AppEngInternalAEInventory( null, target.getSizeInventory() );
tmp.readFromNBT( compound, "config" );
for( int x = 0; x < tmp.getSizeInventory(); x++ )
{
@@ -481,15 +481,15 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
* @param drops drops of tile entity
*/
@Override
public void getDrops( World w, int x, int y, int z, List<ItemStack> drops )
public void getDrops( final World w, final int x, final int y, final int z, final List<ItemStack> drops )
{
if( this instanceof IInventory )
{
IInventory inv = (IInventory) this;
final IInventory inv = (IInventory) this;
for( int l = 0; l < inv.getSizeInventory(); l++ )
{
ItemStack is = inv.getStackInSlot( l );
final ItemStack is = inv.getStackInSlot( l );
if( is != null )
{
drops.add( is );
@@ -498,7 +498,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
}
public void getNoDrops( World w, int x, int y, int z, List<ItemStack> drops )
public void getNoDrops( final World w, final int x, final int y, final int z, final List<ItemStack> drops )
{
}
@@ -515,20 +515,20 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
*
* @return compound of source
*/
public NBTTagCompound downloadSettings( SettingsFrom from )
public NBTTagCompound downloadSettings( final SettingsFrom from )
{
NBTTagCompound output = new NBTTagCompound();
final NBTTagCompound output = new NBTTagCompound();
if( this.hasCustomName() )
{
NBTTagCompound dsp = new NBTTagCompound();
final NBTTagCompound dsp = new NBTTagCompound();
dsp.setString( "Name", this.getCustomName() );
output.setTag( "display", dsp );
}
if( this instanceof IConfigurableObject )
{
IConfigManager cm = ( (IConfigurableObject) this ).getConfigManager();
final IConfigManager cm = ( (IConfigurableObject) this ).getConfigManager();
if( cm != null )
{
cm.writeToNBT( output );
@@ -537,13 +537,13 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
if( this instanceof IPriorityHost )
{
IPriorityHost pHost = (IPriorityHost) this;
final IPriorityHost pHost = (IPriorityHost) this;
output.setInteger( "priority", pHost.getPriority() );
}
if( this instanceof ISegmentedInventory )
{
IInventory inv = ( (ISegmentedInventory) this ).getInventoryByName( "config" );
final IInventory inv = ( (ISegmentedInventory) this ).getInventoryByName( "config" );
if( inv instanceof AppEngInternalAEInventory )
{
( (AppEngInternalAEInventory) inv ).writeToNBT( output, "config" );
@@ -586,7 +586,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
return false;
}
public void setName( String name )
public void setName( final String name )
{
this.customName = name;
}
@@ -51,12 +51,12 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
AEColor paintedColor = AEColor.Transparent;
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileCraftingMonitorTile( ByteBuf data ) throws IOException
public boolean readFromStream_TileCraftingMonitorTile( final ByteBuf data ) throws IOException
{
AEColor oldPaintedColor = this.paintedColor;
final AEColor oldPaintedColor = this.paintedColor;
this.paintedColor = AEColor.values()[data.readByte()];
boolean hasItem = data.readBoolean();
final boolean hasItem = data.readBoolean();
if( hasItem )
{
@@ -72,7 +72,7 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
}
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileCraftingMonitorTile( ByteBuf data ) throws IOException
public void writeToStream_TileCraftingMonitorTile( final ByteBuf data ) throws IOException
{
data.writeByte( this.paintedColor.ordinal() );
@@ -88,7 +88,7 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileCraftingMonitorTile( NBTTagCompound data )
public void readFromNBT_TileCraftingMonitorTile( final NBTTagCompound data )
{
if( data.hasKey( "paintedColor" ) )
{
@@ -97,7 +97,7 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileCraftingMonitorTile( NBTTagCompound data )
public void writeToNBT_TileCraftingMonitorTile( final NBTTagCompound data )
{
data.setByte( "paintedColor", (byte) this.paintedColor.ordinal() );
}
@@ -114,7 +114,7 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
return true;
}
public void setJob( IAEItemStack is )
public void setJob( final IAEItemStack is )
{
if( ( is == null ) != ( this.dspPlay == null ) )
{
@@ -149,7 +149,7 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
}
@Override
public boolean recolourBlock( ForgeDirection side, AEColor newPaintedColor, EntityPlayer who )
public boolean recolourBlock( final ForgeDirection side, final AEColor newPaintedColor, final EntityPlayer who )
{
if( this.paintedColor == newPaintedColor )
{
@@ -30,7 +30,7 @@ public class TileCraftingStorageTile extends TileCraftingTile
public static final int KILO_SCALAR = 1024;
@Override
protected ItemStack getItemFromTile( Object obj )
protected ItemStack getItemFromTile( final Object obj )
{
final IBlocks blocks = AEApi.instance().definitions().blocks();
final int storage = ( (TileCraftingTile) obj ).getStorageBytes() / KILO_SCALAR;
@@ -38,19 +38,19 @@ public class TileCraftingStorageTile extends TileCraftingTile
switch( storage )
{
case 4:
for( ItemStack stack : blocks.craftingStorage4k().maybeStack( 1 ).asSet() )
for( final ItemStack stack : blocks.craftingStorage4k().maybeStack( 1 ).asSet() )
{
return stack;
}
break;
case 16:
for( ItemStack stack : blocks.craftingStorage16k().maybeStack( 1 ).asSet() )
for( final ItemStack stack : blocks.craftingStorage16k().maybeStack( 1 ).asSet() )
{
return stack;
}
break;
case 64:
for( ItemStack stack : blocks.craftingStorage64k().maybeStack( 1 ).asSet() )
for( final ItemStack stack : blocks.craftingStorage64k().maybeStack( 1 ).asSet() )
{
return stack;
}
@@ -76,11 +76,11 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
}
@Override
protected ItemStack getItemFromTile( Object obj )
protected ItemStack getItemFromTile( final Object obj )
{
if( ( (TileCraftingTile) obj ).isAccelerator() )
{
for( ItemStack accelerator : AEApi.instance().definitions().blocks().craftingAccelerator().maybeStack( 1 ).asSet() )
for( final ItemStack accelerator : AEApi.instance().definitions().blocks().craftingAccelerator().maybeStack( 1 ).asSet() )
{
return accelerator;
}
@@ -97,7 +97,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
}
@Override
public void setName( String name )
public void setName( final String name )
{
super.setName( name );
if( this.cluster != null )
@@ -128,7 +128,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
this.calc.calculateMultiblock( this.worldObj, this.getLocation() );
}
public void updateStatus( CraftingCPUCluster c )
public void updateStatus( final CraftingCPUCluster c )
{
if( this.cluster != null && this.cluster != c )
{
@@ -139,14 +139,14 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
this.updateMeta( true );
}
public void updateMeta( boolean updateFormed )
public void updateMeta( final boolean updateFormed )
{
if( this.worldObj == null || this.notLoaded() )
{
return;
}
boolean formed = this.isFormed();
final boolean formed = this.isFormed();
boolean power = false;
if( this.gridProxy.isReady() )
@@ -154,8 +154,8 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
power = this.gridProxy.isActive();
}
int current = this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord );
int newMeta = ( current & 3 ) | ( formed ? 8 : 0 ) | ( power ? 4 : 0 );
final int current = this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord );
final int newMeta = ( current & 3 ) | ( formed ? 8 : 0 ) | ( power ? 4 : 0 );
if( current != newMeta )
{
@@ -185,7 +185,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileCraftingTile( NBTTagCompound data )
public void writeToNBT_TileCraftingTile( final NBTTagCompound data )
{
data.setBoolean( "core", this.isCoreBlock );
if( this.isCoreBlock && this.cluster != null )
@@ -195,7 +195,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileCraftingTile( NBTTagCompound data )
public void readFromNBT_TileCraftingTile( final NBTTagCompound data )
{
this.isCoreBlock = data.getBoolean( "core" );
if( this.isCoreBlock )
@@ -212,7 +212,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
}
@Override
public void disconnect( boolean update )
public void disconnect( final boolean update )
{
if( this.cluster != null )
{
@@ -237,13 +237,13 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
}
@MENetworkEventSubscribe
public void onPowerStateChange( MENetworkChannelsChanged ev )
public void onPowerStateChange( final MENetworkChannelsChanged ev )
{
this.updateMeta( false );
}
@MENetworkEventSubscribe
public void onPowerStateChange( MENetworkPowerStatusChange ev )
public void onPowerStateChange( final MENetworkPowerStatusChange ev )
{
this.updateMeta( false );
}
@@ -268,25 +268,25 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
if( this.cluster != null )
{
this.cluster.cancel();
IMEInventory<IAEItemStack> inv = this.cluster.getInventory();
final IMEInventory<IAEItemStack> inv = this.cluster.getInventory();
LinkedList<WorldCoord> places = new LinkedList<WorldCoord>();
final LinkedList<WorldCoord> places = new LinkedList<WorldCoord>();
Iterator<IGridHost> i = this.cluster.getTiles();
final Iterator<IGridHost> i = this.cluster.getTiles();
while( i.hasNext() )
{
IGridHost h = i.next();
final IGridHost h = i.next();
if( h == this )
{
places.add( new WorldCoord( this ) );
}
else
{
TileEntity te = (TileEntity) h;
final TileEntity te = (TileEntity) h;
for( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
for( final ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
{
WorldCoord wc = new WorldCoord( te );
final WorldCoord wc = new WorldCoord( te );
wc.add( d, 1 );
if( this.worldObj.isAirBlock( wc.x, wc.y, wc.z ) )
{
@@ -309,13 +309,13 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
ais.setStackSize( ais.getItemStack().getMaxStackSize() );
while( true )
{
IAEItemStack g = inv.extractItems( ais.copy(), Actionable.MODULATE, this.cluster.getActionSource() );
final IAEItemStack g = inv.extractItems( ais.copy(), Actionable.MODULATE, this.cluster.getActionSource() );
if( g == null )
{
break;
}
WorldCoord wc = places.poll();
final WorldCoord wc = places.poll();
places.add( wc );
Platform.spawnDrops( this.worldObj, wc.x, wc.y, wc.z, Collections.singletonList( g.getItemStack() ) );
@@ -113,7 +113,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
@Override
public boolean pushPattern( ICraftingPatternDetails patternDetails, InventoryCrafting table, ForgeDirection where )
public boolean pushPattern( final ICraftingPatternDetails patternDetails, final InventoryCrafting table, final ForgeDirection where )
{
if( this.myPattern == null )
{
@@ -144,7 +144,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
private void updateSleepiness()
{
boolean wasEnabled = this.isAwake;
final boolean wasEnabled = this.isAwake;
this.isAwake = this.myPlan != null && this.hasMats() || this.canPush();
if( wasEnabled != this.isAwake )
{
@@ -159,7 +159,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
}
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// :P
}
@@ -193,34 +193,34 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
@Override
public int getInstalledUpgrades( Upgrades u )
public int getInstalledUpgrades( final Upgrades u )
{
return this.upgrades.getInstalledUpgrades( u );
}
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileMolecularAssembler( ByteBuf data )
public boolean readFromStream_TileMolecularAssembler( final ByteBuf data )
{
boolean oldPower = this.isPowered;
final boolean oldPower = this.isPowered;
this.isPowered = data.readBoolean();
return this.isPowered != oldPower;
}
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileMolecularAssembler( ByteBuf data )
public void writeToStream_TileMolecularAssembler( final ByteBuf data )
{
data.writeBoolean( this.isPowered );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileMolecularAssembler( NBTTagCompound data )
public void writeToNBT_TileMolecularAssembler( final NBTTagCompound data )
{
if( this.forcePlan && this.myPlan != null )
{
ItemStack pattern = this.myPlan.getPattern();
final ItemStack pattern = this.myPlan.getPattern();
if( pattern != null )
{
NBTTagCompound compound = new NBTTagCompound();
final NBTTagCompound compound = new NBTTagCompound();
pattern.writeToNBT( compound );
data.setTag( "myPlan", compound );
data.setInteger( "pushDirection", this.pushDirection.ordinal() );
@@ -233,17 +233,17 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileMolecularAssembler( NBTTagCompound data )
public void readFromNBT_TileMolecularAssembler( final NBTTagCompound data )
{
if( data.hasKey( "myPlan" ) )
{
ItemStack myPat = ItemStack.loadItemStackFromNBT( data.getCompoundTag( "myPlan" ) );
final ItemStack myPat = ItemStack.loadItemStackFromNBT( data.getCompoundTag( "myPlan" ) );
if( myPat != null && myPat.getItem() instanceof ItemEncodedPattern )
{
World w = this.getWorldObj();
ItemEncodedPattern iep = (ItemEncodedPattern) myPat.getItem();
ICraftingPatternDetails ph = iep.getPatternForItem( myPat, w );
final World w = this.getWorldObj();
final ItemEncodedPattern iep = (ItemEncodedPattern) myPat.getItem();
final ICraftingPatternDetails ph = iep.getPatternForItem( myPat, w );
if( ph != null && ph.isCraftable() )
{
this.forcePlan = true;
@@ -268,15 +268,15 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
return;
}
ItemStack is = this.inv.getStackInSlot( 10 );
final ItemStack is = this.inv.getStackInSlot( 10 );
if( is != null && is.getItem() instanceof ItemEncodedPattern )
{
if( !Platform.isSameItem( is, this.myPattern ) )
{
World w = this.getWorldObj();
ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
ICraftingPatternDetails ph = iep.getPatternForItem( is, w );
final World w = this.getWorldObj();
final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
final ICraftingPatternDetails ph = iep.getPatternForItem( is, w );
if( ph != null && ph.isCraftable() )
{
@@ -299,7 +299,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( final ForgeDirection dir )
{
return AECableType.COVERED;
}
@@ -317,7 +317,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
@Override
public IInventory getInventoryByName( String name )
public IInventory getInventoryByName( final String name )
{
if( name.equals( "upgrades" ) )
{
@@ -333,7 +333,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
@Override
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
{
}
@@ -351,7 +351,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
if( i >= 9 )
{
@@ -372,7 +372,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
@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 )
{
if( inv == this.inv )
{
@@ -381,13 +381,13 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
@Override
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final int side )
{
return slotIndex == 9;
}
@Override
public int[] getAccessibleSlotsBySide( ForgeDirection whichSide )
public int[] getAccessibleSlotsBySide( final ForgeDirection whichSide )
{
return SIDES;
}
@@ -398,13 +398,13 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
@Override
public void getDrops( World w, int x, int y, int z, List<ItemStack> drops )
public void getDrops( final World w, final int x, final int y, final int z, final List<ItemStack> drops )
{
super.getDrops( w, x, y, z, drops );
for( int h = 0; h < this.upgrades.getSizeInventory(); h++ )
{
ItemStack is = this.upgrades.getStackInSlot( h );
final ItemStack is = this.upgrades.getStackInSlot( h );
if( is != null )
{
drops.add( is );
@@ -413,7 +413,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
@Override
public TickingRequest getTickingRequest( IGridNode node )
public TickingRequest getTickingRequest( final IGridNode node )
{
this.recalculatePlan();
this.updateSleepiness();
@@ -421,7 +421,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
@Override
public TickRateModulation tickingRequest( IGridNode node, int ticksSinceLastCall )
public TickRateModulation tickingRequest( final IGridNode node, int ticksSinceLastCall )
{
if( this.inv.getStackInSlot( 9 ) != null )
{
@@ -487,7 +487,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
this.progress = 0;
ItemStack output = this.myPlan.getOutput( this.craftingInv, this.getWorldObj() );
final ItemStack output = this.myPlan.getOutput( this.craftingInv, this.getWorldObj() );
if( output != null )
{
FMLCommonHandler.instance().firePlayerCraftingEvent( Platform.getPlayer( (WorldServer) this.getWorldObj() ), output, this.craftingInv );
@@ -510,11 +510,11 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
try
{
TargetPoint where = new TargetPoint( this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, 32 );
IAEItemStack item = AEItemStack.create( output );
final TargetPoint where = new TargetPoint( this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, 32 );
final IAEItemStack item = AEItemStack.create( output );
NetworkHandler.instance.sendToAllAround( new PacketAssemblerAnimation( this.xCoord, this.yCoord, this.zCoord, (byte) speed, item ), where );
}
catch( IOException e )
catch( final IOException e )
{
// ;P
}
@@ -534,7 +534,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
for( int x = 0; x < 9; x++ )
{
ItemStack is = this.inv.getStackInSlot( x );
final ItemStack is = this.inv.getStackInSlot( x );
if( is != null )
{
if( this.myPlan == null || !this.myPlan.isValidItemForSlot( x, is, this.worldObj ) )
@@ -549,13 +549,13 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
}
private int userPower( int ticksPassed, int bonusValue, double acceleratorTax )
private int userPower( final int ticksPassed, final int bonusValue, final double acceleratorTax )
{
try
{
return (int) ( this.gridProxy.getEnergy().extractAEPower( ticksPassed * bonusValue * acceleratorTax, Actionable.MODULATE, PowerMultiplier.CONFIG ) / acceleratorTax );
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
return 0;
}
@@ -565,7 +565,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
if( this.pushDirection == ForgeDirection.UNKNOWN )
{
for( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
for( final ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
{
output = this.pushTo( output, d );
}
@@ -584,30 +584,30 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
this.inv.setInventorySlotContents( 9, output );
}
private ItemStack pushTo( ItemStack output, ForgeDirection d )
private ItemStack pushTo( ItemStack output, final ForgeDirection d )
{
if( output == null )
{
return output;
}
TileEntity te = this.getWorldObj().getTileEntity( this.xCoord + d.offsetX, this.yCoord + d.offsetY, this.zCoord + d.offsetZ );
final TileEntity te = this.getWorldObj().getTileEntity( this.xCoord + d.offsetX, this.yCoord + d.offsetY, this.zCoord + d.offsetZ );
if( te == null )
{
return output;
}
InventoryAdaptor adaptor = InventoryAdaptor.getAdaptor( te, d.getOpposite() );
final InventoryAdaptor adaptor = InventoryAdaptor.getAdaptor( te, d.getOpposite() );
if( adaptor == null )
{
return output;
}
int size = output.stackSize;
final int size = output.stackSize;
output = adaptor.addItems( output );
int newSize = output == null ? 0 : output.stackSize;
final int newSize = output == null ? 0 : output.stackSize;
if( size != newSize )
{
@@ -618,7 +618,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
@MENetworkEventSubscribe
public void onPowerEvent( MENetworkPowerStatusChange p )
public void onPowerEvent( final MENetworkPowerStatusChange p )
{
this.updatePowerState();
}
@@ -631,7 +631,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
newState = this.gridProxy.isActive() && this.gridProxy.getEnergy().extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.0001;
}
catch( GridAccessException ignored )
catch( final GridAccessException ignored )
{
}
@@ -37,90 +37,90 @@ public final class AETileEventHandler
private final Method method;
public AETileEventHandler( Method method )
public AETileEventHandler( final Method method )
{
this.method = method;
}
// TICK
public void tick( AEBaseTile tile )
public void tick( final AEBaseTile tile )
{
try
{
this.method.invoke( tile );
}
catch( IllegalAccessException e )
catch( final IllegalAccessException e )
{
throw new IllegalStateException( e );
}
catch( IllegalArgumentException e )
catch( final IllegalArgumentException e )
{
throw new IllegalStateException( e );
}
catch( InvocationTargetException e )
catch( final InvocationTargetException e )
{
throw new IllegalStateException( e );
}
}
// WORLD_NBT
public void writeToNBT( AEBaseTile tile, NBTTagCompound data )
public void writeToNBT( final AEBaseTile tile, final NBTTagCompound data )
{
try
{
this.method.invoke( tile, data );
}
catch( IllegalAccessException e )
catch( final IllegalAccessException e )
{
throw new IllegalStateException( e );
}
catch( IllegalArgumentException e )
catch( final IllegalArgumentException e )
{
throw new IllegalStateException( e );
}
catch( InvocationTargetException e )
catch( final InvocationTargetException e )
{
throw new IllegalStateException( e );
}
}
// WORLD NBT
public void readFromNBT( AEBaseTile tile, NBTTagCompound data )
public void readFromNBT( final AEBaseTile tile, final NBTTagCompound data )
{
try
{
this.method.invoke( tile, data );
}
catch( IllegalAccessException e )
catch( final IllegalAccessException e )
{
throw new IllegalStateException( e );
}
catch( IllegalArgumentException e )
catch( final IllegalArgumentException e )
{
throw new IllegalStateException( e );
}
catch( InvocationTargetException e )
catch( final InvocationTargetException e )
{
throw new IllegalStateException( e );
}
}
// NETWORK
public void writeToStream( AEBaseTile tile, ByteBuf data )
public void writeToStream( final AEBaseTile tile, final ByteBuf data )
{
try
{
this.method.invoke( tile, data );
}
catch( IllegalAccessException e )
catch( final IllegalAccessException e )
{
throw new IllegalStateException( e );
}
catch( IllegalArgumentException e )
catch( final IllegalArgumentException e )
{
throw new IllegalStateException( e );
}
catch( InvocationTargetException e )
catch( final InvocationTargetException e )
{
throw new IllegalStateException( e );
}
@@ -136,21 +136,21 @@ public final class AETileEventHandler
* @return true of method could be invoked
*/
@SideOnly( Side.CLIENT )
public boolean readFromStream( AEBaseTile tile, ByteBuf data )
public boolean readFromStream( final AEBaseTile tile, final ByteBuf data )
{
try
{
return (Boolean) this.method.invoke( tile, data );
}
catch( IllegalAccessException e )
catch( final IllegalAccessException e )
{
throw new IllegalStateException( e );
}
catch( IllegalArgumentException e )
catch( final IllegalArgumentException e )
{
throw new IllegalStateException( e );
}
catch( InvocationTargetException e )
catch( final InvocationTargetException e )
{
throw new IllegalStateException( e );
}
@@ -37,13 +37,13 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH
protected final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true );
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_AENetwork( NBTTagCompound data )
public void readFromNBT_AENetwork( final NBTTagCompound data )
{
this.gridProxy.readFromNBT( data );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_AENetwork( NBTTagCompound data )
public void writeToNBT_AENetwork( final NBTTagCompound data )
{
this.gridProxy.writeToNBT( data );
}
@@ -61,7 +61,7 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH
}
@Override
public IGridNode getGridNode( ForgeDirection dir )
public IGridNode getGridNode( final ForgeDirection dir )
{
return this.gridProxy.getNode();
}
@@ -39,13 +39,13 @@ public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IA
protected final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true );
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_AENetwork( NBTTagCompound data )
public void readFromNBT_AENetwork( final NBTTagCompound data )
{
this.gridProxy.readFromNBT( data );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_AENetwork( NBTTagCompound data )
public void writeToNBT_AENetwork( final NBTTagCompound data )
{
this.gridProxy.writeToNBT( data );
}
@@ -69,13 +69,13 @@ public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IA
}
@Override
public IGridNode getGridNode( ForgeDirection dir )
public IGridNode getGridNode( final ForgeDirection dir )
{
return this.gridProxy.getNode();
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( final ForgeDirection dir )
{
return AECableType.SMART;
}
@@ -39,13 +39,13 @@ public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxy
protected final AENetworkProxy gridProxy = this.createProxy();
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_AENetwork( NBTTagCompound data )
public void readFromNBT_AENetwork( final NBTTagCompound data )
{
this.gridProxy.readFromNBT( data );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_AENetwork( NBTTagCompound data )
public void writeToNBT_AENetwork( final NBTTagCompound data )
{
this.gridProxy.writeToNBT( data );
}
@@ -56,13 +56,13 @@ public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxy
}
@Override
public IGridNode getGridNode( ForgeDirection dir )
public IGridNode getGridNode( final ForgeDirection dir )
{
return this.gridProxy.getNode();
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( final ForgeDirection dir )
{
return AECableType.SMART;
}
@@ -60,7 +60,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
if( this.charge >= this.ticksPerRotation )
{
this.charge -= this.ticksPerRotation;
ICrankable g = this.getGrinder();
final ICrankable g = this.getGrinder();
if( g != null )
{
g.applyTurn();
@@ -78,8 +78,8 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
return null;
}
ForgeDirection grinder = this.getUp().getOpposite();
TileEntity te = this.worldObj.getTileEntity( this.xCoord + grinder.offsetX, this.yCoord + grinder.offsetY, this.zCoord + grinder.offsetZ );
final ForgeDirection grinder = this.getUp().getOpposite();
final TileEntity te = this.worldObj.getTileEntity( this.xCoord + grinder.offsetX, this.yCoord + grinder.offsetY, this.zCoord + grinder.offsetZ );
if( te instanceof ICrankable )
{
return (ICrankable) te;
@@ -88,20 +88,20 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
}
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileCrank( ByteBuf data )
public boolean readFromStream_TileCrank( final ByteBuf data )
{
this.rotation = data.readInt();
return false;
}
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileCrank( ByteBuf data )
public void writeToStream_TileCrank( final ByteBuf data )
{
data.writeInt( this.rotation );
}
@Override
public void setOrientation( ForgeDirection inForward, ForgeDirection inUp )
public void setOrientation( final ForgeDirection inForward, final ForgeDirection inUp )
{
super.setOrientation( inForward, inUp );
this.getBlockType().onNeighborBlockChange( this.worldObj, this.xCoord, this.yCoord, this.zCoord, Platform.AIR_BLOCK );
@@ -125,7 +125,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
if( this.rotation < 3 )
{
ICrankable g = this.getGrinder();
final ICrankable g = this.getGrinder();
if( g != null )
{
if( g.canTurn() )
@@ -151,20 +151,20 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( World w, int x, int y, int z, Entity e, boolean isVisual )
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final int x, final int y, final int z, final Entity e, final boolean isVisual )
{
double xOff = -0.15 * this.getUp().offsetX;
double yOff = -0.15 * this.getUp().offsetY;
double zOff = -0.15 * this.getUp().offsetZ;
final double xOff = -0.15 * this.getUp().offsetX;
final double yOff = -0.15 * this.getUp().offsetY;
final 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 )
public void addCollidingBlockToList( final World w, final int x, final int y, final int z, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
{
double xOff = -0.15 * this.getUp().offsetX;
double yOff = -0.15 * this.getUp().offsetY;
double zOff = -0.15 * this.getUp().offsetZ;
final double xOff = -0.15 * this.getUp().offsetX;
final double yOff = -0.15 * this.getUp().offsetY;
final 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 ) );
}
@@ -47,7 +47,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
int points;
@Override
public void setOrientation( ForgeDirection inForward, ForgeDirection inUp )
public void setOrientation( final ForgeDirection inForward, final ForgeDirection inUp )
{
super.setOrientation( inForward, inUp );
this.getBlockType().onNeighborBlockChange( this.worldObj, this.xCoord, this.yCoord, this.zCoord, Platform.AIR_BLOCK );
@@ -60,13 +60,13 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
}
@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, int side )
public boolean canInsertItem( final int slotIndex, final ItemStack insertingItem, final int side )
{
if( AEApi.instance().registries().grinder().getRecipeForInput( insertingItem ) == null )
{
@@ -77,13 +77,13 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
}
@Override
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final int side )
{
return slotIndex >= 3 && slotIndex <= 5;
}
@Override
public int[] getAccessibleSlotsBySide( ForgeDirection side )
public int[] getAccessibleSlotsBySide( final ForgeDirection side )
{
return this.sides;
}
@@ -98,7 +98,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
if( null == this.getStackInSlot( 6 ) ) // Add if there isn't one...
{
IInventory src = new WrapperInventoryRange( this, this.inputs, true );
final IInventory src = new WrapperInventoryRange( this, this.inputs, true );
for( int x = 0; x < src.getSizeInventory(); x++ )
{
ItemStack item = src.getStackInSlot( x );
@@ -107,13 +107,13 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
continue;
}
IGrinderEntry r = AEApi.instance().registries().grinder().getRecipeForInput( item );
final IGrinderEntry r = AEApi.instance().registries().grinder().getRecipeForInput( item );
if( r != null )
{
if( item.stackSize >= r.getInput().stackSize )
{
item.stackSize -= r.getInput().stackSize;
ItemStack ais = item.copy();
final ItemStack ais = item.copy();
ais.stackSize = r.getInput().stackSize;
if( item.stackSize <= 0 )
@@ -142,8 +142,8 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
this.points++;
ItemStack processing = this.getStackInSlot( 6 );
IGrinderEntry r = AEApi.instance().registries().grinder().getRecipeForInput( processing );
final ItemStack processing = this.getStackInSlot( 6 );
final IGrinderEntry r = AEApi.instance().registries().grinder().getRecipeForInput( processing );
if( r != null )
{
if( r.getEnergyCost() > this.points )
@@ -152,7 +152,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
}
this.points = 0;
InventoryAdaptor sia = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this, 3, 3, true ), ForgeDirection.EAST );
final InventoryAdaptor sia = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this, 3, 3, true ), ForgeDirection.EAST );
this.addItem( sia, r.getOutput() );
@@ -172,21 +172,21 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
}
}
private void addItem( InventoryAdaptor sia, ItemStack output )
private void addItem( final InventoryAdaptor sia, final ItemStack output )
{
if( output == null )
{
return;
}
ItemStack notAdded = sia.addItems( output );
final ItemStack notAdded = sia.addItems( output );
if( notAdded != null )
{
WorldCoord wc = new WorldCoord( this.xCoord, this.yCoord, this.zCoord );
final WorldCoord wc = new WorldCoord( this.xCoord, this.yCoord, this.zCoord );
wc.add( this.getForward(), 1 );
List<ItemStack> out = new ArrayList<ItemStack>();
final List<ItemStack> out = new ArrayList<ItemStack>();
out.add( notAdded );
Platform.spawnDrops( this.worldObj, wc.x, wc.y, wc.z, out );
@@ -194,7 +194,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
}
@Override
public boolean canCrankAttach( ForgeDirection directionToCrank )
public boolean canCrankAttach( final ForgeDirection directionToCrank )
{
return this.getUp() == directionToCrank;
}
@@ -43,7 +43,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
final int size;
int maxStack;
public AppEngInternalAEInventory( IAEAppEngInventory te, int s )
public AppEngInternalAEInventory( final IAEAppEngInventory te, final int s )
{
this.te = te;
this.size = s;
@@ -63,30 +63,30 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
return true;
}
public void setMaxStackSize( int s )
public void setMaxStackSize( final int s )
{
this.maxStack = s;
}
public IAEItemStack getAEStackInSlot( int var1 )
public IAEItemStack getAEStackInSlot( final int var1 )
{
return this.inv[var1];
}
public void writeToNBT( NBTTagCompound data, String name )
public void writeToNBT( final NBTTagCompound data, final String name )
{
NBTTagCompound c = new NBTTagCompound();
final NBTTagCompound c = new NBTTagCompound();
this.writeToNBT( c );
data.setTag( name, c );
}
public void writeToNBT( NBTTagCompound target )
public void writeToNBT( final NBTTagCompound target )
{
for( int x = 0; x < this.size; x++ )
{
try
{
NBTTagCompound c = new NBTTagCompound();
final NBTTagCompound c = new NBTTagCompound();
if( this.inv[x] != null )
{
@@ -95,35 +95,35 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
target.setTag( "#" + x, c );
}
catch( Exception ignored )
catch( final Exception ignored )
{
}
}
}
public void readFromNBT( NBTTagCompound data, String name )
public void readFromNBT( final NBTTagCompound data, final String name )
{
NBTTagCompound c = data.getCompoundTag( name );
final NBTTagCompound c = data.getCompoundTag( name );
if( c != null )
{
this.readFromNBT( c );
}
}
public void readFromNBT( NBTTagCompound target )
public void readFromNBT( final NBTTagCompound target )
{
for( int x = 0; x < this.size; x++ )
{
try
{
NBTTagCompound c = target.getCompoundTag( "#" + x );
final NBTTagCompound c = target.getCompoundTag( "#" + x );
if( c != null )
{
this.inv[x] = AEItemStack.loadItemStackFromNBT( c );
}
}
catch( Exception e )
catch( final Exception e )
{
AELog.error( e );
}
@@ -137,7 +137,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
}
@Override
public ItemStack getStackInSlot( int var1 )
public ItemStack getStackInSlot( final int var1 )
{
if( this.inv[var1] == null )
{
@@ -148,11 +148,11 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
}
@Override
public ItemStack decrStackSize( int slot, int qty )
public ItemStack decrStackSize( final int slot, final int qty )
{
if( this.inv[slot] != null )
{
ItemStack split = this.getStackInSlot( slot );
final ItemStack split = this.getStackInSlot( slot );
ItemStack ns = null;
if( qty >= split.stackSize )
@@ -177,15 +177,15 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
}
@Override
public ItemStack getStackInSlotOnClosing( int var1 )
public ItemStack getStackInSlotOnClosing( final int var1 )
{
return null;
}
@Override
public void setInventorySlotContents( int slot, ItemStack newItemStack )
public void setInventorySlotContents( final int slot, final ItemStack newItemStack )
{
ItemStack oldStack = this.getStackInSlot( slot );
final ItemStack oldStack = this.getStackInSlot( slot );
this.inv[slot] = AEApi.instance().storage().createItemStack( newItemStack );
if( this.te != null && Platform.isServer() )
@@ -245,7 +245,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
}
@Override
public boolean isUseableByPlayer( EntityPlayer var1 )
public boolean isUseableByPlayer( final EntityPlayer var1 )
{
return true;
}
@@ -261,7 +261,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return true;
}
@@ -42,7 +42,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
protected IAEAppEngInventory te;
protected int maxStack;
public AppEngInternalInventory( IAEAppEngInventory inventory, int size )
public AppEngInternalInventory( final IAEAppEngInventory inventory, final int size )
{
this.te = inventory;
this.size = size;
@@ -74,17 +74,17 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
}
@Override
public ItemStack getStackInSlot( int var1 )
public ItemStack getStackInSlot( final int var1 )
{
return this.inv[var1];
}
@Override
public ItemStack decrStackSize( int slot, int qty )
public ItemStack decrStackSize( final int slot, final int qty )
{
if( this.inv[slot] != null )
{
ItemStack split = this.getStackInSlot( slot );
final ItemStack split = this.getStackInSlot( slot );
ItemStack ns = null;
if( qty >= split.stackSize )
@@ -115,15 +115,15 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
}
@Override
public ItemStack getStackInSlotOnClosing( int var1 )
public ItemStack getStackInSlotOnClosing( final int var1 )
{
return null;
}
@Override
public void setInventorySlotContents( int slot, ItemStack newItemStack )
public void setInventorySlotContents( final int slot, final ItemStack newItemStack )
{
ItemStack oldStack = this.inv[slot];
final ItemStack oldStack = this.inv[slot];
this.inv[slot] = newItemStack;
if( this.te != null && this.eventsEnabled() )
@@ -185,7 +185,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
}
@Override
public boolean isUseableByPlayer( EntityPlayer var1 )
public boolean isUseableByPlayer( final EntityPlayer var1 )
{
return true;
}
@@ -201,18 +201,18 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return true;
}
public void setMaxStackSize( int s )
public void setMaxStackSize( final int s )
{
this.maxStack = s;
}
// for guis...
public void markDirty( int slotIndex )
public void markDirty( final int slotIndex )
{
if( this.te != null && this.eventsEnabled() )
{
@@ -220,20 +220,20 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
}
}
public void writeToNBT( NBTTagCompound data, String name )
public void writeToNBT( final NBTTagCompound data, final String name )
{
NBTTagCompound c = new NBTTagCompound();
final NBTTagCompound c = new NBTTagCompound();
this.writeToNBT( c );
data.setTag( name, c );
}
public void writeToNBT( NBTTagCompound target )
public void writeToNBT( final NBTTagCompound target )
{
for( int x = 0; x < this.size; x++ )
{
try
{
NBTTagCompound c = new NBTTagCompound();
final NBTTagCompound c = new NBTTagCompound();
if( this.inv[x] != null )
{
@@ -242,35 +242,35 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
target.setTag( "#" + x, c );
}
catch( Exception ignored )
catch( final Exception ignored )
{
}
}
}
public void readFromNBT( NBTTagCompound data, String name )
public void readFromNBT( final NBTTagCompound data, final String name )
{
NBTTagCompound c = data.getCompoundTag( name );
final NBTTagCompound c = data.getCompoundTag( name );
if( c != null )
{
this.readFromNBT( c );
}
}
public void readFromNBT( NBTTagCompound target )
public void readFromNBT( final NBTTagCompound target )
{
for( int x = 0; x < this.size; x++ )
{
try
{
NBTTagCompound c = target.getCompoundTag( "#" + x );
final NBTTagCompound c = target.getCompoundTag( "#" + x );
if( c != null )
{
this.inv[x] = ItemStack.loadItemStackFromNBT( c );
}
}
catch( Exception e )
catch( final Exception e )
{
AELog.error( e );
}
@@ -32,7 +32,7 @@ public class AppEngNullInventory implements IInventory
{
}
public void writeToNBT( NBTTagCompound target )
public void writeToNBT( final NBTTagCompound target )
{
}
@@ -43,25 +43,25 @@ public class AppEngNullInventory implements IInventory
}
@Override
public ItemStack getStackInSlot( int var1 )
public ItemStack getStackInSlot( final int var1 )
{
return null;
}
@Override
public ItemStack decrStackSize( int slot, int qty )
public ItemStack decrStackSize( final int slot, final int qty )
{
return null;
}
@Override
public ItemStack getStackInSlotOnClosing( int var1 )
public ItemStack getStackInSlotOnClosing( final int var1 )
{
return null;
}
@Override
public void setInventorySlotContents( int slot, ItemStack newItemStack )
public void setInventorySlotContents( final int slot, final ItemStack newItemStack )
{
}
@@ -91,7 +91,7 @@ public class AppEngNullInventory implements IInventory
}
@Override
public boolean isUseableByPlayer( EntityPlayer var1 )
public boolean isUseableByPlayer( final EntityPlayer var1 )
{
return false;
}
@@ -107,7 +107,7 @@ public class AppEngNullInventory implements IInventory
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return false;
}
@@ -64,19 +64,19 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
{
if( this.cacheUpgrades == null )
{
ICellWorkbenchItem cell = this.getCell();
final ICellWorkbenchItem cell = this.getCell();
if( cell == null )
{
return null;
}
ItemStack is = this.cell.getStackInSlot( 0 );
final ItemStack is = this.cell.getStackInSlot( 0 );
if( is == null )
{
return null;
}
IInventory inv = cell.getUpgradesInventory( is );
final IInventory inv = cell.getUpgradesInventory( is );
if( inv == null )
{
return null;
@@ -103,7 +103,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileCellWorkbench( NBTTagCompound data )
public void writeToNBT_TileCellWorkbench( final NBTTagCompound data )
{
this.cell.writeToNBT( data, "cell" );
this.config.writeToNBT( data, "config" );
@@ -111,7 +111,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileCellWorkbench( NBTTagCompound data )
public void readFromNBT_TileCellWorkbench( final NBTTagCompound data )
{
this.cell.readFromNBT( data, "cell" );
this.config.readFromNBT( data, "config" );
@@ -119,7 +119,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
}
@Override
public IInventory getInventoryByName( String name )
public IInventory getInventoryByName( final String name )
{
if( name.equals( "config" ) )
{
@@ -135,13 +135,13 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
}
@Override
public int getInstalledUpgrades( Upgrades u )
public int getInstalledUpgrades( final Upgrades u )
{
return 0;
}
@Override
public void onChangeInventory( IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack )
public void onChangeInventory( final IInventory inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack )
{
if( inv == this.cell && !this.locked )
{
@@ -150,7 +150,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
this.cacheUpgrades = null;
this.cacheConfig = null;
IInventory configInventory = this.getCellConfigInventory();
final IInventory configInventory = this.getCellConfigInventory();
if( configInventory != null )
{
boolean cellHasConfig = false;
@@ -194,7 +194,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
}
else if( inv == this.config && !this.locked )
{
IInventory c = this.getCellConfigInventory();
final IInventory c = this.getCellConfigInventory();
if( c != null )
{
for( int x = 0; x < this.config.getSizeInventory(); x++ )
@@ -211,19 +211,19 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
{
if( this.cacheConfig == null )
{
ICellWorkbenchItem cell = this.getCell();
final ICellWorkbenchItem cell = this.getCell();
if( cell == null )
{
return null;
}
ItemStack is = this.cell.getStackInSlot( 0 );
final ItemStack is = this.cell.getStackInSlot( 0 );
if( is == null )
{
return null;
}
IInventory inv = cell.getConfigInventory( is );
final IInventory inv = cell.getConfigInventory( is );
if( inv == null )
{
return null;
@@ -235,7 +235,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
}
@Override
public void getDrops( World w, int x, int y, int z, List<ItemStack> drops )
public void getDrops( final World w, final int x, final int y, final int z, final List<ItemStack> drops )
{
super.getDrops( w, x, y, z, drops );
@@ -252,7 +252,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
}
@Override
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
{
// nothing here..
}
+25 -25
View File
@@ -71,21 +71,21 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( final ForgeDirection dir )
{
return AECableType.COVERED;
}
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileCharger( ByteBuf data )
public boolean readFromStream_TileCharger( final ByteBuf data )
{
try
{
IAEItemStack item = AEItemStack.loadItemStackFromPacket( data );
ItemStack is = item.getItemStack();
final IAEItemStack item = AEItemStack.loadItemStackFromPacket( data );
final ItemStack is = item.getItemStack();
this.inv.setInventorySlotContents( 0, is );
}
catch( Throwable t )
catch( final Throwable t )
{
this.inv.setInventorySlotContents( 0, null );
}
@@ -93,9 +93,9 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
}
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileCharger( ByteBuf data ) throws IOException
public void writeToStream_TileCharger( final ByteBuf data ) throws IOException
{
AEItemStack is = AEItemStack.create( this.getStackInSlot( 0 ) );
final AEItemStack is = AEItemStack.create( this.getStackInSlot( 0 ) );
if( is != null )
{
is.writeToPacket( data );
@@ -120,7 +120,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
}
this.tickTickTimer = 0;
ItemStack myItem = this.getStackInSlot( 0 );
final ItemStack myItem = this.getStackInSlot( 0 );
// charge from the network!
if( this.internalCurrentPower < 1499 )
@@ -130,7 +130,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
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 )
catch( final GridAccessException e )
{
// continue!
}
@@ -145,12 +145,12 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
if( this.internalCurrentPower > 149 && Platform.isChargeable( myItem ) )
{
IAEItemPowerStorage ps = (IAEItemPowerStorage) myItem.getItem();
final IAEItemPowerStorage ps = (IAEItemPowerStorage) myItem.getItem();
if( ps.getAEMaxPower( myItem ) > ps.getAECurrentPower( myItem ) )
{
double oldPower = this.internalCurrentPower;
final double oldPower = this.internalCurrentPower;
double adjustment = ps.injectAEPower( myItem, this.extractAEPower( 150.0, Actionable.MODULATE, PowerMultiplier.CONFIG ) );
final double adjustment = ps.injectAEPower( myItem, this.extractAEPower( 150.0, Actionable.MODULATE, PowerMultiplier.CONFIG ) );
this.internalCurrentPower += adjustment;
if( oldPower > this.internalCurrentPower )
{
@@ -165,7 +165,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
{
this.extractAEPower( this.internalMaxPower, Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500
for( ItemStack charged : materials.certusQuartzCrystalCharged().maybeStack( myItem.stackSize ).asSet() )
for( final ItemStack charged : materials.certusQuartzCrystalCharged().maybeStack( myItem.stackSize ).asSet() )
{
this.setInventorySlotContents( 0, charged );
}
@@ -174,7 +174,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
}
@Override
public void setOrientation( ForgeDirection inForward, ForgeDirection inUp )
public void setOrientation( final ForgeDirection inForward, final ForgeDirection inUp )
{
super.setOrientation( inForward, inUp );
this.gridProxy.setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) );
@@ -198,7 +198,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
{
this.injectExternalPower( PowerUnits.AE, 150 );
ItemStack myItem = this.getStackInSlot( 0 );
final ItemStack myItem = this.getStackInSlot( 0 );
if( this.internalCurrentPower > 1499 )
{
final IMaterials materials = AEApi.instance().definitions().materials();
@@ -207,7 +207,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
{
this.extractAEPower( this.internalMaxPower, Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500
for( ItemStack charged : materials.certusQuartzCrystalCharged().maybeStack( myItem.stackSize ).asSet() )
for( final ItemStack charged : materials.certusQuartzCrystalCharged().maybeStack( myItem.stackSize ).asSet() )
{
this.setInventorySlotContents( 0, charged );
}
@@ -216,7 +216,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
}
@Override
public boolean canCrankAttach( ForgeDirection directionToCrank )
public boolean canCrankAttach( final ForgeDirection directionToCrank )
{
return this.getUp() == directionToCrank || this.getUp().getOpposite() == directionToCrank;
}
@@ -234,7 +234,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
final IItemDefinition cert = AEApi.instance().definitions().materials().certusQuartzCrystal();
@@ -242,17 +242,17 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
}
@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 )
{
this.markForUpdate();
}
@Override
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final int side )
{
if( Platform.isChargeable( extractedItem ) )
{
IAEItemPowerStorage ips = (IAEItemPowerStorage) extractedItem.getItem();
final IAEItemPowerStorage ips = (IAEItemPowerStorage) extractedItem.getItem();
if( ips.getAECurrentPower( extractedItem ) >= ips.getAEMaxPower( extractedItem ) )
{
return true;
@@ -263,19 +263,19 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
}
@Override
public int[] getAccessibleSlotsBySide( ForgeDirection whichSide )
public int[] getAccessibleSlotsBySide( final ForgeDirection whichSide )
{
return this.sides;
}
public void activate( EntityPlayer player )
public void activate( final EntityPlayer player )
{
if( !Platform.hasPermissions( new DimensionalCoord( this ), player ) )
{
return;
}
ItemStack myItem = this.getStackInSlot( 0 );
final ItemStack myItem = this.getStackInSlot( 0 );
if( myItem == null )
{
ItemStack held = player.inventory.getCurrentItem();
@@ -288,7 +288,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
}
else
{
List<ItemStack> drops = new ArrayList<ItemStack>();
final List<ItemStack> drops = new ArrayList<ItemStack>();
drops.add( myItem );
this.setInventorySlotContents( 0, null );
Platform.spawnDrops( this.worldObj, this.xCoord + this.getForward().offsetX, this.yCoord + this.getForward().offsetY, this.zCoord + this.getForward().offsetZ, drops );
@@ -61,14 +61,14 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileCondenser( NBTTagCompound data )
public void writeToNBT_TileCondenser( final NBTTagCompound data )
{
this.cm.writeToNBT( data );
data.setDouble( "storedPower", this.storedPower );
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileCondenser( NBTTagCompound data )
public void readFromNBT_TileCondenser( final NBTTagCompound data )
{
this.cm.readFromNBT( data );
this.storedPower = data.getDouble( "storedPower" );
@@ -76,12 +76,12 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
public double getStorage()
{
ItemStack is = this.inv.getStackInSlot( 2 );
final ItemStack is = this.inv.getStackInSlot( 2 );
if( is != null )
{
if( is.getItem() instanceof IStorageComponent )
{
IStorageComponent sc = (IStorageComponent) is.getItem();
final IStorageComponent sc = (IStorageComponent) is.getItem();
if( sc.isStorageComponent( is ) )
{
return sc.getBytes( is ) * 8;
@@ -91,13 +91,13 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
return 0;
}
public void addPower( double rawPower )
public void addPower( final double rawPower )
{
this.storedPower += rawPower;
this.storedPower = Math.max( 0.0, Math.min( this.getStorage(), this.storedPower ) );
double requiredPower = this.getRequiredPower();
ItemStack output = this.getOutput();
final double requiredPower = this.getRequiredPower();
final ItemStack output = this.getOutput();
while( requiredPower <= this.storedPower && output != null && requiredPower > 0 )
{
if( this.canAddOutput( output ) )
@@ -112,9 +112,9 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
}
}
private boolean canAddOutput( ItemStack output )
private boolean canAddOutput( final ItemStack output )
{
ItemStack outputStack = this.getStackInSlot( 1 );
final ItemStack outputStack = this.getStackInSlot( 1 );
return outputStack == null || ( Platform.isSameItem( outputStack, output ) && outputStack.stackSize < outputStack.getMaxStackSize() );
}
@@ -123,9 +123,9 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
*
* @param output to be added output
*/
private void addOutput( ItemStack output )
private void addOutput( final ItemStack output )
{
ItemStack outputStack = this.getStackInSlot( 1 );
final ItemStack outputStack = this.getStackInSlot( 1 );
if( outputStack == null )
{
this.setInventorySlotContents( 1, output.copy() );
@@ -144,13 +144,13 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
switch( (CondenserOutput) this.cm.getSetting( Settings.CONDENSER_OUTPUT ) )
{
case MATTER_BALLS:
for( ItemStack matterBallStack : materials.matterBall().maybeStack( 1 ).asSet() )
for( final ItemStack matterBallStack : materials.matterBall().maybeStack( 1 ).asSet() )
{
return matterBallStack;
}
case SINGULARITY:
for( ItemStack singularityStack : materials.singularity().maybeStack( 1 ).asSet() )
for( final ItemStack singularityStack : materials.singularity().maybeStack( 1 ).asSet() )
{
return singularityStack;
}
@@ -173,7 +173,7 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
}
@Override
public void setInventorySlotContents( int i, ItemStack itemstack )
public void setInventorySlotContents( final int i, final ItemStack itemstack )
{
if( i == 0 )
{
@@ -189,17 +189,17 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return i == 0;
}
@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 )
{
if( slot == 0 )
{
ItemStack is = inv.getStackInSlot( 0 );
final ItemStack is = inv.getStackInSlot( 0 );
if( is != null )
{
this.addPower( is.stackSize );
@@ -209,25 +209,25 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
}
@Override
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, int side )
public boolean canInsertItem( final int slotIndex, final ItemStack insertingItem, final int side )
{
return slotIndex == 0;
}
@Override
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final int side )
{
return slotIndex != 0;
}
@Override
public int[] getAccessibleSlotsBySide( ForgeDirection side )
public int[] getAccessibleSlotsBySide( final ForgeDirection side )
{
return this.sides;
}
@Override
public int fill( ForgeDirection from, FluidStack resource, boolean doFill )
public int fill( final ForgeDirection from, final FluidStack resource, final boolean doFill )
{
if( doFill )
{
@@ -238,37 +238,37 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
}
@Override
public FluidStack drain( ForgeDirection from, FluidStack resource, boolean doDrain )
public FluidStack drain( final ForgeDirection from, final FluidStack resource, final boolean doDrain )
{
return null;
}
@Override
public FluidStack drain( ForgeDirection from, int maxDrain, boolean doDrain )
public FluidStack drain( final ForgeDirection from, final int maxDrain, final boolean doDrain )
{
return null;
}
@Override
public boolean canFill( ForgeDirection from, Fluid fluid )
public boolean canFill( final ForgeDirection from, final Fluid fluid )
{
return true;
}
@Override
public boolean canDrain( ForgeDirection from, Fluid fluid )
public boolean canDrain( final ForgeDirection from, final Fluid fluid )
{
return false;
}
@Override
public FluidTankInfo[] getTankInfo( ForgeDirection from )
public FluidTankInfo[] getTankInfo( final ForgeDirection from )
{
return EMPTY;
}
@Override
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
{
this.addPower( 0 );
}
@@ -111,13 +111,13 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( final ForgeDirection dir )
{
return AECableType.COVERED;
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileInscriber( NBTTagCompound data )
public void writeToNBT_TileInscriber( final NBTTagCompound data )
{
this.inv.writeToNBT( data, "inscriberInv" );
this.upgrades.writeToNBT( data, "upgrades" );
@@ -125,7 +125,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileInscriber( NBTTagCompound data )
public void readFromNBT_TileInscriber( final NBTTagCompound data )
{
this.inv.readFromNBT( data, "inscriberInv" );
this.upgrades.readFromNBT( data, "upgrades" );
@@ -133,12 +133,12 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileInscriber( ByteBuf data ) throws IOException
public boolean readFromStream_TileInscriber( final ByteBuf data ) throws IOException
{
int slot = data.readByte();
final int slot = data.readByte();
boolean oldSmash = this.smash;
boolean newSmash = ( slot & 64 ) == 64;
final boolean oldSmash = this.smash;
final boolean newSmash = ( slot & 64 ) == 64;
if( oldSmash != newSmash && newSmash )
{
@@ -162,7 +162,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileInscriber( ByteBuf data ) throws IOException
public void writeToStream_TileInscriber( final ByteBuf data ) throws IOException
{
int slot = this.smash ? 64 : 0;
@@ -179,14 +179,14 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
{
if( ( slot & ( 1 << num ) ) > 0 )
{
AEItemStack st = AEItemStack.create( this.inv.getStackInSlot( num ) );
final AEItemStack st = AEItemStack.create( this.inv.getStackInSlot( num ) );
st.writeToPacket( data );
}
}
}
@Override
public void setOrientation( ForgeDirection inForward, ForgeDirection inUp )
public void setOrientation( final ForgeDirection inForward, final ForgeDirection inUp )
{
super.setOrientation( inForward, inUp );
this.gridProxy.setValidSides( EnumSet.complementOf( EnumSet.of( this.getForward() ) ) );
@@ -194,13 +194,13 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
@Override
public void getDrops( World w, int x, int y, int z, List<ItemStack> drops )
public void getDrops( final World w, final int x, final int y, final int z, final List<ItemStack> drops )
{
super.getDrops( w, x, y, z, drops );
for( int h = 0; h < this.upgrades.getSizeInventory(); h++ )
{
ItemStack is = this.upgrades.getStackInSlot( h );
final ItemStack is = this.upgrades.getStackInSlot( h );
if( is != null )
{
drops.add( is );
@@ -227,7 +227,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
if( this.smash )
{
@@ -241,7 +241,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
return true;
}
for( ItemStack optionals : AEApi.instance().registries().inscriber().getOptionals() )
for( final ItemStack optionals : AEApi.instance().registries().inscriber().getOptionals() )
{
if( Platform.isSameItemPrecise( optionals, itemstack ) )
{
@@ -254,7 +254,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
@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 )
{
try
{
@@ -273,14 +273,14 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
}
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// :P
}
}
@Override
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final int side )
{
if( this.smash )
{
@@ -291,7 +291,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
@Override
public int[] getAccessibleSlotsBySide( ForgeDirection d )
public int[] getAccessibleSlotsBySide( final ForgeDirection d )
{
if( d == ForgeDirection.UP )
{
@@ -307,7 +307,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
@Override
public TickingRequest getTickingRequest( IGridNode node )
public TickingRequest getTickingRequest( final IGridNode node )
{
return new TickingRequest( TickRates.Inscriber.min, TickRates.Inscriber.max, !this.hasWork(), false );
}
@@ -326,8 +326,8 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
@Nullable
public IInscriberRecipe getTask()
{
ItemStack plateA = this.getStackInSlot( 0 );
ItemStack plateB = this.getStackInSlot( 1 );
final ItemStack plateA = this.getStackInSlot( 0 );
final ItemStack plateB = this.getStackInSlot( 1 );
ItemStack renamedItem = this.getStackInSlot( 2 );
if( plateA != null && plateA.stackSize > 1 )
@@ -346,8 +346,8 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
final IComparableDefinition namePress = AEApi.instance().definitions().materials().namePress();
boolean isNameA = namePress.isSameAs( plateA );
boolean isNameB = namePress.isSameAs( plateB );
final boolean isNameA = namePress.isSameAs( plateA );
final boolean isNameB = namePress.isSameAs( plateB );
if( ( isNameA || isNameB ) && ( isNameA || plateA == null ) && ( isNameB || plateB == null ) )
{
@@ -357,13 +357,13 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
if( plateA != null )
{
NBTTagCompound tag = Platform.openNbtData( plateA );
final NBTTagCompound tag = Platform.openNbtData( plateA );
name += tag.getString( "InscribeName" );
}
if( plateB != null )
{
NBTTagCompound tag = Platform.openNbtData( plateB );
final NBTTagCompound tag = Platform.openNbtData( plateB );
if( name.length() > 0 )
{
name += " ";
@@ -371,11 +371,11 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
name += tag.getString( "InscribeName" );
}
ItemStack startingItem = renamedItem.copy();
final ItemStack startingItem = renamedItem.copy();
renamedItem = renamedItem.copy();
NBTTagCompound tag = Platform.openNbtData( renamedItem );
final NBTTagCompound tag = Platform.openNbtData( renamedItem );
NBTTagCompound display = tag.getCompoundTag( "display" );
final NBTTagCompound display = tag.getCompoundTag( "display" );
tag.setTag( "display", display );
if( name.length() > 0 )
@@ -394,18 +394,18 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
}
for( IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
for( final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
{
boolean matchA = ( plateA == null && !recipe.getTopOptional().isPresent() ) || ( Platform.isSameItemPrecise( plateA, recipe.getTopOptional().orNull() ) ) && // and...
final boolean matchA = ( plateA == null && !recipe.getTopOptional().isPresent() ) || ( Platform.isSameItemPrecise( plateA, recipe.getTopOptional().orNull() ) ) && // and...
( plateB == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( plateB, recipe.getBottomOptional().orNull() ) );
boolean matchB = ( plateB == null && !recipe.getTopOptional().isPresent() ) || ( Platform.isSameItemPrecise( plateB, recipe.getTopOptional().orNull() ) ) && // and...
final boolean matchB = ( plateB == null && !recipe.getTopOptional().isPresent() ) || ( Platform.isSameItemPrecise( plateB, recipe.getTopOptional().orNull() ) ) && // and...
( plateA == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( plateA, recipe.getBottomOptional().orNull() ) );
if( matchA || matchB )
{
for( ItemStack option : recipe.getInputs() )
for( final ItemStack option : recipe.getInputs() )
{
if( Platform.isSameItemPrecise( option, this.getStackInSlot( 2 ) ) )
{
@@ -418,7 +418,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
@Override
public TickRateModulation tickingRequest( IGridNode node, int ticksSinceLastCall )
public TickRateModulation tickingRequest( final IGridNode node, final int ticksSinceLastCall )
{
if( this.smash )
{
@@ -429,7 +429,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
if( out != null )
{
final ItemStack outputCopy = out.getOutput().copy();
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this.inv, 3, 1, true ), ForgeDirection.UNKNOWN );
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this.inv, 3, 1, true ), ForgeDirection.UNKNOWN );
if( ad.addItems( outputCopy ) == null )
{
@@ -456,13 +456,13 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
{
try
{
IEnergyGrid eg = this.gridProxy.getEnergy();
final IEnergyGrid eg = this.gridProxy.getEnergy();
IEnergySource src = this;
// Base 1, increase by 1 for each card
int speedFactor = 1 + this.upgrades.getInstalledUpgrades( Upgrades.SPEED );
int powerConsumption = 10 * speedFactor;
double powerThreshold = powerConsumption - 0.01;
final int speedFactor = 1 + this.upgrades.getInstalledUpgrades( Upgrades.SPEED );
final int powerConsumption = 10 * speedFactor;
final double powerThreshold = powerConsumption - 0.01;
double powerReq = this.extractAEPower( powerConsumption, Actionable.SIMULATE, PowerMultiplier.CONFIG );
if( powerReq <= powerThreshold )
@@ -485,7 +485,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
}
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// :P
}
@@ -493,11 +493,11 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
if( this.processingTime > this.maxProcessingTime )
{
this.processingTime = this.maxProcessingTime;
IInscriberRecipe out = this.getTask();
final IInscriberRecipe out = this.getTask();
if( out != null )
{
ItemStack outputCopy = out.getOutput().copy();
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this.inv, 3, 1, true ), ForgeDirection.UNKNOWN );
final ItemStack outputCopy = out.getOutput().copy();
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this.inv, 3, 1, true ), ForgeDirection.UNKNOWN );
if( ad.simulateAdd( outputCopy ) == null )
{
this.smash = true;
@@ -518,7 +518,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
@Override
public IInventory getInventoryByName( String name )
public IInventory getInventoryByName( final String name )
{
if( name.equals( "inv" ) )
{
@@ -534,13 +534,13 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
@Override
public int getInstalledUpgrades( Upgrades u )
public int getInstalledUpgrades( final Upgrades u )
{
return this.upgrades.getInstalledUpgrades( u );
}
@Override
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
{
}
}
@@ -71,18 +71,18 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
ForgeDirection pointAt = ForgeDirection.UNKNOWN;
@MENetworkEventSubscribe
public void stateChange( MENetworkChannelsChanged c )
public void stateChange( final MENetworkChannelsChanged c )
{
this.duality.notifyNeighbors();
}
@MENetworkEventSubscribe
public void stateChange( MENetworkPowerStatusChange c )
public void stateChange( final MENetworkPowerStatusChange c )
{
this.duality.notifyNeighbors();
}
public void setSide( ForgeDirection axis )
public void setSide( final ForgeDirection axis )
{
if( Platform.isClient() )
{
@@ -127,7 +127,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
}
@Override
public void getDrops( World w, int x, int y, int z, List<ItemStack> drops )
public void getDrops( final World w, final int x, final int y, final int z, final List<ItemStack> drops )
{
this.duality.addDrops( drops );
}
@@ -147,16 +147,16 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileInterface( NBTTagCompound data )
public void writeToNBT_TileInterface( final NBTTagCompound data )
{
data.setInteger( "pointAt", this.pointAt.ordinal() );
this.duality.writeToNBT( data );
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileInterface( NBTTagCompound data )
public void readFromNBT_TileInterface( final NBTTagCompound data )
{
int val = data.getInteger( "pointAt" );
final int val = data.getInteger( "pointAt" );
if( val >= 0 && val < ForgeDirection.values().length )
{
@@ -171,7 +171,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( final ForgeDirection dir )
{
return this.duality.getCableConnectionType( dir );
}
@@ -183,7 +183,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
}
@Override
public boolean canInsert( ItemStack stack )
public boolean canInsert( final ItemStack stack )
{
return this.duality.canInsert( stack );
}
@@ -201,19 +201,19 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
}
@Override
public IInventory getInventoryByName( String name )
public IInventory getInventoryByName( final String name )
{
return this.duality.getInventoryByName( name );
}
@Override
public TickingRequest getTickingRequest( IGridNode node )
public TickingRequest getTickingRequest( final IGridNode node )
{
return this.duality.getTickingRequest( node );
}
@Override
public TickRateModulation tickingRequest( IGridNode node, int ticksSinceLastCall )
public TickRateModulation tickingRequest( final IGridNode node, final int ticksSinceLastCall )
{
return this.duality.tickingRequest( node, ticksSinceLastCall );
}
@@ -225,13 +225,13 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
}
@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 )
{
this.duality.onChangeInventory( inv, slot, mc, removed, added );
}
@Override
public int[] getAccessibleSlotsBySide( ForgeDirection side )
public int[] getAccessibleSlotsBySide( final ForgeDirection side )
{
return this.duality.getAccessibleSlotsFromSide( side.ordinal() );
}
@@ -259,7 +259,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
}
@Override
public IStorageMonitorable getMonitorable( ForgeDirection side, BaseActionSource src )
public IStorageMonitorable getMonitorable( final ForgeDirection side, final BaseActionSource src )
{
return this.duality.getMonitorable( side, src, this );
}
@@ -271,7 +271,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
}
@Override
public boolean pushPattern( ICraftingPatternDetails patternDetails, InventoryCrafting table )
public boolean pushPattern( final ICraftingPatternDetails patternDetails, final InventoryCrafting table )
{
return this.duality.pushPattern( patternDetails, table );
}
@@ -283,13 +283,13 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
}
@Override
public void provideCrafting( ICraftingProviderHelper craftingTracker )
public void provideCrafting( final ICraftingProviderHelper craftingTracker )
{
this.duality.provideCrafting( craftingTracker );
}
@Override
public int getInstalledUpgrades( Upgrades u )
public int getInstalledUpgrades( final Upgrades u )
{
return this.duality.getInstalledUpgrades( u );
}
@@ -301,13 +301,13 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
}
@Override
public IAEItemStack injectCraftedItems( ICraftingLink link, IAEItemStack items, Actionable mode )
public IAEItemStack injectCraftedItems( final ICraftingLink link, final IAEItemStack items, final Actionable mode )
{
return this.duality.injectCraftedItems( link, items, mode );
}
@Override
public void jobStateChange( ICraftingLink link )
public void jobStateChange( final ICraftingLink link )
{
this.duality.jobStateChange( link );
}
@@ -319,7 +319,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
}
@Override
public void setPriority( int newValue )
public void setPriority( final int newValue )
{
this.duality.setPriority( newValue );
}
@@ -49,7 +49,7 @@ public class TileLightDetector extends AEBaseTile
public void updateLight()
{
int val = this.worldObj.getBlockLightValue( this.xCoord, this.yCoord, this.zCoord );
final int val = this.worldObj.getBlockLightValue( this.xCoord, this.yCoord, this.zCoord );
if( this.lastLight != val )
{
+23 -23
View File
@@ -54,9 +54,9 @@ public class TilePaint extends AEBaseTile
List<Splotch> dots = null;
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TilePaint( NBTTagCompound data )
public void writeToNBT_TilePaint( final NBTTagCompound data )
{
ByteBuf myDat = Unpooled.buffer();
final ByteBuf myDat = Unpooled.buffer();
this.writeBuffer( myDat );
if( myDat.hasArray() )
{
@@ -64,7 +64,7 @@ public class TilePaint extends AEBaseTile
}
}
void writeBuffer( ByteBuf out )
void writeBuffer( final ByteBuf out )
{
if( this.dots == null )
{
@@ -74,14 +74,14 @@ public class TilePaint extends AEBaseTile
out.writeByte( this.dots.size() );
for( Splotch s : this.dots )
for( final Splotch s : this.dots )
{
s.writeToStream( out );
}
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TilePaint( NBTTagCompound data )
public void readFromNBT_TilePaint( final NBTTagCompound data )
{
if( data.hasKey( "dots" ) )
{
@@ -89,9 +89,9 @@ public class TilePaint extends AEBaseTile
}
}
void readBuffer( ByteBuf in )
void readBuffer( final ByteBuf in )
{
byte howMany = in.readByte();
final byte howMany = in.readByte();
if( howMany == 0 )
{
@@ -107,7 +107,7 @@ public class TilePaint extends AEBaseTile
}
this.isLit = 0;
for( Splotch s : this.dots )
for( final Splotch s : this.dots )
{
if( s.lumen )
{
@@ -132,13 +132,13 @@ public class TilePaint extends AEBaseTile
}
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TilePaint( ByteBuf data )
public void writeToStream_TilePaint( final ByteBuf data )
{
this.writeBuffer( data );
}
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TilePaint( ByteBuf data )
public boolean readFromStream_TilePaint( final ByteBuf data )
{
this.readBuffer( data );
return true;
@@ -151,7 +151,7 @@ public class TilePaint extends AEBaseTile
return;
}
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
for( final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
{
if( !this.isSideValid( side ) )
{
@@ -162,18 +162,18 @@ public class TilePaint extends AEBaseTile
this.updateData();
}
public boolean isSideValid( ForgeDirection side )
public boolean isSideValid( final ForgeDirection side )
{
Block blk = this.worldObj.getBlock( this.xCoord + side.offsetX, this.yCoord + side.offsetY, this.zCoord + side.offsetZ );
final 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 )
private void removeSide( final ForgeDirection side )
{
Iterator<Splotch> i = this.dots.iterator();
final Iterator<Splotch> i = this.dots.iterator();
while( i.hasNext() )
{
Splotch s = i.next();
final Splotch s = i.next();
if( s.side == side )
{
i.remove();
@@ -187,7 +187,7 @@ public class TilePaint extends AEBaseTile
private void updateData()
{
this.isLit = 0;
for( Splotch s : this.dots )
for( final Splotch s : this.dots )
{
if( s.lumen )
{
@@ -208,7 +208,7 @@ public class TilePaint extends AEBaseTile
}
}
public void cleanSide( ForgeDirection side )
public void cleanSide( final ForgeDirection side )
{
if( this.dots == null )
{
@@ -225,15 +225,15 @@ public class TilePaint extends AEBaseTile
return this.isLit;
}
public void addBlot( ItemStack type, ForgeDirection side, Vec3 hitVec )
public void addBlot( final ItemStack type, final ForgeDirection side, final Vec3 hitVec )
{
Block blk = this.worldObj.getBlock( this.xCoord + side.offsetX, this.yCoord + side.offsetY, this.zCoord + side.offsetZ );
final 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();
final ItemPaintBall ipb = (ItemPaintBall) type.getItem();
AEColor col = ipb.getColor( type );
boolean lit = ipb.isLumen( type );
final AEColor col = ipb.getColor( type );
final boolean lit = ipb.isLumen( type );
if( this.dots == null )
{
@@ -50,40 +50,40 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
}
@MENetworkEventSubscribe
public void onPower( MENetworkPowerStatusChange ch )
public void onPower( final MENetworkPowerStatusChange ch )
{
this.markForUpdate();
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( final ForgeDirection dir )
{
return AECableType.COVERED;
}
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileQuartzGrowthAccelerator( ByteBuf data )
public boolean readFromStream_TileQuartzGrowthAccelerator( final ByteBuf data )
{
boolean hadPower = this.hasPower;
final boolean hadPower = this.hasPower;
this.hasPower = data.readBoolean();
return this.hasPower != hadPower;
}
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileQuartzGrowthAccelerator( ByteBuf data )
public void writeToStream_TileQuartzGrowthAccelerator( final ByteBuf data )
{
try
{
data.writeBoolean( this.gridProxy.getEnergy().isNetworkPowered() );
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
data.writeBoolean( false );
}
}
@Override
public void setOrientation( ForgeDirection inForward, ForgeDirection inUp )
public void setOrientation( final ForgeDirection inForward, final ForgeDirection inUp )
{
super.setOrientation( inForward, inUp );
this.gridProxy.setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) );
@@ -98,7 +98,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
{
return this.gridProxy.getEnergy().isNetworkPowered();
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
return false;
}
@@ -108,20 +108,20 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
}
@Override
public void onChangeInventory( IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack )
public void onChangeInventory( final IInventory inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack )
{
}
@Override
public void getDrops( World w, int x, int y, int z, List<ItemStack> drops )
public void getDrops( final World w, final int x, final int y, final int z, final List<ItemStack> drops )
{
if( !this.configSlot.isEmpty() )
{
drops.add( this.configSlot.getStackInSlot( 0 ) );
}
for( IAEItemStack ais : this.inventory.storedItems )
for( final IAEItemStack ais : this.inventory.storedItems )
{
drops.add( ais.getItemStack() );
}
@@ -133,26 +133,26 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
}
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileSecurity( ByteBuf data )
public boolean readFromStream_TileSecurity( final ByteBuf data )
{
boolean wasActive = this.isActive;
final boolean wasActive = this.isActive;
this.isActive = data.readBoolean();
AEColor oldPaintedColor = this.paintedColor;
final AEColor oldPaintedColor = this.paintedColor;
this.paintedColor = AEColor.values()[data.readByte()];
return oldPaintedColor != this.paintedColor || wasActive != this.isActive;
}
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileSecurity( ByteBuf data )
public void writeToStream_TileSecurity( final ByteBuf data )
{
data.writeBoolean( this.gridProxy.isActive() );
data.writeByte( this.paintedColor.ordinal() );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileSecurity( NBTTagCompound data )
public void writeToNBT_TileSecurity( final NBTTagCompound data )
{
this.cm.writeToNBT( data );
data.setByte( "paintedColor", (byte) this.paintedColor.ordinal() );
@@ -160,12 +160,12 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
data.setLong( "securityKey", this.securityKey );
this.configSlot.writeToNBT( data, "config" );
NBTTagCompound storedItems = new NBTTagCompound();
final NBTTagCompound storedItems = new NBTTagCompound();
int offset = 0;
for( IAEItemStack ais : this.inventory.storedItems )
for( final IAEItemStack ais : this.inventory.storedItems )
{
NBTTagCompound it = new NBTTagCompound();
final NBTTagCompound it = new NBTTagCompound();
ais.getItemStack().writeToNBT( it );
storedItems.setTag( String.valueOf( offset ), it );
offset++;
@@ -175,7 +175,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileSecurity( NBTTagCompound data )
public void readFromNBT_TileSecurity( final NBTTagCompound data )
{
this.cm.readFromNBT( data );
if( data.hasKey( "paintedColor" ) )
@@ -186,10 +186,10 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
this.securityKey = data.getLong( "securityKey" );
this.configSlot.readFromNBT( data, "config" );
NBTTagCompound storedItems = data.getCompoundTag( "storedItems" );
for( Object key : storedItems.func_150296_c() )
final NBTTagCompound storedItems = data.getCompoundTag( "storedItems" );
for( final Object key : storedItems.func_150296_c() )
{
NBTBase obj = storedItems.getTag( (String) key );
final NBTBase obj = storedItems.getTag( (String) key );
if( obj instanceof NBTTagCompound )
{
this.inventory.storedItems.add( AEItemStack.create( ItemStack.loadItemStackFromNBT( (NBTTagCompound) obj ) ) );
@@ -204,26 +204,26 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
this.saveChanges();
this.gridProxy.getGrid().postEvent( new MENetworkSecurityChange() );
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// :P
}
}
@MENetworkEventSubscribe
public void bootUpdate( MENetworkChannelsChanged changed )
public void bootUpdate( final MENetworkChannelsChanged changed )
{
this.markForUpdate();
}
@MENetworkEventSubscribe
public void powerUpdate( MENetworkPowerStatusChange changed )
public void powerUpdate( final MENetworkPowerStatusChange changed )
{
this.markForUpdate();
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( final ForgeDirection dir )
{
return AECableType.SMART;
}
@@ -296,7 +296,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
}
@Override
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
{
}
@@ -308,18 +308,18 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
}
@Override
public void readPermissions( HashMap<Integer, EnumSet<SecurityPermissions>> playerPerms )
public void readPermissions( final HashMap<Integer, EnumSet<SecurityPermissions>> playerPerms )
{
IPlayerRegistry pr = AEApi.instance().registries().players();
final IPlayerRegistry pr = AEApi.instance().registries().players();
// read permissions
for( IAEItemStack ais : this.inventory.storedItems )
for( final IAEItemStack ais : this.inventory.storedItems )
{
ItemStack is = ais.getItemStack();
Item i = is.getItem();
final ItemStack is = ais.getItemStack();
final Item i = is.getItem();
if( i instanceof IBiometricCard )
{
IBiometricCard bc = (IBiometricCard) i;
final IBiometricCard bc = (IBiometricCard) i;
bc.registerPermissions( new PlayerSecurityWrapper( playerPerms ), pr, is );
}
}
@@ -347,7 +347,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
}
@Override
public boolean recolourBlock( ForgeDirection side, AEColor newPaintedColor, EntityPlayer who )
public boolean recolourBlock( final ForgeDirection side, final AEColor newPaintedColor, final EntityPlayer who )
{
if( this.paintedColor == newPaintedColor )
{
@@ -71,14 +71,14 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( final ForgeDirection dir )
{
return AECableType.COVERED;
}
@Reflected
@TileEvent( TileEventType.NETWORK_READ )
public boolean hasUpdate( ByteBuf data )
public boolean hasUpdate( final ByteBuf data )
{
final boolean wasOn = this.isOn;
@@ -89,13 +89,13 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
@Reflected
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToNetwork( ByteBuf data )
public void writeToNetwork( final ByteBuf data )
{
data.writeBoolean( this.burnTime > 0 );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileVibrationChamber( NBTTagCompound data )
public void writeToNBT_TileVibrationChamber( final NBTTagCompound data )
{
data.setDouble( "burnTime", this.burnTime );
data.setDouble( "maxBurnTime", this.maxBurnTime );
@@ -103,7 +103,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileVibrationChamber( NBTTagCompound data )
public void readFromNBT_TileVibrationChamber( final NBTTagCompound data )
{
this.burnTime = data.getDouble( "burnTime" );
this.maxBurnTime = data.getDouble( "maxBurnTime" );
@@ -117,13 +117,13 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return TileEntityFurnace.getItemBurnTime( itemstack ) > 0;
}
@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 )
{
if( this.burnTime <= 0 )
{
@@ -133,7 +133,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
{
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// wake up!
}
@@ -142,23 +142,23 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
}
@Override
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final int side )
{
return extractedItem.getItem() == Items.bucket;
}
@Override
public int[] getAccessibleSlotsBySide( ForgeDirection side )
public int[] getAccessibleSlotsBySide( final ForgeDirection side )
{
return ACCESSIBLE_SLOTS;
}
private boolean canEatFuel()
{
ItemStack is = this.getStackInSlot( FUEL_SLOT_INDEX );
final ItemStack is = this.getStackInSlot( FUEL_SLOT_INDEX );
if( is != null )
{
int newBurnTime = TileEntityFurnace.getItemBurnTime( is );
final int newBurnTime = TileEntityFurnace.getItemBurnTime( is );
if( newBurnTime > 0 && is.stackSize > 0 )
{
return true;
@@ -174,7 +174,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
}
@Override
public TickingRequest getTickingRequest( IGridNode node )
public TickingRequest getTickingRequest( final IGridNode node )
{
if( this.burnTime <= 0 )
{
@@ -185,7 +185,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
}
@Override
public TickRateModulation tickingRequest( IGridNode node, int ticksSinceLastCall )
public TickRateModulation tickingRequest( final IGridNode node, final int ticksSinceLastCall )
{
if( this.burnTime <= 0 )
{
@@ -201,7 +201,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
}
this.burnSpeed = Math.max( MIN_BURN_SPEED, Math.min( this.burnSpeed, MAX_BURN_SPEED ) );
double dilation = this.burnSpeed / DILATION_SCALING;
final double dilation = this.burnSpeed / DILATION_SCALING;
double timePassed = ticksSinceLastCall * dilation;
this.burnTime -= timePassed;
@@ -213,9 +213,9 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
try
{
IEnergyGrid grid = this.gridProxy.getEnergy();
double newPower = timePassed * POWER_PER_TICK;
double overFlow = grid.injectPower( newPower, Actionable.SIMULATE );
final IEnergyGrid grid = this.gridProxy.getEnergy();
final double newPower = timePassed * POWER_PER_TICK;
final double overFlow = grid.injectPower( newPower, Actionable.SIMULATE );
// burn the over flow.
grid.injectPower( Math.max( 0.0, newPower - overFlow ), Actionable.MODULATE );
@@ -232,7 +232,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
this.burnSpeed = Math.max( MIN_BURN_SPEED, Math.min( this.burnSpeed, MAX_BURN_SPEED ) );
return overFlow > 0 ? TickRateModulation.SLOWER : TickRateModulation.FASTER;
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
this.burnSpeed -= ticksSinceLastCall;
this.burnSpeed = Math.max( MIN_BURN_SPEED, Math.min( this.burnSpeed, MAX_BURN_SPEED ) );
@@ -277,7 +277,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
{
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// gah!
}
@@ -68,23 +68,23 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
private int oldLV = -1; // on re-calculate light when it changes
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileCableBus( NBTTagCompound data )
public void readFromNBT_TileCableBus( final NBTTagCompound data )
{
this.cb.readFromNBT( data );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileCableBus( NBTTagCompound data )
public void writeToNBT_TileCableBus( final NBTTagCompound data )
{
this.cb.writeToNBT( data );
}
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileCableBus( ByteBuf data ) throws IOException
public boolean readFromStream_TileCableBus( final ByteBuf data ) throws IOException
{
boolean ret = this.cb.readFromStream( data );
final boolean ret = this.cb.readFromStream( data );
int newLV = this.cb.getLightValue();
final int newLV = this.cb.getLightValue();
if( newLV != this.oldLV )
{
this.oldLV = newLV;
@@ -102,27 +102,27 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
{
try
{
TileCableBus tcb = (TileCableBus) BlockCableBus.tesrTile.newInstance();
final TileCableBus tcb = (TileCableBus) BlockCableBus.tesrTile.newInstance();
tcb.copyFrom( this );
this.getWorldObj().setTileEntity( this.xCoord, this.yCoord, this.zCoord, tcb );
}
catch( Throwable ignored )
catch( final Throwable ignored )
{
}
}
}
protected void copyFrom( TileCableBus oldTile )
protected void copyFrom( final TileCableBus oldTile )
{
CableBusContainer tmpCB = this.cb;
final CableBusContainer tmpCB = this.cb;
this.cb = oldTile.cb;
this.oldLV = oldTile.oldLV;
oldTile.cb = tmpCB;
}
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileCableBus( ByteBuf data ) throws IOException
public void writeToStream_TileCableBus( final ByteBuf data ) throws IOException
{
this.cb.writeToStream( data );
}
@@ -148,13 +148,13 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
}
@Override
public IGridNode getGridNode( ForgeDirection dir )
public IGridNode getGridNode( final ForgeDirection dir )
{
return this.cb.getGridNode( dir );
}
@Override
public AECableType getCableConnectionType( ForgeDirection side )
public AECableType getCableConnectionType( final ForgeDirection side )
{
return this.cb.getCableConnectionType( side );
}
@@ -174,7 +174,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
return;
}
int newLV = this.cb.getLightValue();
final int newLV = this.cb.getLightValue();
if( newLV != this.oldLV )
{
this.oldLV = newLV;
@@ -192,13 +192,13 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
}
@Override
public void getDrops( World w, int x, int y, int z, List drops )
public void getDrops( final World w, final int x, final int y, final int z, final List drops )
{
this.cb.getDrops( drops );
}
@Override
public void getNoDrops( World w, int x, int y, int z, List<ItemStack> drops )
public void getNoDrops( final World w, final int x, final int y, final int z, final List<ItemStack> drops )
{
this.cb.getNoDrops( drops );
}
@@ -233,25 +233,25 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
}
@Override
public boolean canAddPart( ItemStack is, ForgeDirection side )
public boolean canAddPart( final ItemStack is, final ForgeDirection side )
{
return this.cb.canAddPart( is, side );
}
@Override
public ForgeDirection addPart( ItemStack is, ForgeDirection side, EntityPlayer player )
public ForgeDirection addPart( final ItemStack is, final ForgeDirection side, final EntityPlayer player )
{
return this.cb.addPart( is, side, player );
}
@Override
public IPart getPart( ForgeDirection side )
public IPart getPart( final ForgeDirection side )
{
return this.cb.getPart( side );
}
@Override
public void removePart( ForgeDirection side, boolean suppressUpdate )
public void removePart( final ForgeDirection side, final boolean suppressUpdate )
{
this.cb.removePart( side, suppressUpdate );
}
@@ -275,19 +275,19 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
}
@Override
public boolean isBlocked( ForgeDirection side )
public boolean isBlocked( final ForgeDirection side )
{
return !this.ImmibisMicroblocks_isSideOpen( side.ordinal() );
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( World w, int x, int y, int z, Entity e, boolean visual )
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final int x, final int y, final int z, final Entity e, final boolean visual )
{
return this.cb.getSelectedBoundingBoxesFromPool( false, true, e, visual );
}
@Override
public SelectedPart selectPart( Vec3 pos )
public SelectedPart selectPart( final Vec3 pos )
{
return this.cb.selectPart( pos );
}
@@ -305,7 +305,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
}
@Override
public boolean hasRedstone( ForgeDirection side )
public boolean hasRedstone( final ForgeDirection side )
{
return this.cb.hasRedstone( side );
}
@@ -327,7 +327,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
{
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.ImmibisMicroblocks ) )
{
IImmibisMicroblocks imb = (IImmibisMicroblocks) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.ImmibisMicroblocks );
final IImmibisMicroblocks imb = (IImmibisMicroblocks) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.ImmibisMicroblocks );
if( imb != null && imb.leaveParts( this ) )
{
return;
@@ -338,9 +338,9 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
}
@Override
public void addCollidingBlockToList( World w, int x, int y, int z, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e )
public void addCollidingBlockToList( final World w, final int x, final int y, final int z, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
{
for( AxisAlignedBB bx : this.getSelectedBoundingBoxesFromPool( w, x, y, z, e, false ) )
for( final 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 ) );
}
@@ -361,7 +361,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
return this.cb.isInWorld();
}
public boolean ImmibisMicroblocks_isSideOpen( int side )
public boolean ImmibisMicroblocks_isSideOpen( final int side )
{
return true;
}
@@ -372,7 +372,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
}
@Override
public boolean recolourBlock( ForgeDirection side, AEColor colour, EntityPlayer who )
public boolean recolourBlock( final ForgeDirection side, final AEColor colour, final EntityPlayer who )
{
return this.cb.recolourBlock( side, colour, who );
}
@@ -32,11 +32,11 @@ public class TileCableBusTESR extends TileCableBus
{
try
{
TileCableBus tcb = (TileCableBus) BlockCableBus.noTesrTile.newInstance();
final TileCableBus tcb = (TileCableBus) BlockCableBus.noTesrTile.newInstance();
tcb.copyFrom( this );
this.getWorldObj().setTileEntity( this.xCoord, this.yCoord, this.zCoord, tcb );
}
catch( Throwable ignored )
catch( final Throwable ignored )
{
}
@@ -56,7 +56,7 @@ public class TileController extends AENetworkPowerTile
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( final ForgeDirection dir )
{
return AECableType.DENSE;
}
@@ -68,7 +68,7 @@ public class TileController extends AENetworkPowerTile
super.onReady();
}
public void onNeighborChange( boolean force )
public void onNeighborChange( final boolean force )
{
final boolean xx = checkController( this.xCoord - 1, this.yCoord, this.zCoord ) && checkController( this.xCoord + 1, this.yCoord, this.zCoord );
final boolean yy = checkController( this.xCoord, this.yCoord - 1, this.zCoord ) && checkController( this.xCoord, this.yCoord + 1, this.zCoord );
@@ -119,7 +119,7 @@ public class TileController extends AENetworkPowerTile
}
}
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
meta = 0;
}
@@ -131,13 +131,13 @@ public class TileController extends AENetworkPowerTile
}
@Override
protected double getFunnelPowerDemand( double maxReceived )
protected double getFunnelPowerDemand( final double maxReceived )
{
try
{
return this.gridProxy.getEnergy().getEnergyDemand( 8000 );
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// no grid? use local...
return super.getFunnelPowerDemand( maxReceived );
@@ -145,18 +145,18 @@ public class TileController extends AENetworkPowerTile
}
@Override
protected double funnelPowerIntoStorage( double power, Actionable mode )
protected double funnelPowerIntoStorage( final double power, final Actionable mode )
{
try
{
double ret = this.gridProxy.getEnergy().injectPower( power, mode );
final double ret = this.gridProxy.getEnergy().injectPower( power, mode );
if( mode == Actionable.SIMULATE )
{
return ret;
}
return 0;
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// no grid? use local...
return super.funnelPowerIntoStorage( power, mode );
@@ -164,26 +164,26 @@ public class TileController extends AENetworkPowerTile
}
@Override
protected void PowerEvent( PowerEventType x )
protected void PowerEvent( final PowerEventType x )
{
try
{
this.gridProxy.getGrid().postEvent( new MENetworkPowerStorage( this, x ) );
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// not ready!
}
}
@MENetworkEventSubscribe
public void onControllerChange( MENetworkControllerChange status )
public void onControllerChange( final MENetworkControllerChange status )
{
this.updateMeta();
}
@MENetworkEventSubscribe
public void onPowerChange( MENetworkPowerStatusChange status )
public void onPowerChange( final MENetworkPowerStatusChange status )
{
this.updateMeta();
}
@@ -195,13 +195,13 @@ public class TileController extends AENetworkPowerTile
}
@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 int[] getAccessibleSlotsBySide( ForgeDirection side )
public int[] getAccessibleSlotsBySide( final ForgeDirection side )
{
return ACCESSIBLE_SLOTS_BY_SIDE;
}
@@ -211,7 +211,7 @@ public class TileController extends AENetworkPowerTile
*
* @return true if there is a loaded controller
*/
private boolean checkController( int x, int y, int z )
private boolean checkController( final int x, final int y, final int z )
{
if( this.worldObj.getChunkProvider().chunkExists( this.xCoord >> 4, this.zCoord >> 4 ) )
{
@@ -38,13 +38,13 @@ public class TileCreativeEnergyCell extends AENetworkTile implements IAEPowerSto
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( final ForgeDirection dir )
{
return AECableType.COVERED;
}
@Override
public double injectAEPower( double amt, Actionable mode )
public double injectAEPower( final double amt, final Actionable mode )
{
return 0;
}
@@ -74,7 +74,7 @@ public class TileCreativeEnergyCell extends AENetworkTile implements IAEPowerSto
}
@Override
public double extractAEPower( double amt, Actionable mode, PowerMultiplier pm )
public double extractAEPower( final double amt, final Actionable mode, final PowerMultiplier pm )
{
return amt;
}
@@ -46,7 +46,7 @@ public class TileEnergyAcceptor extends AENetworkPowerTile
}
@Override
public void readFromNBT_AENetwork( NBTTagCompound data )
public void readFromNBT_AENetwork( final NBTTagCompound data )
{
/**
* Does nothing here since the NBT tag in the parent is not needed anymore
@@ -54,7 +54,7 @@ public class TileEnergyAcceptor extends AENetworkPowerTile
}
@Override
public void writeToNBT_AENetwork( NBTTagCompound data )
public void writeToNBT_AENetwork( final NBTTagCompound data )
{
/**
* Does nothing here since the NBT tag in the parent is not needed anymore
@@ -62,39 +62,39 @@ public class TileEnergyAcceptor extends AENetworkPowerTile
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( final ForgeDirection dir )
{
return AECableType.COVERED;
}
@Override
protected double getFunnelPowerDemand( double maxRequired )
protected double getFunnelPowerDemand( final double maxRequired )
{
try
{
IEnergyGrid grid = this.gridProxy.getEnergy();
final IEnergyGrid grid = this.gridProxy.getEnergy();
return grid.getEnergyDemand( maxRequired );
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
return this.internalMaxPower;
}
}
@Override
protected double funnelPowerIntoStorage( double power, Actionable mode )
protected double funnelPowerIntoStorage( final double power, final Actionable mode )
{
try
{
IEnergyGrid grid = this.gridProxy.getEnergy();
double leftOver = grid.injectPower( power, mode );
final IEnergyGrid grid = this.gridProxy.getEnergy();
final double leftOver = grid.injectPower( power, mode );
if( mode == Actionable.SIMULATE )
{
return leftOver;
}
return 0.0;
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
return super.funnelPowerIntoStorage( power, mode );
}
@@ -107,13 +107,13 @@ public class TileEnergyAcceptor extends AENetworkPowerTile
}
@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 int[] getAccessibleSlotsBySide( ForgeDirection side )
public int[] getAccessibleSlotsBySide( final ForgeDirection side )
{
return this.sides;
}
@@ -50,7 +50,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( final ForgeDirection dir )
{
return AECableType.COVERED;
}
@@ -89,7 +89,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileEnergyCell( NBTTagCompound data )
public void writeToNBT_TileEnergyCell( final NBTTagCompound data )
{
if( !this.worldObj.isRemote )
{
@@ -98,7 +98,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileEnergyCell( NBTTagCompound data )
public void readFromNBT_TileEnergyCell( final NBTTagCompound data )
{
this.internalCurrentPower = data.getDouble( "internalCurrentPower" );
}
@@ -110,7 +110,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
}
@Override
public void uploadSettings( SettingsFrom from, NBTTagCompound compound )
public void uploadSettings( final SettingsFrom from, final NBTTagCompound compound )
{
if( from == SettingsFrom.DISMANTLE_ITEM )
{
@@ -119,11 +119,11 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
}
@Override
public NBTTagCompound downloadSettings( SettingsFrom from )
public NBTTagCompound downloadSettings( final SettingsFrom from )
{
if( from == SettingsFrom.DISMANTLE_ITEM )
{
NBTTagCompound tag = new NBTTagCompound();
final NBTTagCompound tag = new NBTTagCompound();
tag.setDouble( "internalCurrentPower", this.internalCurrentPower );
tag.setDouble( "internalMaxPower", this.internalMaxPower ); // used for tool tip.
return tag;
@@ -132,11 +132,11 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
}
@Override
public final double injectAEPower( double amt, Actionable mode )
public final double injectAEPower( double amt, final Actionable mode )
{
if( mode == Actionable.SIMULATE )
{
double fakeBattery = this.internalCurrentPower + amt;
final double fakeBattery = this.internalCurrentPower + amt;
if( fakeBattery > this.internalMaxPower )
{
return fakeBattery - this.internalMaxPower;
@@ -189,12 +189,12 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
}
@Override
public final double extractAEPower( double amt, Actionable mode, PowerMultiplier pm )
public final double extractAEPower( final double amt, final Actionable mode, final PowerMultiplier pm )
{
return pm.divide( this.extractAEPower( pm.multiply( amt ), mode ) );
}
private double extractAEPower( double amt, Actionable mode )
private double extractAEPower( double amt, final Actionable mode )
{
if( mode == Actionable.SIMULATE )
{
@@ -205,7 +205,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
return this.internalCurrentPower;
}
boolean wasFull = this.internalCurrentPower >= this.internalMaxPower - 0.001;
final boolean wasFull = this.internalCurrentPower >= this.internalMaxPower - 0.001;
if( wasFull && amt > 0.001 )
{
@@ -213,7 +213,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
{
this.gridProxy.getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) );
}
catch( GridAccessException ignored )
catch( final GridAccessException ignored )
{
}
@@ -65,35 +65,35 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
}
@Override
public void setOrientation( ForgeDirection inForward, ForgeDirection inUp )
public void setOrientation( final ForgeDirection inForward, final ForgeDirection inUp )
{
super.setOrientation( inForward, inUp );
this.gridProxy.setValidSides( EnumSet.of( this.getForward().getOpposite() ) );
}
@MENetworkEventSubscribe
public void chanRender( MENetworkChannelsChanged c )
public void chanRender( final MENetworkChannelsChanged c )
{
this.markForUpdate();
}
@MENetworkEventSubscribe
public void powerRender( MENetworkPowerStatusChange c )
public void powerRender( final MENetworkPowerStatusChange c )
{
this.markForUpdate();
}
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileWireless( ByteBuf data )
public boolean readFromStream_TileWireless( final ByteBuf data )
{
int old = this.clientFlags;
final int old = this.clientFlags;
this.clientFlags = data.readByte();
return old != this.clientFlags;
}
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileWireless( ByteBuf data )
public void writeToStream_TileWireless( final ByteBuf data )
{
this.clientFlags = 0;
@@ -109,7 +109,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
this.clientFlags |= CHANNEL_FLAG;
}
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// meh
}
@@ -118,7 +118,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( final ForgeDirection dir )
{
return AECableType.SMART;
}
@@ -136,19 +136,19 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return AEApi.instance().definitions().materials().wirelessBooster().isSameAs( 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 )
{
// :P
}
@Override
public int[] getAccessibleSlotsBySide( ForgeDirection side )
public int[] getAccessibleSlotsBySide( final ForgeDirection side )
{
return this.sides;
}
@@ -167,7 +167,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
private int getBoosters()
{
ItemStack boosters = this.inv.getStackInSlot( 0 );
final ItemStack boosters = this.inv.getStackInSlot( 0 );
return boosters == null ? 0 : boosters.stackSize;
}
@@ -201,7 +201,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
{
return this.gridProxy.getGrid();
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
return null;
}
@@ -53,46 +53,46 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
return this.internalPowerSides.clone();
}
protected void setPowerSides( EnumSet<ForgeDirection> sides )
protected void setPowerSides( final EnumSet<ForgeDirection> sides )
{
this.internalPowerSides = sides;
// trigger re-calc!
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_AERootPoweredTile( NBTTagCompound data )
public void writeToNBT_AERootPoweredTile( final NBTTagCompound data )
{
data.setDouble( "internalCurrentPower", this.internalCurrentPower );
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_AERootPoweredTile( NBTTagCompound data )
public void readFromNBT_AERootPoweredTile( final NBTTagCompound data )
{
this.internalCurrentPower = data.getDouble( "internalCurrentPower" );
}
protected final double getExternalPowerDemand( PowerUnits externalUnit, double maxPowerRequired )
protected final double getExternalPowerDemand( final PowerUnits externalUnit, final double maxPowerRequired )
{
return PowerUnits.AE.convertTo( externalUnit, Math.max( 0.0, this.getFunnelPowerDemand( externalUnit.convertTo( PowerUnits.AE, maxPowerRequired ) ) ) );
}
protected double getFunnelPowerDemand( double maxRequired )
protected double getFunnelPowerDemand( final double maxRequired )
{
return this.internalMaxPower - this.internalCurrentPower;
}
public final double injectExternalPower( PowerUnits input, double amt )
public final double injectExternalPower( final PowerUnits input, final double amt )
{
return PowerUnits.AE.convertTo( input, this.funnelPowerIntoStorage( input.convertTo( PowerUnits.AE, amt ), Actionable.MODULATE ) );
}
protected double funnelPowerIntoStorage( double power, Actionable mode )
protected double funnelPowerIntoStorage( final double power, final Actionable mode )
{
return this.injectAEPower( power, mode );
}
@Override
public final double injectAEPower( double amt, Actionable mode )
public final double injectAEPower( double amt, final Actionable mode )
{
if( amt < 0.000001 )
{
@@ -101,7 +101,7 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
if( mode == Actionable.SIMULATE )
{
double fakeBattery = this.internalCurrentPower + amt;
final double fakeBattery = this.internalCurrentPower + amt;
if( fakeBattery > this.internalMaxPower )
{
@@ -129,7 +129,7 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
}
}
protected void PowerEvent( PowerEventType x )
protected void PowerEvent( final PowerEventType x )
{
// nothing.
}
@@ -159,12 +159,12 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
}
@Override
public final double extractAEPower( double amt, Actionable mode, PowerMultiplier multiplier )
public final double extractAEPower( final double amt, final Actionable mode, final PowerMultiplier multiplier )
{
return multiplier.divide( this.extractAEPower( multiplier.multiply( amt ), mode ) );
}
protected double extractAEPower( double amt, Actionable mode )
protected double extractAEPower( double amt, final Actionable mode )
{
if( mode == Actionable.SIMULATE )
{
@@ -175,7 +175,7 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
return this.internalCurrentPower;
}
boolean wasFull = this.internalCurrentPower >= this.internalMaxPower - 0.001;
final boolean wasFull = this.internalCurrentPower >= this.internalMaxPower - 0.001;
if( wasFull && amt > 0.001 )
{
this.PowerEvent( PowerEventType.REQUEST_POWER );
+6 -6
View File
@@ -41,7 +41,7 @@ public abstract class IC2 extends AERootPoweredTile implements IEnergySink
boolean isInIC2 = false;
@Override
public final boolean acceptsEnergyFrom( TileEntity emitter, ForgeDirection direction )
public final boolean acceptsEnergyFrom( final TileEntity emitter, final ForgeDirection direction )
{
return this.getPowerSides().contains( direction );
}
@@ -59,11 +59,11 @@ public abstract class IC2 extends AERootPoweredTile implements IEnergySink
}
@Override
public final double injectEnergy( ForgeDirection directionFrom, double amount, double voltage )
public final double injectEnergy( final ForgeDirection directionFrom, final double amount, final double voltage )
{
// 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, this.injectExternalPower( PowerUnits.EU, amount ) );
final double overflow = PowerUnits.EU.convertTo( PowerUnits.AE, this.injectExternalPower( PowerUnits.EU, amount ) );
this.internalCurrentPower += overflow;
return 0; // see above comment.
}
@@ -79,7 +79,7 @@ public abstract class IC2 extends AERootPoweredTile implements IEnergySink
{
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.IC2 ) )
{
IIC2 ic2Integration = (IIC2) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.IC2 );
final IIC2 ic2Integration = (IIC2) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.IC2 );
if( this.isInIC2 && Platform.isServer() && ic2Integration != null )
{
ic2Integration.removeFromEnergyNet( this );
@@ -106,7 +106,7 @@ public abstract class IC2 extends AERootPoweredTile implements IEnergySink
{
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.IC2 ) )
{
IIC2 ic2Integration = (IIC2) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.IC2 );
final IIC2 ic2Integration = (IIC2) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.IC2 );
if( !this.isInIC2 && Platform.isServer() && ic2Integration != null )
{
ic2Integration.addToEnergyNet( this );
@@ -116,7 +116,7 @@ public abstract class IC2 extends AERootPoweredTile implements IEnergySink
}
@Override
protected void setPowerSides( EnumSet<ForgeDirection> sides )
protected void setPowerSides( final EnumSet<ForgeDirection> sides )
{
super.setPowerSides( sides );
this.removeFromENet();
@@ -39,9 +39,9 @@ public abstract class MekJoules extends RedstoneFlux implements IStrictEnergyAcc
}
@Override
public void setEnergy( double energy )
public void setEnergy( final double energy )
{
double extra = this.injectExternalPower( PowerUnits.MK, energy );
final double extra = this.injectExternalPower( PowerUnits.MK, energy );
this.internalCurrentPower += PowerUnits.MK.convertTo( PowerUnits.AE, extra );
}
@@ -52,20 +52,20 @@ public abstract class MekJoules extends RedstoneFlux implements IStrictEnergyAcc
}
@Override
public double transferEnergyToAcceptor( ForgeDirection side, double amount )
public double transferEnergyToAcceptor( final ForgeDirection side, double amount )
{
double demand = this.getExternalPowerDemand( PowerUnits.MK, Double.MAX_VALUE );
final double demand = this.getExternalPowerDemand( PowerUnits.MK, Double.MAX_VALUE );
if( amount > demand )
{
amount = demand;
}
double overflow = this.injectExternalPower( PowerUnits.MK, amount );
final double overflow = this.injectExternalPower( PowerUnits.MK, amount );
return amount - overflow;
}
@Override
public boolean canReceiveEnergy( ForgeDirection side )
public boolean canReceiveEnergy( final ForgeDirection side )
{
return this.getPowerSides().contains( side );
}
@@ -32,7 +32,7 @@ import appeng.transformer.annotations.Integration.Interface;
public abstract class RedstoneFlux extends RotaryCraft implements IEnergyReceiver
{
@Override
public final int receiveEnergy( ForgeDirection from, int maxReceive, boolean simulate )
public final int receiveEnergy( final ForgeDirection from, final int maxReceive, final boolean simulate )
{
final int networkRFDemand = (int) Math.floor( this.getExternalPowerDemand( PowerUnits.RF, maxReceive ) );
final int usedRF = Math.min( maxReceive, networkRFDemand );
@@ -46,19 +46,19 @@ public abstract class RedstoneFlux extends RotaryCraft implements IEnergyReceive
}
@Override
public final int getEnergyStored( ForgeDirection from )
public final int getEnergyStored( final ForgeDirection from )
{
return (int) Math.floor( PowerUnits.AE.convertTo( PowerUnits.RF, this.getAECurrentPower() ) );
}
@Override
public final int getMaxEnergyStored( ForgeDirection from )
public final int getMaxEnergyStored( final ForgeDirection from )
{
return (int) Math.floor( PowerUnits.AE.convertTo( PowerUnits.RF, this.getAEMaxPower() ) );
}
@Override
public final boolean canConnectEnergy( ForgeDirection from )
public final boolean canConnectEnergy( final ForgeDirection from )
{
return this.getPowerSides().contains( from );
}
@@ -59,7 +59,7 @@ public abstract class RotaryCraft extends IC2 implements AdvancedShaftPowerRecei
}
@Override
public final boolean addPower( int torque, int omega, long power, ForgeDirection side )
public final boolean addPower( final int torque, final int omega, final long power, final ForgeDirection side )
{
this.omega = omega;
this.torque = torque;
@@ -102,12 +102,12 @@ public abstract class RotaryCraft extends IC2 implements AdvancedShaftPowerRecei
}
@Override
public final void setIORenderAlpha( int io )
public final void setIORenderAlpha( final int io )
{
this.alpha = io;
}
public final boolean canReadFromBlock( int x, int y, int z )
public final boolean canReadFromBlock( final int x, final int y, final int z )
{
ForgeDirection side = ForgeDirection.UNKNOWN;
@@ -140,7 +140,7 @@ public abstract class RotaryCraft extends IC2 implements AdvancedShaftPowerRecei
}
@Override
public final boolean canReadFrom( ForgeDirection side )
public final boolean canReadFrom( final ForgeDirection side )
{
return this.getPowerSides().contains( side );
}
@@ -152,15 +152,15 @@ public abstract class RotaryCraft extends IC2 implements AdvancedShaftPowerRecei
}
@Override
public final int getMinTorque( int available )
public final int getMinTorque( final int available )
{
return 1;
}
@Override
public final ArrayList<String> getMessages( World world, int x, int y, int z, int side )
public final ArrayList<String> getMessages( final World world, final int x, final int y, final int z, final int side )
{
String out;
final String out;
if( this.power >= 1000000000 )
{
out = String.format( "Receiving %.3f GW @ %d rad/s.", this.power / 1000000000.0D, this.omega );
@@ -178,7 +178,7 @@ public abstract class RotaryCraft extends IC2 implements AdvancedShaftPowerRecei
out = String.format( "Receiving %d W @ %d rad/s.", this.power, this.omega );
}
ArrayList<String> messages = new ArrayList<String>( 1 );
final ArrayList<String> messages = new ArrayList<String>( 1 );
messages.add( out );
return messages;
}
@@ -91,7 +91,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
}
@TileEvent( TileEventType.NETWORK_WRITE )
public void onNetworkWriteEvent( ByteBuf data )
public void onNetworkWriteEvent( final ByteBuf data )
{
int out = this.constructed;
@@ -109,9 +109,9 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
}
@TileEvent( TileEventType.NETWORK_READ )
public boolean onNetworkReadEvent( ByteBuf data )
public boolean onNetworkReadEvent( final ByteBuf data )
{
int oldValue = this.constructed;
final int oldValue = this.constructed;
this.constructed = data.readByte();
this.bridgePowered = ( this.constructed | this.powered ) == this.powered;
return this.constructed != oldValue;
@@ -124,7 +124,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
}
@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 )
{
if( this.cluster != null )
{
@@ -133,7 +133,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
}
@Override
public int[] getAccessibleSlotsBySide( ForgeDirection side )
public int[] getAccessibleSlotsBySide( final ForgeDirection side )
{
if( this.isCenter() )
{
@@ -144,7 +144,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
public boolean isCenter()
{
for( Block link : AEApi.instance().definitions().blocks().quantumLink().maybeBlock().asSet() )
for( final Block link : AEApi.instance().definitions().blocks().quantumLink().maybeBlock().asSet() )
{
return this.getBlockType() == link;
}
@@ -153,7 +153,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
}
@MENetworkEventSubscribe
public void onPowerStatusChange( MENetworkPowerStatusChange c )
public void onPowerStatusChange( final MENetworkPowerStatusChange c )
{
this.updateStatus = true;
}
@@ -192,7 +192,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
}
@Override
public void disconnect( boolean affectWorld )
public void disconnect( final boolean affectWorld )
{
if( this.cluster != null )
{
@@ -224,7 +224,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
return !this.isInvalid();
}
public void updateStatus( QuantumCluster c, byte flags, boolean affectWorld )
public void updateStatus( final QuantumCluster c, final byte flags, final boolean affectWorld )
{
this.cluster = c;
@@ -254,11 +254,11 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
public EnumSet<ForgeDirection> getConnections()
{
EnumSet<ForgeDirection> set = EnumSet.noneOf( ForgeDirection.class );
final EnumSet<ForgeDirection> set = EnumSet.noneOf( ForgeDirection.class );
for( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
for( final ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
{
TileEntity te = this.worldObj.getTileEntity( this.xCoord + d.offsetX, this.yCoord + d.offsetY, this.zCoord + d.offsetZ );
final TileEntity te = this.worldObj.getTileEntity( this.xCoord + d.offsetX, this.yCoord + d.offsetY, this.zCoord + d.offsetZ );
if( te instanceof TileQuantumBridge )
{
set.add( d );
@@ -270,10 +270,10 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
public long getQEFrequency()
{
ItemStack is = this.internalInventory.getStackInSlot( 0 );
final ItemStack is = this.internalInventory.getStackInSlot( 0 );
if( is != null )
{
NBTTagCompound c = is.getTagCompound();
final NBTTagCompound c = is.getTagCompound();
if( c != null )
{
return c.getLong( "freq" );
@@ -293,7 +293,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
{
return this.gridProxy.getEnergy().isNetworkPowered();
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// :P
}
@@ -307,7 +307,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( final ForgeDirection dir )
{
return AECableType.DENSE;
}
@@ -62,13 +62,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" ) )
{
@@ -88,7 +88,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
public void updateRedstoneState()
{
YesNo currentState = this.worldObj.isBlockIndirectlyGettingPowered( this.xCoord, this.yCoord, this.zCoord ) ? YesNo.YES : YesNo.NO;
final YesNo currentState = this.worldObj.isBlockIndirectlyGettingPowered( this.xCoord, this.yCoord, this.zCoord ) ? YesNo.YES : YesNo.NO;
if( this.lastRedstoneState != currentState )
{
this.lastRedstoneState = currentState;
@@ -103,7 +103,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.
@@ -111,38 +111,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 );
@@ -158,7 +158,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( final ForgeDirection dir )
{
return AECableType.SMART;
}
@@ -176,31 +176,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, int side )
public boolean canInsertItem( final int slotIndex, final ItemStack insertingItem, final int side )
{
return this.isItemValidForSlot( slotIndex, insertingItem );
}
@Override
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final int side )
{
return slotIndex == 1;
}
@Override
public int[] getAccessibleSlotsBySide( ForgeDirection side )
public int[] getAccessibleSlotsBySide( final ForgeDirection side )
{
return this.sides;
}
@@ -99,7 +99,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
}
@Override
public void disconnect( boolean b )
public void disconnect( final boolean b )
{
if( this.cluster != null )
{
@@ -120,7 +120,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( ForgeDirection.class ) : EnumSet.allOf( ForgeDirection.class ) );
@@ -129,7 +129,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
public void recalculateDisplay()
{
int oldBits = this.displayBits;
final int oldBits = this.displayBits;
this.displayBits = 0;
@@ -176,7 +176,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
this.displayBits |= DISPLAY_ENABLED;
}
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// nothing?
}
@@ -192,7 +192,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;
@@ -217,27 +217,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();
}
@@ -126,7 +126,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@Override
protected void PowerEvent( PowerEventType x )
protected void PowerEvent( final PowerEventType x )
{
if( x == PowerEventType.REQUEST_POWER )
{
@@ -134,7 +134,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
this.gridProxy.getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) );
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// :(
}
@@ -147,7 +147,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
private void recalculateDisplay()
{
int oldState = this.state;
final int oldState = this.state;
for( int x = 0; x < this.getCellCount(); x++ )
{
@@ -163,7 +163,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
this.state &= ~0x40;
}
boolean currentActive = this.gridProxy.isActive();
final boolean currentActive = this.gridProxy.isActive();
if( this.wasActive != currentActive )
{
this.wasActive = currentActive;
@@ -171,7 +171,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// :P
}
@@ -189,14 +189,14 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
return 1;
}
public IMEInventoryHandler getHandler( StorageChannel channel ) throws ChestNoHandler
public IMEInventoryHandler getHandler( final StorageChannel channel ) throws ChestNoHandler
{
if( !this.isCached )
{
this.itemCell = null;
this.fluidCell = null;
ItemStack is = this.inv.getStackInSlot( 1 );
final ItemStack is = this.inv.getStackInSlot( 1 );
if( is != null )
{
this.isCached = true;
@@ -205,8 +205,8 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
double power = 1.0;
IMEInventoryHandler<IAEItemStack> itemCell = this.cellHandler.getCellInventory( is, this, StorageChannel.ITEMS );
IMEInventoryHandler<IAEFluidStack> fluidCell = this.cellHandler.getCellInventory( is, this, StorageChannel.FLUIDS );
final IMEInventoryHandler<IAEItemStack> itemCell = this.cellHandler.getCellInventory( is, this, StorageChannel.ITEMS );
final IMEInventoryHandler<IAEFluidStack> fluidCell = this.cellHandler.getCellInventory( is, this, StorageChannel.FLUIDS );
if( itemCell != null )
{
@@ -245,56 +245,56 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
return null;
}
private <StackType extends IAEStack> MEMonitorHandler<StackType> wrap( IMEInventoryHandler h )
private <StackType extends IAEStack> MEMonitorHandler<StackType> wrap( final IMEInventoryHandler h )
{
if( h == null )
{
return null;
}
MEInventoryHandler ih = new MEInventoryHandler( h, h.getChannel() );
final MEInventoryHandler ih = new MEInventoryHandler( h, h.getChannel() );
ih.setPriority( this.priority );
MEMonitorHandler<StackType> g = new ChestMonitorHandler<StackType>( ih );
final MEMonitorHandler<StackType> g = new ChestMonitorHandler<StackType>( ih );
g.addListener( new ChestNetNotifier( h.getChannel() ), g );
return g;
}
@Override
public int getCellStatus( int slot )
public int getCellStatus( final int slot )
{
if( Platform.isClient() )
{
return ( this.state >> ( slot * 3 ) ) & 3;
}
ItemStack cell = this.inv.getStackInSlot( 1 );
ICellHandler ch = AEApi.instance().registries().cell().getHandler( cell );
final ItemStack cell = this.inv.getStackInSlot( 1 );
final ICellHandler ch = AEApi.instance().registries().cell().getHandler( cell );
if( ch != null )
{
try
{
IMEInventoryHandler handler = this.getHandler( StorageChannel.ITEMS );
final IMEInventoryHandler handler = this.getHandler( StorageChannel.ITEMS );
if( handler instanceof ChestMonitorHandler )
{
return ch.getStatusForCell( cell, ( (ChestMonitorHandler) handler ).getInternalHandler() );
}
}
catch( ChestNoHandler ignored )
catch( final ChestNoHandler ignored )
{
}
try
{
IMEInventoryHandler handler = this.getHandler( StorageChannel.FLUIDS );
final IMEInventoryHandler handler = this.getHandler( StorageChannel.FLUIDS );
if( handler instanceof ChestMonitorHandler )
{
return ch.getStatusForCell( cell, ( (ChestMonitorHandler) handler ).getInternalHandler() );
}
}
catch( ChestNoHandler ignored )
catch( final ChestNoHandler ignored )
{
}
}
@@ -318,7 +318,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
gridPowered = this.gridProxy.getEnergy().isNetworkPowered();
}
catch( GridAccessException ignored )
catch( final GridAccessException ignored )
{
}
}
@@ -327,9 +327,9 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@Override
public boolean isCellBlinking( int slot )
public boolean isCellBlinking( final int slot )
{
long now = this.worldObj.getTotalWorldTime();
final long now = this.worldObj.getTotalWorldTime();
if( now - this.lastStateChange > 8 )
{
return false;
@@ -339,20 +339,20 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@Override
protected double extractAEPower( double amt, Actionable mode )
protected double extractAEPower( final double amt, final Actionable mode )
{
double stash = 0.0;
try
{
IEnergyGrid eg = this.gridProxy.getEnergy();
final IEnergyGrid eg = this.gridProxy.getEnergy();
stash = eg.extractAEPower( amt, mode, PowerMultiplier.ONE );
if( stash >= amt )
{
return stash;
}
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// no grid :(
}
@@ -369,22 +369,22 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
return;
}
double idleUsage = this.gridProxy.getIdlePowerUsage();
final double idleUsage = this.gridProxy.getIdlePowerUsage();
try
{
if( !this.gridProxy.getEnergy().isNetworkPowered() )
{
double powerUsed = this.extractAEPower( idleUsage, Actionable.MODULATE, PowerMultiplier.CONFIG ); // drain
final double powerUsed = this.extractAEPower( idleUsage, Actionable.MODULATE, PowerMultiplier.CONFIG ); // drain
if( powerUsed + 0.1 >= idleUsage != ( this.state & 0x40 ) > 0 )
{
this.recalculateDisplay();
}
}
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
double powerUsed = this.extractAEPower( this.gridProxy.getIdlePowerUsage(), Actionable.MODULATE, PowerMultiplier.CONFIG ); // drain
final double powerUsed = this.extractAEPower( this.gridProxy.getIdlePowerUsage(), Actionable.MODULATE, PowerMultiplier.CONFIG ); // drain
if( powerUsed + 0.1 >= idleUsage != ( this.state & 0x40 ) > 0 )
{
this.recalculateDisplay();
@@ -398,7 +398,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileChest( ByteBuf data )
public void writeToStream_TileChest( final ByteBuf data )
{
if( this.worldObj.getTotalWorldTime() - this.lastStateChange > 8 )
{
@@ -426,7 +426,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
data.writeByte( this.state );
data.writeByte( this.paintedColor.ordinal() );
ItemStack is = this.inv.getStackInSlot( 1 );
final ItemStack is = this.inv.getStackInSlot( 1 );
if( is == null )
{
@@ -439,16 +439,16 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileChest( ByteBuf data )
public boolean readFromStream_TileChest( final ByteBuf data )
{
int oldState = this.state;
ItemStack oldType = this.storageType;
final int oldState = this.state;
final ItemStack oldType = this.storageType;
this.state = data.readByte();
AEColor oldPaintedColor = this.paintedColor;
final AEColor oldPaintedColor = this.paintedColor;
this.paintedColor = AEColor.values()[data.readByte()];
int item = data.readInt();
final int item = data.readInt();
if( item == 0 )
{
@@ -465,7 +465,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileChest( NBTTagCompound data )
public void readFromNBT_TileChest( final NBTTagCompound data )
{
this.config.readFromNBT( data );
this.priority = data.getInteger( "priority" );
@@ -476,7 +476,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileChest( NBTTagCompound data )
public void writeToNBT_TileChest( final NBTTagCompound data )
{
this.config.writeToNBT( data );
data.setInteger( "priority", this.priority );
@@ -484,13 +484,13 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@MENetworkEventSubscribe
public void powerRender( MENetworkPowerStatusChange c )
public void powerRender( final MENetworkPowerStatusChange c )
{
this.recalculateDisplay();
}
@MENetworkEventSubscribe
public void channelRender( MENetworkChannelsChanged c )
public void channelRender( final MENetworkChannelsChanged c )
{
this.recalculateDisplay();
}
@@ -514,14 +514,14 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@Override
public void setInventorySlotContents( int i, ItemStack itemstack )
public void setInventorySlotContents( final int i, final ItemStack itemstack )
{
this.inv.setInventorySlotContents( i, itemstack );
this.tryToStoreContents();
}
@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 )
{
if( slot == 1 )
{
@@ -533,10 +533,10 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
IStorageGrid gs = this.gridProxy.getStorage();
final IStorageGrid gs = this.gridProxy.getStorage();
Platform.postChanges( gs, removed, added, this.mySrc );
}
catch( GridAccessException ignored )
catch( final GridAccessException ignored )
{
}
@@ -551,7 +551,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@Override
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, int side )
public boolean canInsertItem( final int slotIndex, final ItemStack insertingItem, final int side )
{
if( slotIndex == 1 )
{
@@ -568,11 +568,11 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
try
{
IMEInventory<IAEItemStack> cell = this.getHandler( StorageChannel.ITEMS );
IAEItemStack returns = cell.injectItems( AEApi.instance().storage().createItemStack( this.inv.getStackInSlot( 0 ) ), Actionable.SIMULATE, this.mySrc );
final IMEInventory<IAEItemStack> cell = this.getHandler( StorageChannel.ITEMS );
final IAEItemStack returns = cell.injectItems( AEApi.instance().storage().createItemStack( this.inv.getStackInSlot( 0 ) ), Actionable.SIMULATE, this.mySrc );
return returns == null || returns.getStackSize() != insertingItem.stackSize;
}
catch( ChestNoHandler ignored )
catch( final ChestNoHandler ignored )
{
}
}
@@ -580,13 +580,13 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@Override
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final int side )
{
return slotIndex == 1;
}
@Override
public int[] getAccessibleSlotsBySide( ForgeDirection side )
public int[] getAccessibleSlotsBySide( final ForgeDirection side )
{
if( ForgeDirection.SOUTH == side )
{
@@ -602,7 +602,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
return SIDES;
}
}
catch( ChestNoHandler e )
catch( final ChestNoHandler e )
{
// nope!
}
@@ -616,9 +616,9 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
if( this.getStackInSlot( 0 ) != null )
{
IMEInventory<IAEItemStack> cell = this.getHandler( StorageChannel.ITEMS );
final IMEInventory<IAEItemStack> cell = this.getHandler( StorageChannel.ITEMS );
IAEItemStack returns = Platform.poweredInsert( this, cell, AEApi.instance().storage().createItemStack( this.inv.getStackInSlot( 0 ) ), this.mySrc );
final IAEItemStack returns = Platform.poweredInsert( this, cell, AEApi.instance().storage().createItemStack( this.inv.getStackInSlot( 0 ) ), this.mySrc );
if( returns == null )
{
@@ -630,13 +630,13 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
}
}
catch( ChestNoHandler ignored )
catch( final ChestNoHandler ignored )
{
}
}
@Override
public List<IMEInventoryHandler> getCellArray( StorageChannel channel )
public List<IMEInventoryHandler> getCellArray( final StorageChannel channel )
{
if( this.gridProxy.isActive() )
{
@@ -644,7 +644,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
return Collections.singletonList( this.getHandler( channel ) );
}
catch( ChestNoHandler e )
catch( final ChestNoHandler e )
{
// :P
}
@@ -659,7 +659,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@Override
public void setPriority( int newValue )
public void setPriority( final int newValue )
{
this.priority = newValue;
@@ -671,16 +671,16 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// :P
}
}
@Override
public void blinkCell( int slot )
public void blinkCell( final int slot )
{
long now = this.worldObj.getTotalWorldTime();
final long now = this.worldObj.getTotalWorldTime();
if( now - this.lastStateChange > 8 )
{
this.state = 0;
@@ -693,18 +693,18 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@Override
public int fill( ForgeDirection from, FluidStack resource, boolean doFill )
public int fill( final ForgeDirection from, final FluidStack resource, final boolean doFill )
{
double req = resource.amount / 500.0;
double available = this.extractAEPower( req, Actionable.SIMULATE, PowerMultiplier.CONFIG );
final double req = resource.amount / 500.0;
final double available = this.extractAEPower( req, Actionable.SIMULATE, PowerMultiplier.CONFIG );
if( available >= req - 0.01 )
{
try
{
IMEInventoryHandler h = this.getHandler( StorageChannel.FLUIDS );
final IMEInventoryHandler h = this.getHandler( StorageChannel.FLUIDS );
this.extractAEPower( req, Actionable.MODULATE, PowerMultiplier.CONFIG );
IAEStack results = h.injectItems( AEFluidStack.create( resource ), doFill ? Actionable.MODULATE : Actionable.SIMULATE, this.mySrc );
final IAEStack results = h.injectItems( AEFluidStack.create( resource ), doFill ? Actionable.MODULATE : Actionable.SIMULATE, this.mySrc );
if( results == null )
{
@@ -713,7 +713,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
return resource.amount - (int) results.getStackSize();
}
catch( ChestNoHandler ignored )
catch( final ChestNoHandler ignored )
{
}
}
@@ -721,49 +721,49 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@Override
public FluidStack drain( ForgeDirection from, FluidStack resource, boolean doDrain )
public FluidStack drain( final ForgeDirection from, final FluidStack resource, final boolean doDrain )
{
return null;
}
@Override
public FluidStack drain( ForgeDirection from, int maxDrain, boolean doDrain )
public FluidStack drain( final ForgeDirection from, final int maxDrain, final boolean doDrain )
{
return null;
}
@Override
public boolean canFill( ForgeDirection from, Fluid fluid )
public boolean canFill( final ForgeDirection from, final Fluid fluid )
{
try
{
IMEInventoryHandler h = this.getHandler( StorageChannel.FLUIDS );
final IMEInventoryHandler h = this.getHandler( StorageChannel.FLUIDS );
return h.canAccept( AEFluidStack.create( new FluidStack( fluid, 1 ) ) );
}
catch( ChestNoHandler ignored )
catch( final ChestNoHandler ignored )
{
}
return false;
}
@Override
public boolean canDrain( ForgeDirection from, Fluid fluid )
public boolean canDrain( final ForgeDirection from, final Fluid fluid )
{
return false;
}
@Override
public FluidTankInfo[] getTankInfo( ForgeDirection from )
public FluidTankInfo[] getTankInfo( final ForgeDirection from )
{
try
{
IMEInventoryHandler h = this.getHandler( StorageChannel.FLUIDS );
final IMEInventoryHandler h = this.getHandler( StorageChannel.FLUIDS );
if( h.getChannel() == StorageChannel.FLUIDS )
{
return new FluidTankInfo[] { new FluidTankInfo( null, 1 ) }; // eh?
}
}
catch( ChestNoHandler ignored )
catch( final ChestNoHandler ignored )
{
}
@@ -771,7 +771,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@Override
public IStorageMonitorable getMonitorable( ForgeDirection side, BaseActionSource src )
public IStorageMonitorable getMonitorable( final ForgeDirection side, final BaseActionSource src )
{
if( Platform.canAccess( this.gridProxy, src ) && side != this.getForward() )
{
@@ -796,37 +796,37 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@Override
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
{
}
public boolean openGui( EntityPlayer p, ICellHandler ch, ItemStack cell, int side )
public boolean openGui( final EntityPlayer p, final ICellHandler ch, final ItemStack cell, final int side )
{
try
{
IMEInventoryHandler invHandler = this.getHandler( StorageChannel.ITEMS );
final IMEInventoryHandler invHandler = this.getHandler( StorageChannel.ITEMS );
if( ch != null && invHandler != null )
{
ch.openChestGui( p, this, ch, invHandler, cell, StorageChannel.ITEMS );
return true;
}
}
catch( ChestNoHandler e )
catch( final ChestNoHandler e )
{
// :P
}
try
{
IMEInventoryHandler invHandler = this.getHandler( StorageChannel.FLUIDS );
final IMEInventoryHandler invHandler = this.getHandler( StorageChannel.FLUIDS );
if( ch != null && invHandler != null )
{
ch.openChestGui( p, this, ch, invHandler, cell, StorageChannel.FLUIDS );
return true;
}
}
catch( ChestNoHandler e )
catch( final ChestNoHandler e )
{
// :P
}
@@ -841,7 +841,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@Override
public boolean recolourBlock( ForgeDirection side, AEColor newPaintedColor, EntityPlayer who )
public boolean recolourBlock( final ForgeDirection side, final AEColor newPaintedColor, final EntityPlayer who )
{
if( this.paintedColor == newPaintedColor )
{
@@ -855,7 +855,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@Override
public void saveChanges( IMEInventory cellInventory )
public void saveChanges( final IMEInventory cellInventory )
{
this.worldObj.markTileEntityChunkModified( this.xCoord, this.yCoord, this.zCoord, this );
}
@@ -870,13 +870,13 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
final StorageChannel chan;
public ChestNetNotifier( StorageChannel chan )
public ChestNetNotifier( final StorageChannel chan )
{
this.chan = chan;
}
@Override
public boolean isValid( Object verificationToken )
public boolean isValid( final Object verificationToken )
{
if( this.chan == StorageChannel.ITEMS )
{
@@ -890,7 +890,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@Override
public void postChange( IBaseMonitor<T> monitor, Iterable<T> change, BaseActionSource source )
public void postChange( final IBaseMonitor<T> monitor, final Iterable<T> change, final BaseActionSource source )
{
if( source == TileChest.this.mySrc || ( source instanceof PlayerSource && ( (PlayerSource) source ).via == TileChest.this ) )
{
@@ -901,7 +901,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
TileChest.this.gridProxy.getStorage().postAlterationOfStoredItems( this.chan, change, TileChest.this.mySrc );
}
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// :(
}
@@ -920,14 +920,14 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
class ChestMonitorHandler<T extends IAEStack> extends MEMonitorHandler<T>
{
public ChestMonitorHandler( IMEInventoryHandler<T> t )
public ChestMonitorHandler( final IMEInventoryHandler<T> t )
{
super( t );
}
public IMEInventoryHandler<T> getInternalHandler()
{
IMEInventoryHandler<T> h = this.getHandler();
final IMEInventoryHandler<T> h = this.getHandler();
if( h instanceof MEInventoryHandler )
{
return (IMEInventoryHandler<T>) ( (MEInventoryHandler) h ).getInternal();
@@ -936,7 +936,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@Override
public T injectItems( T input, Actionable mode, BaseActionSource src )
public T injectItems( final T input, final Actionable mode, final BaseActionSource src )
{
if( src.isPlayer() && !this.securityCheck( ( (PlayerSource) src ).player, SecurityPermissions.INJECT ) )
{
@@ -945,28 +945,27 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
return super.injectItems( input, mode, src );
}
private boolean securityCheck( EntityPlayer player, SecurityPermissions requiredPermission )
private boolean securityCheck( final EntityPlayer player, final SecurityPermissions requiredPermission )
{
if( TileChest.this.getTile() instanceof IActionHost && requiredPermission != null )
{
IGridNode gn = ( (IActionHost) TileChest.this.getTile() ).getActionableNode();
final IGridNode gn = ( (IActionHost) TileChest.this.getTile() ).getActionableNode();
if( gn != null )
{
IGrid g = gn.getGrid();
final IGrid g = gn.getGrid();
if( g != null )
{
boolean requirePower = false;
final boolean requirePower = false;
if( requirePower )
{
IEnergyGrid eg = g.getCache( IEnergyGrid.class );
final IEnergyGrid eg = g.getCache( IEnergyGrid.class );
if( !eg.isNetworkPowered() )
{
return false;
}
}
ISecurityGrid sg = g.getCache( ISecurityGrid.class );
final ISecurityGrid sg = g.getCache( ISecurityGrid.class );
if( sg.hasPermission( player, requiredPermission ) )
{
return true;
@@ -980,7 +979,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@Override
public T extractItems( T request, Actionable mode, BaseActionSource src )
public T extractItems( final T request, final Actionable mode, final BaseActionSource src )
{
if( src.isPlayer() && !this.securityCheck( ( (PlayerSource) src ).player, SecurityPermissions.EXTRACT ) )
{
@@ -82,7 +82,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
}
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileDrive( ByteBuf data )
public void writeToStream_TileDrive( final ByteBuf data )
{
if( this.worldObj.getTotalWorldTime() - this.lastStateChange > 8 )
{
@@ -117,17 +117,17 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
}
@Override
public int getCellStatus( int slot )
public int getCellStatus( final int slot )
{
if( Platform.isClient() )
{
return ( this.state >> ( slot * 3 ) ) & 3;
}
ItemStack cell = this.inv.getStackInSlot( 2 );
ICellHandler ch = this.handlersBySlot[slot];
final ItemStack cell = this.inv.getStackInSlot( 2 );
final ICellHandler ch = this.handlersBySlot[slot];
MEInventoryHandler handler = this.invBySlot[slot];
final MEInventoryHandler handler = this.invBySlot[slot];
if( handler == null )
{
return 0;
@@ -164,9 +164,9 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
}
@Override
public boolean isCellBlinking( int slot )
public boolean isCellBlinking( final int slot )
{
long now = this.worldObj.getTotalWorldTime();
final long now = this.worldObj.getTotalWorldTime();
if( now - this.lastStateChange > 8 )
{
return false;
@@ -176,37 +176,36 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
}
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileDrive( ByteBuf data )
public boolean readFromStream_TileDrive( final ByteBuf data )
{
int oldState = this.state;
final 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 )
public void readFromNBT_TileDrive( final NBTTagCompound data )
{
this.isCached = false;
this.priority = data.getInteger( "priority" );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileDrive( NBTTagCompound data )
public void writeToNBT_TileDrive( final NBTTagCompound data )
{
data.setInteger( "priority", this.priority );
}
@MENetworkEventSubscribe
public void powerRender( MENetworkPowerStatusChange c )
public void powerRender( final MENetworkPowerStatusChange c )
{
this.recalculateDisplay();
}
private void recalculateDisplay()
{
boolean currentActive = this.gridProxy.isActive();
final boolean currentActive = this.gridProxy.isActive();
if( currentActive )
{
this.state |= 0x80000000;
@@ -223,7 +222,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// :P
}
@@ -234,7 +233,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
this.state |= ( this.getCellStatus( x ) << ( 3 * x ) );
}
int oldState = 0;
final int oldState = 0;
if( oldState != this.state )
{
this.markForUpdate();
@@ -242,13 +241,13 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
}
@MENetworkEventSubscribe
public void channelRender( MENetworkChannelsChanged c )
public void channelRender( final MENetworkChannelsChanged c )
{
this.recalculateDisplay();
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( final ForgeDirection dir )
{
return AECableType.SMART;
}
@@ -266,13 +265,13 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return itemstack != null && AEApi.instance().registries().cell().isCellHandled( 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 )
{
if( this.isCached )
{
@@ -284,10 +283,10 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
IStorageGrid gs = this.gridProxy.getStorage();
final IStorageGrid gs = this.gridProxy.getStorage();
Platform.postChanges( gs, removed, added, this.mySrc );
}
catch( GridAccessException ignored )
catch( final GridAccessException ignored )
{
}
@@ -295,7 +294,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
}
@Override
public int[] getAccessibleSlotsBySide( ForgeDirection side )
public int[] getAccessibleSlotsBySide( final ForgeDirection side )
{
return this.sides;
}
@@ -311,7 +310,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
for( int x = 0; x < this.inv.getSizeInventory(); x++ )
{
ItemStack is = this.inv.getStackInSlot( x );
final ItemStack is = this.inv.getStackInSlot( x );
this.invBySlot[x] = null;
this.handlersBySlot[x] = null;
@@ -327,7 +326,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
{
power += this.handlersBySlot[x].cellIdleDrain( is, cell );
DriveWatcher<IAEItemStack> ih = new DriveWatcher( cell, is, this.handlersBySlot[x], this );
final DriveWatcher<IAEItemStack> ih = new DriveWatcher( cell, is, this.handlersBySlot[x], this );
ih.setPriority( this.priority );
this.invBySlot[x] = ih;
this.items.add( ih );
@@ -340,7 +339,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
{
power += this.handlersBySlot[x].cellIdleDrain( is, cell );
DriveWatcher<IAEItemStack> ih = new DriveWatcher( cell, is, this.handlersBySlot[x], this );
final DriveWatcher<IAEItemStack> ih = new DriveWatcher( cell, is, this.handlersBySlot[x], this );
ih.setPriority( this.priority );
this.invBySlot[x] = ih;
this.fluids.add( ih );
@@ -364,7 +363,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
}
@Override
public List<IMEInventoryHandler> getCellArray( StorageChannel channel )
public List<IMEInventoryHandler> getCellArray( final StorageChannel channel )
{
if( this.gridProxy.isActive() )
{
@@ -381,7 +380,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
}
@Override
public void setPriority( int newValue )
public void setPriority( final int newValue )
{
this.priority = newValue;
this.markDirty();
@@ -393,16 +392,16 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// :P
}
}
@Override
public void blinkCell( int slot )
public void blinkCell( final int slot )
{
long now = this.worldObj.getTotalWorldTime();
final long now = this.worldObj.getTotalWorldTime();
if( now - this.lastStateChange > 8 )
{
this.state = 0;
@@ -415,7 +414,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
}
@Override
public void saveChanges( IMEInventory cellInventory )
public void saveChanges( final IMEInventory cellInventory )
{
this.worldObj.markTileEntityChunkModified( this.xCoord, this.yCoord, this.zCoord, this );
}
@@ -120,7 +120,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileIOPort( NBTTagCompound data )
public void writeToNBT_TileIOPort( final NBTTagCompound data )
{
this.manager.writeToNBT( data );
this.cells.writeToNBT( data, "cells" );
@@ -129,7 +129,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileIOPort( NBTTagCompound data )
public void readFromNBT_TileIOPort( final NBTTagCompound data )
{
this.manager.readFromNBT( data );
this.cells.readFromNBT( data, "cells" );
@@ -141,7 +141,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( final ForgeDirection dir )
{
return AECableType.SMART;
}
@@ -165,7 +165,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
}
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// :P
}
@@ -173,7 +173,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
public void updateRedstoneState()
{
YesNo currentState = this.worldObj.isBlockIndirectlyGettingPowered( this.xCoord, this.yCoord, this.zCoord ) ? YesNo.YES : YesNo.NO;
final YesNo currentState = this.worldObj.isBlockIndirectlyGettingPowered( this.xCoord, this.yCoord, this.zCoord ) ? YesNo.YES : YesNo.NO;
if( this.lastRedstoneState != currentState )
{
this.lastRedstoneState = currentState;
@@ -198,7 +198,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
return true;
}
RedstoneMode rs = (RedstoneMode) this.manager.getSetting( Settings.REDSTONE_CONTROLLED );
final RedstoneMode rs = (RedstoneMode) this.manager.getSetting( Settings.REDSTONE_CONTROLLED );
if( rs == RedstoneMode.HIGH_SIGNAL )
{
return this.getRedstoneState();
@@ -213,7 +213,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
@Override
public IInventory getInventoryByName( String name )
public IInventory getInventoryByName( final String name )
{
if( name.equals( "upgrades" ) )
{
@@ -229,7 +229,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
@Override
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
{
this.updateTask();
}
@@ -257,7 +257,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
@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 )
{
if( this.cells == inv )
{
@@ -266,9 +266,9 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
@Override
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, int side )
public boolean canInsertItem( final int slotIndex, final ItemStack insertingItem, final int side )
{
for( int inputSlotIndex : this.input )
for( final int inputSlotIndex : this.input )
{
if( inputSlotIndex == slotIndex )
{
@@ -280,9 +280,9 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
@Override
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final int side )
{
for( int outputSlotIndex : this.output )
for( final int outputSlotIndex : this.output )
{
if( outputSlotIndex == slotIndex )
{
@@ -294,7 +294,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
@Override
public int[] getAccessibleSlotsBySide( ForgeDirection d )
public int[] getAccessibleSlotsBySide( final ForgeDirection d )
{
if( d == ForgeDirection.UP || d == ForgeDirection.DOWN )
{
@@ -305,13 +305,13 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
@Override
public TickingRequest getTickingRequest( IGridNode node )
public TickingRequest getTickingRequest( final IGridNode node )
{
return new TickingRequest( TickRates.IOPort.min, TickRates.IOPort.max, this.hasWork(), false );
}
@Override
public TickRateModulation tickingRequest( IGridNode node, int ticksSinceLastCall )
public TickRateModulation tickingRequest( final IGridNode node, final int ticksSinceLastCall )
{
if( !this.gridProxy.isActive() )
{
@@ -335,18 +335,18 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
try
{
IMEInventory<IAEItemStack> itemNet = this.gridProxy.getStorage().getItemInventory();
IMEInventory<IAEFluidStack> fluidNet = this.gridProxy.getStorage().getFluidInventory();
IEnergySource energy = this.gridProxy.getEnergy();
final IMEInventory<IAEItemStack> itemNet = this.gridProxy.getStorage().getItemInventory();
final IMEInventory<IAEFluidStack> fluidNet = this.gridProxy.getStorage().getFluidInventory();
final IEnergySource energy = this.gridProxy.getEnergy();
for( int x = 0; x < 6; x++ )
{
ItemStack is = this.cells.getStackInSlot( x );
final ItemStack is = this.cells.getStackInSlot( x );
if( is != null )
{
if( ItemsToMove > 0 )
{
IMEInventory<IAEItemStack> itemInv = this.getInv( is, StorageChannel.ITEMS );
IMEInventory<IAEFluidStack> fluidInv = this.getInv( is, StorageChannel.FLUIDS );
final IMEInventory<IAEItemStack> itemInv = this.getInv( is, StorageChannel.ITEMS );
final IMEInventory<IAEFluidStack> fluidInv = this.getInv( is, StorageChannel.FLUIDS );
if( this.manager.getSetting( Settings.OPERATION_MODE ) == OperationMode.EMPTY )
{
@@ -385,7 +385,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
}
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
return TickRateModulation.IDLE;
}
@@ -395,12 +395,12 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
@Override
public int getInstalledUpgrades( Upgrades u )
public int getInstalledUpgrades( final Upgrades u )
{
return this.upgrades.getInstalledUpgrades( u );
}
private IMEInventory getInv( ItemStack is, StorageChannel chan )
private IMEInventory getInv( final ItemStack is, final StorageChannel chan )
{
if( this.currentCell != is )
{
@@ -417,9 +417,9 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
return this.cachedFluid;
}
private long transferContents( IEnergySource energy, IMEInventory src, IMEInventory destination, long itemsToMove, StorageChannel chan )
private long transferContents( final IEnergySource energy, final IMEInventory src, final IMEInventory destination, long itemsToMove, final StorageChannel chan )
{
IItemList<? extends IAEStack> myList;
final IItemList<? extends IAEStack> myList;
if( src instanceof IMEMonitor )
{
myList = ( (IMEMonitor) src ).getStorageList();
@@ -435,12 +435,12 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
{
didStuff = false;
for( IAEStack s : myList )
for( final IAEStack s : myList )
{
long totalStackSize = s.getStackSize();
final long totalStackSize = s.getStackSize();
if( totalStackSize > 0 )
{
IAEStack stack = destination.injectItems( s, Actionable.SIMULATE, this.mySrc );
final IAEStack stack = destination.injectItems( s, Actionable.SIMULATE, this.mySrc );
long possible = 0;
if( stack == null )
@@ -457,11 +457,11 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
possible = Math.min( possible, itemsToMove );
s.setStackSize( possible );
IAEStack extracted = src.extractItems( s, Actionable.MODULATE, this.mySrc );
final IAEStack extracted = src.extractItems( s, Actionable.MODULATE, this.mySrc );
if( extracted != null )
{
possible = extracted.getStackSize();
IAEStack failed = Platform.poweredInsert( energy, destination, extracted, this.mySrc );
final IAEStack failed = Platform.poweredInsert( energy, destination, extracted, this.mySrc );
if( failed != null )
{
@@ -486,9 +486,9 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
return itemsToMove;
}
private boolean shouldMove( IMEInventory<IAEItemStack> itemInv, IMEInventory<IAEFluidStack> fluidInv )
private boolean shouldMove( final IMEInventory<IAEItemStack> itemInv, final IMEInventory<IAEFluidStack> fluidInv )
{
FullnessMode fm = (FullnessMode) this.manager.getSetting( Settings.FULLNESS_MODE );
final FullnessMode fm = (FullnessMode) this.manager.getSetting( Settings.FULLNESS_MODE );
if( itemInv != null && fluidInv != null )
{
@@ -506,10 +506,10 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
return true;
}
private boolean moveSlot( int x )
private boolean moveSlot( final int x )
{
WrapperInventoryRange wir = new WrapperInventoryRange( this, this.output, true );
ItemStack result = InventoryAdaptor.getAdaptor( wir, ForgeDirection.UNKNOWN ).addItems( this.getStackInSlot( x ) );
final WrapperInventoryRange wir = new WrapperInventoryRange( this, this.output, true );
final ItemStack result = InventoryAdaptor.getAdaptor( wir, ForgeDirection.UNKNOWN ).addItems( this.getStackInSlot( x ) );
if( result == null )
{
@@ -520,14 +520,14 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
return false;
}
private boolean matches( FullnessMode fm, IMEInventory src )
private boolean matches( final FullnessMode fm, final IMEInventory src )
{
if( fm == FullnessMode.HALF )
{
return true;
}
IItemList<? extends IAEStack> myList;
final IItemList<? extends IAEStack> myList;
if( src instanceof IMEMonitor )
{
@@ -543,7 +543,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
return myList.isEmpty();
}
IAEStack test = myList.getFirstItem();
final IAEStack test = myList.getFirstItem();
if( test != null )
{
test.setStackSize( 1 );
@@ -562,13 +562,13 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
* @param drops drops of tile entity
*/
@Override
public void getDrops( World w, int x, int y, int z, List<ItemStack> drops )
public void getDrops( final World w, final int x, final int y, final int z, final List<ItemStack> drops )
{
super.getDrops( w, x, y, z, drops );
for( int upgradeIndex = 0; upgradeIndex < this.upgrades.getSizeInventory(); upgradeIndex++ )
{
ItemStack stackInSlot = this.upgrades.getStackInSlot( upgradeIndex );
final ItemStack stackInSlot = this.upgrades.getStackInSlot( upgradeIndex );
if( stackInSlot != null )
{
@@ -45,15 +45,15 @@ public class TileSkyChest extends AEBaseInvTile
public float lidAngle;
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileSkyChest( ByteBuf data )
public void writeToStream_TileSkyChest( final ByteBuf data )
{
data.writeBoolean( this.playerOpen > 0 );
}
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileSkyChest( ByteBuf data )
public boolean readFromStream_TileSkyChest( final ByteBuf data )
{
int wasOpen = this.playerOpen;
final int wasOpen = this.playerOpen;
this.playerOpen = data.readBoolean() ? 1 : 0;
if( wasOpen != this.playerOpen )
@@ -116,13 +116,13 @@ public class TileSkyChest extends AEBaseInvTile
}
@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 int[] getAccessibleSlotsBySide( ForgeDirection side )
public int[] getAccessibleSlotsBySide( final ForgeDirection side )
{
return this.sides;
}