final variables and parameters

This commit is contained in:
thatsIch
2015-09-30 14:24:40 +02:00
parent 059523f543
commit 8b3a954f73
732 changed files with 9253 additions and 9256 deletions
+23 -23
View File
@@ -47,13 +47,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 ) );
}
}
@@ -61,14 +61,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 );
@@ -85,25 +85,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 );
}
@@ -124,7 +124,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;
@@ -132,7 +132,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
}
@Override
public void openInventory( EntityPlayer player )
public void openInventory( final EntityPlayer player )
{
}
@@ -140,13 +140,13 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
;
@Override
public void closeInventory( EntityPlayer player )
public void closeInventory( final EntityPlayer player )
{
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return true;
}
@@ -155,9 +155,9 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
public abstract void onChangeInventory( IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added );
@Override
public int[] getSlotsForFace( EnumFacing side )
public int[] getSlotsForFace( final EnumFacing side )
{
Block blk = this.worldObj.getBlockState( pos ).getBlock();
final Block blk = this.worldObj.getBlockState( pos ).getBlock();
if( blk instanceof AEBaseBlock )
{
return this.getAccessibleSlotsBySide( ( (AEBaseBlock) blk ).mapRotation( this, side ) );
@@ -166,13 +166,13 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
}
@Override
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, EnumFacing side )
public boolean canInsertItem( final int slotIndex, final ItemStack insertingItem, final EnumFacing side )
{
return this.isItemValidForSlot( slotIndex, insertingItem );
}
@Override
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, EnumFacing side )
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final EnumFacing side )
{
return true;
}
@@ -184,13 +184,13 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
}
@Override
public int getField( int id )
public int getField( final int id )
{
return 0;
}
@Override
public void setField( int id, int value )
public void setField( final int id, final int value )
{
}
+55 -55
View File
@@ -76,22 +76,22 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
@Override
public boolean shouldRefresh(
World world,
BlockPos pos,
IBlockState oldState,
IBlockState newSate )
final World world,
final BlockPos pos,
final IBlockState oldState,
final IBlockState newSate )
{
return newSate.getBlock() != oldState.getBlock(); // state dosn't change tile entities in AE2.
}
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;
}
@@ -107,9 +107,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;
@@ -130,7 +130,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 );
@@ -151,11 +151,11 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
this.up = EnumFacing.valueOf( data.getString( "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 );
}
@@ -163,7 +163,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 );
@@ -178,7 +178,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 );
}
@@ -186,7 +186,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
public final void update()
{
for( AETileEventHandler h : this.getHandlerListFor( TileEventType.TICK ) )
for( final AETileEventHandler h : this.getHandlerListFor( TileEventType.TICK ) )
{
h.tick( this );
}
@@ -195,9 +195,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
{
@@ -207,7 +207,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
return null;
}
}
catch( Throwable t )
catch( final Throwable t )
{
AELog.error( t );
}
@@ -217,20 +217,20 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
return new S35PacketUpdateTileEntity( pos, 64, data );
}
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.getTileEntityType() == 64 )
{
ByteBuf stream = Unpooled.copiedBuffer( pkt.getNbtCompound().getByteArray( "X" ) );
final ByteBuf stream = Unpooled.copiedBuffer( pkt.getNbtCompound().getByteArray( "X" ) );
if( this.readFromStream( stream ) )
{
this.markForUpdate();
@@ -247,7 +247,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;
@@ -256,10 +256,10 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
if( this.canBeRotated() )
{
EnumFacing old_Forward = this.forward;
EnumFacing old_Up = this.up;
final EnumFacing old_Forward = this.forward;
final EnumFacing old_Up = this.up;
byte orientation = data.readByte();
final byte orientation = data.readByte();
this.forward = EnumFacing.VALUES[ orientation & 0x7 ];
this.up = EnumFacing.VALUES[ orientation >> 3 ];
@@ -267,7 +267,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 ) )
{
@@ -281,7 +281,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
this.renderFragment = 0;
}
catch( Throwable t )
catch( final Throwable t )
{
AELog.error( t );
}
@@ -306,22 +306,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 );
}
@@ -339,7 +339,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 );
@@ -359,9 +359,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 );
@@ -377,7 +377,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 );
if( oldHandlers == null )
@@ -393,7 +393,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 );
@@ -419,7 +419,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
@Override
public void setOrientation( EnumFacing inForward, EnumFacing inUp )
public void setOrientation( final EnumFacing inForward, final EnumFacing inUp )
{
this.forward = inForward;
this.up = inUp;
@@ -427,7 +427,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
Platform.notifyBlocksOfNeighbors( this.worldObj, pos );
}
public void onPlacement( ItemStack stack, EntityPlayer player, EnumFacing side )
public void onPlacement( final ItemStack stack, final EntityPlayer player, final EnumFacing side )
{
if( stack.hasTagCompound() )
{
@@ -441,11 +441,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 );
@@ -454,17 +454,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++ )
{
@@ -484,15 +484,15 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
* @param drops drops of tile entity
*/
@Override
public void getDrops( World w, BlockPos pos, List<ItemStack> drops )
public void getDrops( final World w, final BlockPos pos, 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 );
@@ -501,7 +501,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
}
public void getNoDrops( World w, BlockPos pos, List<ItemStack> drops )
public void getNoDrops( final World w, final BlockPos pos, final List<ItemStack> drops )
{
}
@@ -518,20 +518,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 );
@@ -540,13 +540,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" );
@@ -589,7 +589,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;
}
@@ -49,12 +49,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 )
{
@@ -70,7 +70,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() );
@@ -86,7 +86,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" ) )
{
@@ -95,7 +95,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() );
}
@@ -112,7 +112,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 ) )
{
@@ -147,7 +147,7 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
}
@Override
public boolean recolourBlock( EnumFacing side, AEColor newPaintedColor, EntityPlayer who )
public boolean recolourBlock( final EnumFacing 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;
}
@@ -80,7 +80,7 @@ public class TileCraftingStorageTile extends TileCraftingTile
return 0;
}
BlockCraftingUnit unit = (BlockCraftingUnit)this.worldObj.getBlockState( pos ).getBlock();
final BlockCraftingUnit unit = (BlockCraftingUnit)this.worldObj.getBlockState( pos ).getBlock();
switch( unit.type )
{
default:
@@ -77,11 +77,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;
}
@@ -98,7 +98,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 )
@@ -114,7 +114,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
return false;
}
BlockCraftingUnit unit = (BlockCraftingUnit)this.worldObj.getBlockState( pos ).getBlock();
final BlockCraftingUnit unit = (BlockCraftingUnit)this.worldObj.getBlockState( pos ).getBlock();
return unit.type == CraftingUnitType.ACCELERATOR;
}
@@ -131,7 +131,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 )
{
@@ -142,14 +142,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() )
@@ -157,8 +157,8 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
power = this.gridProxy.isActive();
}
IBlockState current = this.worldObj.getBlockState( pos );
IBlockState newState = current.withProperty( BlockCraftingUnit.POWERED, power ).withProperty( BlockCraftingUnit.FORMED, formed );
final IBlockState current = this.worldObj.getBlockState( pos );
final IBlockState newState = current.withProperty( BlockCraftingUnit.POWERED, power ).withProperty( BlockCraftingUnit.FORMED, formed );
if( current != newState )
{
@@ -188,7 +188,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 )
@@ -198,7 +198,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 )
@@ -215,7 +215,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 )
{
@@ -240,13 +240,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 );
}
@@ -271,25 +271,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( AEPartLocation d : AEPartLocation.SIDE_LOCATIONS )
for( final AEPartLocation d : AEPartLocation.SIDE_LOCATIONS )
{
WorldCoord wc = new WorldCoord( te );
final WorldCoord wc = new WorldCoord( te );
wc.add( d, 1 );
if( this.worldObj.isAirBlock( wc.getPos() ) )
{
@@ -312,13 +312,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.getPos(), Collections.singletonList( g.getItemStack() ) );
@@ -111,7 +111,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
@Override
public boolean pushPattern( ICraftingPatternDetails patternDetails, InventoryCrafting table, EnumFacing where )
public boolean pushPattern( final ICraftingPatternDetails patternDetails, final InventoryCrafting table, final EnumFacing where )
{
if( this.myPattern == null )
{
@@ -142,7 +142,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 )
{
@@ -157,7 +157,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
}
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// :P
}
@@ -191,34 +191,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() );
@@ -231,17 +231,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.getWorld();
ItemEncodedPattern iep = (ItemEncodedPattern) myPat.getItem();
ICraftingPatternDetails ph = iep.getPatternForItem( myPat, w );
final World w = this.getWorld();
final ItemEncodedPattern iep = (ItemEncodedPattern) myPat.getItem();
final ICraftingPatternDetails ph = iep.getPatternForItem( myPat, w );
if( ph != null && ph.isCraftable() )
{
this.forcePlan = true;
@@ -266,15 +266,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.getWorld();
ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
ICraftingPatternDetails ph = iep.getPatternForItem( is, w );
final World w = this.getWorld();
final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
final ICraftingPatternDetails ph = iep.getPatternForItem( is, w );
if( ph != null && ph.isCraftable() )
{
@@ -297,7 +297,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
@Override
public AECableType getCableConnectionType( AEPartLocation dir )
public AECableType getCableConnectionType( final AEPartLocation dir )
{
return AECableType.COVERED;
}
@@ -315,7 +315,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
@Override
public IInventory getInventoryByName( String name )
public IInventory getInventoryByName( final String name )
{
if( name.equals( "upgrades" ) )
{
@@ -331,7 +331,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 )
{
}
@@ -349,7 +349,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 )
{
@@ -370,7 +370,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 )
{
@@ -379,13 +379,13 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
@Override
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, EnumFacing side )
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final EnumFacing side )
{
return slotIndex == 9;
}
@Override
public int[] getAccessibleSlotsBySide( EnumFacing whichSide )
public int[] getAccessibleSlotsBySide( final EnumFacing whichSide )
{
return SIDES;
}
@@ -397,15 +397,15 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
@Override
public void getDrops(
World w,
BlockPos pos,
List<ItemStack> drops )
final World w,
final BlockPos pos,
final List<ItemStack> drops )
{
super.getDrops( w, pos, 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 );
@@ -414,7 +414,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
@Override
public TickingRequest getTickingRequest( IGridNode node )
public TickingRequest getTickingRequest( final IGridNode node )
{
this.recalculatePlan();
this.updateSleepiness();
@@ -422,7 +422,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 )
{
@@ -488,7 +488,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
this.progress = 0;
ItemStack output = this.myPlan.getOutput( this.craftingInv, this.getWorld() );
final ItemStack output = this.myPlan.getOutput( this.craftingInv, this.getWorld() );
if( output != null )
{
FMLCommonHandler.instance().firePlayerCraftingEvent( Platform.getPlayer( (WorldServer) this.getWorld() ), output, this.craftingInv );
@@ -511,11 +511,11 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
try
{
TargetPoint where = new TargetPoint( this.worldObj.provider.getDimensionId(), pos.getX(), pos.getY(), pos.getZ(), 32 );
IAEItemStack item = AEItemStack.create( output );
final TargetPoint where = new TargetPoint( this.worldObj.provider.getDimensionId(), pos.getX(), pos.getY(), pos.getZ(), 32 );
final IAEItemStack item = AEItemStack.create( output );
NetworkHandler.instance.sendToAllAround( new PacketAssemblerAnimation( pos, (byte) speed, item ), where );
}
catch( IOException e )
catch( final IOException e )
{
// ;P
}
@@ -535,7 +535,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 ) )
@@ -550,13 +550,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;
}
@@ -566,7 +566,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
if( this.pushDirection == AEPartLocation.INTERNAL )
{
for( EnumFacing d : EnumFacing.VALUES )
for( final EnumFacing d : EnumFacing.VALUES )
{
output = this.pushTo( output, d );
}
@@ -585,30 +585,30 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
this.inv.setInventorySlotContents( 9, output );
}
private ItemStack pushTo( ItemStack output, EnumFacing d )
private ItemStack pushTo( ItemStack output, final EnumFacing d )
{
if( output == null )
{
return output;
}
TileEntity te = this.getWorld().getTileEntity( pos.offset( d ) );
final TileEntity te = this.getWorld().getTileEntity( pos.offset( d ) );
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 )
{
@@ -619,7 +619,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
@MENetworkEventSubscribe
public void onPowerEvent( MENetworkPowerStatusChange p )
public void onPowerEvent( final MENetworkPowerStatusChange p )
{
this.updatePowerState();
}
@@ -632,7 +632,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 )
{
}
@@ -35,90 +35,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 );
}
@@ -134,21 +134,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 );
}
@@ -36,13 +36,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 );
}
@@ -60,7 +60,7 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH
}
@Override
public IGridNode getGridNode( AEPartLocation dir )
public IGridNode getGridNode( final AEPartLocation dir )
{
return this.gridProxy.getNode();
}
@@ -101,7 +101,7 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH
@Override
public int getField(
int id )
final int id )
{
return 0;
}
@@ -38,13 +38,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 );
}
@@ -68,13 +68,13 @@ public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IA
}
@Override
public IGridNode getGridNode( AEPartLocation dir )
public IGridNode getGridNode( final AEPartLocation dir )
{
return this.gridProxy.getNode();
}
@Override
public AECableType getCableConnectionType( AEPartLocation dir )
public AECableType getCableConnectionType( final AEPartLocation dir )
{
return AECableType.SMART;
}
@@ -38,13 +38,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 );
}
@@ -55,13 +55,13 @@ public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxy
}
@Override
public IGridNode getGridNode( AEPartLocation dir )
public IGridNode getGridNode( final AEPartLocation dir )
{
return this.gridProxy.getNode();
}
@Override
public AECableType getCableConnectionType( AEPartLocation dir )
public AECableType getCableConnectionType( final AEPartLocation dir )
{
return AECableType.SMART;
}
@@ -62,7 +62,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, IUpdatePl
if( this.charge >= this.ticksPerRotation )
{
this.charge -= this.ticksPerRotation;
ICrankable g = this.getGrinder();
final ICrankable g = this.getGrinder();
if( g != null )
{
g.applyTurn();
@@ -80,8 +80,8 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, IUpdatePl
return null;
}
EnumFacing grinder = this.getUp().getOpposite();
TileEntity te = this.worldObj.getTileEntity( pos.offset( grinder ) );
final EnumFacing grinder = this.getUp().getOpposite();
final TileEntity te = this.worldObj.getTileEntity( pos.offset( grinder ) );
if( te instanceof ICrankable )
{
return (ICrankable) te;
@@ -90,23 +90,23 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, IUpdatePl
}
@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( EnumFacing inForward, EnumFacing inUp )
public void setOrientation( final EnumFacing inForward, final EnumFacing inUp )
{
super.setOrientation( inForward, inUp );
IBlockState state = this.worldObj.getBlockState( pos );
final IBlockState state = this.worldObj.getBlockState( pos );
this.getBlockType().onNeighborBlockChange( this.worldObj, pos, state, state.getBlock() );
}
@@ -128,7 +128,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, IUpdatePl
if( this.rotation < 3 )
{
ICrankable g = this.getGrinder();
final ICrankable g = this.getGrinder();
if( g != null )
{
if( g.canTurn() )
@@ -154,28 +154,28 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, IUpdatePl
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(
World w,
BlockPos pos,
Entity thePlayer,
boolean b )
final World w,
final BlockPos pos,
final Entity thePlayer,
final boolean b )
{
double xOff = -0.15 * this.getUp().getFrontOffsetX();
double yOff = -0.15 * this.getUp().getFrontOffsetY();
double zOff = -0.15 * this.getUp().getFrontOffsetZ();
final double xOff = -0.15 * this.getUp().getFrontOffsetX();
final double yOff = -0.15 * this.getUp().getFrontOffsetY();
final double zOff = -0.15 * this.getUp().getFrontOffsetZ();
return Collections.singletonList( AxisAlignedBB.fromBounds( xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85 ) );
}
@Override
public void addCollidingBlockToList(
World w,
BlockPos pos,
AxisAlignedBB bb,
List<AxisAlignedBB> out,
Entity e )
final World w,
final BlockPos pos,
final AxisAlignedBB bb,
final List<AxisAlignedBB> out,
final Entity e )
{
double xOff = -0.15 * this.getUp().getFrontOffsetX();
double yOff = -0.15 * this.getUp().getFrontOffsetY();
double zOff = -0.15 * this.getUp().getFrontOffsetZ();
final double xOff = -0.15 * this.getUp().getFrontOffsetX();
final double yOff = -0.15 * this.getUp().getFrontOffsetY();
final double zOff = -0.15 * this.getUp().getFrontOffsetZ();
out.add( AxisAlignedBB.fromBounds( xOff + 0.15, yOff + 0.15, zOff + 0.15,// ahh
xOff + 0.85, yOff + 0.85, zOff + 0.85 ) );
}
@@ -46,10 +46,10 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
int points;
@Override
public void setOrientation( EnumFacing inForward, EnumFacing inUp )
public void setOrientation( final EnumFacing inForward, final EnumFacing inUp )
{
super.setOrientation( inForward, inUp );
IBlockState state = worldObj.getBlockState( pos );
final IBlockState state = worldObj.getBlockState( pos );
this.getBlockType().onNeighborBlockChange( this.worldObj, pos, state, state.getBlock() );
}
@@ -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, EnumFacing side )
public boolean canInsertItem( final int slotIndex, final ItemStack insertingItem, final EnumFacing 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, EnumFacing side )
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final EnumFacing side )
{
return slotIndex >= 3 && slotIndex <= 5;
}
@Override
public int[] getAccessibleSlotsBySide( EnumFacing side )
public int[] getAccessibleSlotsBySide( final EnumFacing 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 ), EnumFacing.EAST );
final InventoryAdaptor sia = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this, 3, 3, true ), EnumFacing.EAST );
this.addItem( sia, r.getOutput() );
@@ -172,17 +172,17 @@ 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 )
{
List<ItemStack> out = new ArrayList<ItemStack>();
final List<ItemStack> out = new ArrayList<ItemStack>();
out.add( notAdded );
Platform.spawnDrops( this.worldObj, pos.offset( this.getForward() ), out );
@@ -190,7 +190,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
}
@Override
public boolean canCrankAttach( EnumFacing directionToCrank )
public boolean canCrankAttach( final EnumFacing 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,13 +245,13 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
}
@Override
public boolean isUseableByPlayer( EntityPlayer var1 )
public boolean isUseableByPlayer( final EntityPlayer var1 )
{
return true;
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return true;
}
@@ -275,29 +275,29 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
@Override
public void openInventory(
EntityPlayer player )
final EntityPlayer player )
{
}
@Override
public void closeInventory(
EntityPlayer player )
final EntityPlayer player )
{
}
@Override
public int getField(
int id )
final int id )
{
return 0;
}
@Override
public void setField(
int id,
int value )
final int id,
final int value )
{
}
@@ -41,7 +41,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;
@@ -73,17 +73,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 )
@@ -114,15 +114,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() )
@@ -184,24 +184,24 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
}
@Override
public boolean isUseableByPlayer( EntityPlayer var1 )
public boolean isUseableByPlayer( final EntityPlayer var1 )
{
return true;
}
@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() )
{
@@ -209,20 +209,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 )
{
@@ -231,35 +231,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 );
}
@@ -280,29 +280,29 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
@Override
public void openInventory(
EntityPlayer player )
final EntityPlayer player )
{
}
@Override
public void closeInventory(
EntityPlayer player )
final EntityPlayer player )
{
}
@Override
public int getField(
int id )
final int id )
{
return 0;
}
@Override
public void setField(
int id,
int value )
final int id,
final int value )
{
}
@@ -33,7 +33,7 @@ public class AppEngNullInventory implements IInventory
{
}
public void writeToNBT( NBTTagCompound target )
public void writeToNBT( final NBTTagCompound target )
{
}
@@ -44,25 +44,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 )
{
}
@@ -92,13 +92,13 @@ public class AppEngNullInventory implements IInventory
}
@Override
public boolean isUseableByPlayer( EntityPlayer var1 )
public boolean isUseableByPlayer( final EntityPlayer var1 )
{
return false;
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return false;
}
@@ -111,29 +111,29 @@ public class AppEngNullInventory implements IInventory
@Override
public void openInventory(
EntityPlayer player )
final EntityPlayer player )
{
}
@Override
public void closeInventory(
EntityPlayer player )
final EntityPlayer player )
{
}
@Override
public int getField(
int id )
final int id )
{
return 0;
}
@Override
public void setField(
int id,
int value )
final int id,
final int value )
{
}
@@ -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;
@@ -236,9 +236,9 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
@Override
public void getDrops(
World w,
BlockPos pos,
List<ItemStack> drops )
final World w,
final BlockPos pos,
final List<ItemStack> drops )
{
super.getDrops( w, pos, drops );
@@ -255,7 +255,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
@@ -72,21 +72,21 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda
}
@Override
public AECableType getCableConnectionType( AEPartLocation dir )
public AECableType getCableConnectionType( final AEPartLocation 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 );
}
@@ -94,9 +94,9 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda
}
@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 );
@@ -121,7 +121,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda
}
this.tickTickTimer = 0;
ItemStack myItem = this.getStackInSlot( 0 );
final ItemStack myItem = this.getStackInSlot( 0 );
// charge from the network!
if( this.internalCurrentPower < 1499 )
@@ -131,7 +131,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda
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!
}
@@ -146,12 +146,12 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda
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 )
{
@@ -166,7 +166,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda
{
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 );
}
@@ -175,7 +175,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda
}
@Override
public void setOrientation( EnumFacing inForward, EnumFacing inUp )
public void setOrientation( final EnumFacing inForward, final EnumFacing inUp )
{
super.setOrientation( inForward, inUp );
this.gridProxy.setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) );
@@ -199,7 +199,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda
{
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();
@@ -208,7 +208,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda
{
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 );
}
@@ -217,7 +217,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda
}
@Override
public boolean canCrankAttach( EnumFacing directionToCrank )
public boolean canCrankAttach( final EnumFacing directionToCrank )
{
return this.getUp() == directionToCrank || this.getUp().getOpposite() == directionToCrank;
}
@@ -235,7 +235,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda
}
@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();
@@ -243,17 +243,17 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda
}
@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, EnumFacing side )
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final EnumFacing 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;
@@ -264,19 +264,19 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda
}
@Override
public int[] getAccessibleSlotsBySide( EnumFacing whichSide )
public int[] getAccessibleSlotsBySide( final EnumFacing 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();
@@ -289,7 +289,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda
}
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, pos.offset( getForward() ), drops );
@@ -60,14 +60,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" );
@@ -75,12 +75,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;
@@ -90,13 +90,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 ) )
@@ -111,9 +111,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() );
}
@@ -122,9 +122,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() );
@@ -143,13 +143,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;
}
@@ -172,7 +172,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 )
{
@@ -188,17 +188,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 );
@@ -208,25 +208,25 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
}
@Override
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, EnumFacing side )
public boolean canInsertItem( final int slotIndex, final ItemStack insertingItem, final EnumFacing side )
{
return slotIndex == 0;
}
@Override
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, EnumFacing side )
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final EnumFacing side )
{
return slotIndex != 0;
}
@Override
public int[] getAccessibleSlotsBySide( EnumFacing side )
public int[] getAccessibleSlotsBySide( final EnumFacing side )
{
return this.sides;
}
@Override
public int fill( EnumFacing from, FluidStack resource, boolean doFill )
public int fill( final EnumFacing from, final FluidStack resource, final boolean doFill )
{
if( doFill )
{
@@ -237,37 +237,37 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
}
@Override
public FluidStack drain( EnumFacing from, FluidStack resource, boolean doDrain )
public FluidStack drain( final EnumFacing from, final FluidStack resource, final boolean doDrain )
{
return null;
}
@Override
public FluidStack drain( EnumFacing from, int maxDrain, boolean doDrain )
public FluidStack drain( final EnumFacing from, final int maxDrain, final boolean doDrain )
{
return null;
}
@Override
public boolean canFill( EnumFacing from, Fluid fluid )
public boolean canFill( final EnumFacing from, final Fluid fluid )
{
return true;
}
@Override
public boolean canDrain( EnumFacing from, Fluid fluid )
public boolean canDrain( final EnumFacing from, final Fluid fluid )
{
return false;
}
@Override
public FluidTankInfo[] getTankInfo( EnumFacing from )
public FluidTankInfo[] getTankInfo( final EnumFacing 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 );
}
@@ -112,13 +112,13 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
@Override
public AECableType getCableConnectionType( AEPartLocation dir )
public AECableType getCableConnectionType( final AEPartLocation 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" );
@@ -126,7 +126,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" );
@@ -134,12 +134,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 )
{
@@ -163,7 +163,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;
@@ -180,14 +180,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( EnumFacing inForward, EnumFacing inUp )
public void setOrientation( final EnumFacing inForward, final EnumFacing inUp )
{
super.setOrientation( inForward, inUp );
this.gridProxy.setValidSides( EnumSet.complementOf( EnumSet.of( this.getForward() ) ) );
@@ -196,15 +196,15 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
@Override
public void getDrops(
World w,
BlockPos pos,
List<ItemStack> drops )
final World w,
final BlockPos pos,
final List<ItemStack> drops )
{
super.getDrops( w, pos, 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 );
@@ -231,7 +231,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 )
{
@@ -245,7 +245,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 ) )
{
@@ -258,7 +258,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
{
@@ -277,14 +277,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, EnumFacing side )
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final EnumFacing side )
{
if( this.smash )
{
@@ -295,7 +295,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
@Override
public int[] getAccessibleSlotsBySide( EnumFacing d )
public int[] getAccessibleSlotsBySide( final EnumFacing d )
{
if( d == EnumFacing.UP )
{
@@ -311,7 +311,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 );
}
@@ -330,8 +330,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 )
@@ -350,8 +350,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 ) )
{
@@ -361,13 +361,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 += " ";
@@ -375,11 +375,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 )
@@ -398,18 +398,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 ) ) )
{
@@ -422,7 +422,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 )
{
@@ -433,7 +433,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 ), EnumFacing.UP );
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this.inv, 3, 1, true ), EnumFacing.UP );
if( ad.addItems( outputCopy ) == null )
{
@@ -460,13 +460,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 )
@@ -489,7 +489,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
}
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// :P
}
@@ -497,11 +497,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 ), EnumFacing.UP );
final ItemStack outputCopy = out.getOutput().copy();
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this.inv, 3, 1, true ), EnumFacing.UP );
if( ad.simulateAdd( outputCopy ) == null )
{
this.smash = true;
@@ -522,7 +522,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
@Override
public IInventory getInventoryByName( String name )
public IInventory getInventoryByName( final String name )
{
if( name.equals( "inv" ) )
{
@@ -538,13 +538,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 )
{
}
}
@@ -72,18 +72,18 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
AEPartLocation pointAt = AEPartLocation.INTERNAL;
@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( AEPartLocation axis )
public void setSide( final AEPartLocation axis )
{
if( Platform.isClient() )
{
@@ -137,9 +137,9 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
@Override
public void getDrops(
World w,
BlockPos pos,
List<ItemStack> drops )
final World w,
final BlockPos pos,
final List<ItemStack> drops )
{
this.duality.addDrops( drops );
}
@@ -159,16 +159,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 < AEPartLocation.values().length )
{
@@ -183,7 +183,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
}
@Override
public AECableType getCableConnectionType( AEPartLocation dir )
public AECableType getCableConnectionType( final AEPartLocation dir )
{
return this.duality.getCableConnectionType( dir );
}
@@ -195,7 +195,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 );
}
@@ -213,19 +213,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 );
}
@@ -237,13 +237,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( EnumFacing side )
public int[] getAccessibleSlotsBySide( final EnumFacing side )
{
return this.duality.getSlotsForFace( side );
}
@@ -271,7 +271,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
}
@Override
public IStorageMonitorable getMonitorable( EnumFacing side, BaseActionSource src )
public IStorageMonitorable getMonitorable( final EnumFacing side, final BaseActionSource src )
{
return this.duality.getMonitorable( side, src, this );
}
@@ -283,7 +283,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 );
}
@@ -295,13 +295,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 );
}
@@ -313,13 +313,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 );
}
@@ -331,7 +331,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 );
}
@@ -50,7 +50,7 @@ public class TileLightDetector extends AEBaseTile implements IUpdatePlayerListBo
public void updateLight()
{
int val = this.worldObj.getLight( pos );
final int val = this.worldObj.getLight( pos );
if( this.lastLight != val )
{
+25 -25
View File
@@ -59,9 +59,9 @@ public class TilePaint extends AEBaseTile
}
@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() )
{
@@ -69,7 +69,7 @@ public class TilePaint extends AEBaseTile
}
}
void writeBuffer( ByteBuf out )
void writeBuffer( final ByteBuf out )
{
if( this.dots == null )
{
@@ -79,14 +79,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" ) )
{
@@ -94,9 +94,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 )
{
@@ -112,7 +112,7 @@ public class TilePaint extends AEBaseTile
}
this.isLit = 0;
for( Splotch s : this.dots )
for( final Splotch s : this.dots )
{
if( s.lumen )
{
@@ -137,13 +137,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;
@@ -156,7 +156,7 @@ public class TilePaint extends AEBaseTile
return;
}
for( EnumFacing side : EnumFacing.VALUES )
for( final EnumFacing side : EnumFacing.VALUES )
{
if( !this.isSideValid( side ) )
{
@@ -167,19 +167,19 @@ public class TilePaint extends AEBaseTile
this.updateData();
}
public boolean isSideValid( EnumFacing side )
public boolean isSideValid( final EnumFacing side )
{
BlockPos p = pos.offset( side );
IBlockState blk = this.worldObj.getBlockState( p );
final BlockPos p = pos.offset( side );
final IBlockState blk = this.worldObj.getBlockState( p );
return blk.getBlock().isSideSolid( this.worldObj, p, side.getOpposite() );
}
private void removeSide( EnumFacing side )
private void removeSide( final EnumFacing 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();
@@ -193,7 +193,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 )
{
@@ -214,7 +214,7 @@ public class TilePaint extends AEBaseTile
}
}
public void cleanSide( EnumFacing side )
public void cleanSide( final EnumFacing side )
{
if( this.dots == null )
{
@@ -231,17 +231,17 @@ public class TilePaint extends AEBaseTile
return this.isLit;
}
public void addBlot( ItemStack type, EnumFacing side, Vec3 hitVec )
public void addBlot( final ItemStack type, final EnumFacing side, final Vec3 hitVec )
{
BlockPos p = pos.offset(side);
final BlockPos p = pos.offset(side);
IBlockState blk = this.worldObj.getBlockState( p );
final IBlockState blk = this.worldObj.getBlockState( p );
if( blk.getBlock().isSideSolid( this.worldObj, p, 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( AEPartLocation dir )
public AECableType getCableConnectionType( final AEPartLocation 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( EnumFacing inForward, EnumFacing inUp )
public void setOrientation( final EnumFacing inForward, final EnumFacing 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;
}
@@ -109,23 +109,23 @@ 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,
BlockPos pos,
List<ItemStack> drops )
final World w,
final BlockPos pos,
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() );
}
@@ -137,26 +137,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() );
@@ -164,12 +164,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++;
@@ -179,7 +179,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" ) )
@@ -190,10 +190,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.getKeySet() )
final NBTTagCompound storedItems = data.getCompoundTag( "storedItems" );
for( final Object key : storedItems.getKeySet() )
{
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 ) ) );
@@ -208,26 +208,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( AEPartLocation dir )
public AECableType getCableConnectionType( final AEPartLocation dir )
{
return AECableType.SMART;
}
@@ -300,7 +300,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 )
{
}
@@ -312,18 +312,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 );
}
}
@@ -351,7 +351,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
}
@Override
public boolean recolourBlock( EnumFacing side, AEColor newPaintedColor, EntityPlayer who )
public boolean recolourBlock( final EnumFacing 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( AEPartLocation dir )
public AECableType getCableConnectionType( final AEPartLocation 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, EnumFacing side )
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final EnumFacing side )
{
return extractedItem.getItem() == Items.bucket;
}
@Override
public int[] getAccessibleSlotsBySide( EnumFacing side )
public int[] getAccessibleSlotsBySide( final EnumFacing 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!
}
@@ -69,23 +69,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.getWorld().setTileEntity( pos, 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( AEPartLocation dir )
public IGridNode getGridNode( final AEPartLocation dir )
{
return this.cb.getGridNode( dir );
}
@Override
public AECableType getCableConnectionType( AEPartLocation side )
public AECableType getCableConnectionType( final AEPartLocation 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, BlockPos pos, List drops )
public void getDrops( final World w, final BlockPos pos, final List drops )
{
this.cb.getDrops( drops );
}
@Override
public void getNoDrops( World w, BlockPos pos, List<ItemStack> drops )
public void getNoDrops( final World w, final BlockPos pos, final List<ItemStack> drops )
{
this.cb.getNoDrops( drops );
}
@@ -233,31 +233,31 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
}
@Override
public boolean canAddPart( ItemStack is, AEPartLocation side )
public boolean canAddPart( final ItemStack is, final AEPartLocation side )
{
return this.cb.canAddPart( is, side );
}
@Override
public AEPartLocation addPart( ItemStack is, AEPartLocation side, EntityPlayer player )
public AEPartLocation addPart( final ItemStack is, final AEPartLocation side, final EntityPlayer player )
{
return this.cb.addPart( is, side, player );
}
@Override
public IPart getPart( AEPartLocation side )
public IPart getPart( final AEPartLocation side )
{
return this.cb.getPart( side );
}
@Override
public IPart getPart( EnumFacing side )
public IPart getPart( final EnumFacing side )
{
return this.cb.getPart( side );
}
@Override
public void removePart( AEPartLocation side, boolean suppressUpdate )
public void removePart( final AEPartLocation side, final boolean suppressUpdate )
{
this.cb.removePart( side, suppressUpdate );
}
@@ -281,19 +281,19 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
}
@Override
public boolean isBlocked( EnumFacing side )
public boolean isBlocked( final EnumFacing side )
{
return !this.ImmibisMicroblocks_isSideOpen( side );
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( World w, BlockPos pos, Entity e, boolean visual )
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, 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 );
}
@@ -311,7 +311,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
}
@Override
public boolean hasRedstone( AEPartLocation side )
public boolean hasRedstone( final AEPartLocation side )
{
return this.cb.hasRedstone( side );
}
@@ -333,7 +333,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;
@@ -345,13 +345,13 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public void addCollidingBlockToList(
World w,
BlockPos pos,
AxisAlignedBB bb,
List<AxisAlignedBB> out,
Entity e )
final World w,
final BlockPos pos,
final AxisAlignedBB bb,
final List<AxisAlignedBB> out,
final Entity e )
{
for( AxisAlignedBB bx : this.getSelectedBoundingBoxesFromPool( w, pos, e, false ) )
for( final AxisAlignedBB bx : this.getSelectedBoundingBoxesFromPool( w, pos, e, false ) )
{
out.add( AxisAlignedBB.fromBounds( bx.minX, bx.minY, bx.minZ, bx.maxX, bx.maxY, bx.maxZ ) );
}
@@ -372,7 +372,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
return this.cb.isInWorld();
}
public boolean ImmibisMicroblocks_isSideOpen( EnumFacing side )
public boolean ImmibisMicroblocks_isSideOpen( final EnumFacing side )
{
return true;
}
@@ -384,9 +384,9 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public boolean recolourBlock(
EnumFacing side,
AEColor colour,
EntityPlayer who )
final EnumFacing 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.getWorld().setTileEntity( pos, tcb );
}
catch( Throwable ignored )
catch( final Throwable ignored )
{
}
@@ -59,7 +59,7 @@ public class TileController extends AENetworkPowerTile
}
@Override
public AECableType getCableConnectionType( AEPartLocation dir )
public AECableType getCableConnectionType( final AEPartLocation dir )
{
return AECableType.DENSE;
}
@@ -71,7 +71,7 @@ public class TileController extends AENetworkPowerTile
super.onReady();
}
public void onNeighborChange( boolean force )
public void onNeighborChange( final boolean force )
{
final boolean xx = checkController( pos.offset( EnumFacing.EAST ) ) && checkController( pos.offset( EnumFacing.WEST ) );
final boolean yy = checkController( pos.offset( EnumFacing.UP ) ) && checkController( pos.offset( EnumFacing.DOWN ) );
@@ -122,7 +122,7 @@ public class TileController extends AENetworkPowerTile
}
}
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
metaState = ControllerBlockState.OFFLINE;
}
@@ -135,13 +135,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 );
@@ -149,18 +149,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 );
@@ -168,26 +168,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();
}
@@ -199,13 +199,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( EnumFacing whichSide )
public int[] getAccessibleSlotsBySide( final EnumFacing whichSide )
{
return ACCESSIBLE_SLOTS_BY_SIDE;
}
@@ -215,7 +215,7 @@ public class TileController extends AENetworkPowerTile
*
* @return true if there is a loaded controller
*/
private boolean checkController( BlockPos pos )
private boolean checkController( final BlockPos pos )
{
final BlockPos ownPos = this.getPos();
if( this.worldObj.getChunkProvider().chunkExists( ownPos.getX() >> 4, ownPos.getZ() >> 4 ) )
@@ -37,13 +37,13 @@ public class TileCreativeEnergyCell extends AENetworkTile implements IAEPowerSto
}
@Override
public AECableType getCableConnectionType( AEPartLocation dir )
public AECableType getCableConnectionType( final AEPartLocation dir )
{
return AECableType.COVERED;
}
@Override
public double injectAEPower( double amt, Actionable mode )
public double injectAEPower( final double amt, final Actionable mode )
{
return 0;
}
@@ -73,7 +73,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( AEPartLocation dir )
public AECableType getCableConnectionType( final AEPartLocation 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( EnumFacing side )
public int[] getAccessibleSlotsBySide( final EnumFacing side )
{
return this.sides;
}
@@ -51,7 +51,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
}
@Override
public AECableType getCableConnectionType( AEPartLocation dir )
public AECableType getCableConnectionType( final AEPartLocation dir )
{
return AECableType.COVERED;
}
@@ -60,7 +60,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
public void onReady()
{
super.onReady();
int value = ( Integer ) this.worldObj.getBlockState( pos ).getValue( BlockEnergyCell.ENERGY_STORAGE );
final int value = ( Integer ) this.worldObj.getBlockState( pos ).getValue( BlockEnergyCell.ENERGY_STORAGE );
currentMeta = (byte)value;
this.changePowerLevel();
}
@@ -91,7 +91,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 )
{
@@ -100,7 +100,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" );
}
@@ -112,7 +112,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 )
{
@@ -121,11 +121,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;
@@ -134,11 +134,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;
@@ -191,12 +191,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 )
{
@@ -207,7 +207,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 )
{
@@ -215,7 +215,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( EnumFacing inForward, EnumFacing inUp )
public void setOrientation( final EnumFacing inForward, final EnumFacing 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( AEPartLocation dir )
public AECableType getCableConnectionType( final AEPartLocation 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( EnumFacing side )
public int[] getAccessibleSlotsBySide( final EnumFacing 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;
}
@@ -52,46 +52,46 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
return this.internalPowerSides.clone();
}
protected void setPowerSides( EnumSet<EnumFacing> sides )
protected void setPowerSides( final EnumSet<EnumFacing> 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 )
{
@@ -100,7 +100,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 )
{
@@ -128,7 +128,7 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
}
}
protected void PowerEvent( PowerEventType x )
protected void PowerEvent( final PowerEventType x )
{
// nothing.
}
@@ -158,12 +158,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 )
{
@@ -174,7 +174,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 );
@@ -92,7 +92,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;
@@ -110,9 +110,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;
@@ -125,7 +125,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 )
{
@@ -134,7 +134,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
}
@Override
public int[] getAccessibleSlotsBySide( EnumFacing side )
public int[] getAccessibleSlotsBySide( final EnumFacing side )
{
if( this.isCenter() )
{
@@ -145,7 +145,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;
}
@@ -154,7 +154,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
}
@MENetworkEventSubscribe
public void onPowerStatusChange( MENetworkPowerStatusChange c )
public void onPowerStatusChange( final MENetworkPowerStatusChange c )
{
this.updateStatus = true;
}
@@ -193,7 +193,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
}
@Override
public void disconnect( boolean affectWorld )
public void disconnect( final boolean affectWorld )
{
if( this.cluster != null )
{
@@ -225,7 +225,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;
@@ -239,8 +239,8 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
if( this.isCorner() || this.isCenter() )
{
EnumSet<EnumFacing> sides = EnumSet.noneOf( EnumFacing.class );
for ( AEPartLocation dir : this.getConnections() )
final EnumSet<EnumFacing> sides = EnumSet.noneOf( EnumFacing.class );
for ( final AEPartLocation dir : this.getConnections() )
if ( dir != AEPartLocation.INTERNAL )
sides.add( dir.getFacing());
@@ -260,11 +260,11 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
public EnumSet<AEPartLocation> getConnections()
{
EnumSet<AEPartLocation> set = EnumSet.noneOf( AEPartLocation.class );
final EnumSet<AEPartLocation> set = EnumSet.noneOf( AEPartLocation.class );
for( AEPartLocation d : AEPartLocation.values() )
for( final AEPartLocation d : AEPartLocation.values() )
{
TileEntity te = this.worldObj.getTileEntity( d == AEPartLocation.INTERNAL ? pos : pos.offset( d.getFacing() ) );
final TileEntity te = this.worldObj.getTileEntity( d == AEPartLocation.INTERNAL ? pos : pos.offset( d.getFacing() ) );
if( te instanceof TileQuantumBridge )
{
set.add( d );
@@ -276,10 +276,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" );
@@ -299,7 +299,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
{
return this.gridProxy.getEnergy().isNetworkPowered();
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// :P
}
@@ -313,7 +313,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
}
@Override
public AECableType getCableConnectionType( AEPartLocation dir )
public AECableType getCableConnectionType( final AEPartLocation dir )
{
return AECableType.DENSE;
}
@@ -63,13 +63,13 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileSpatialIOPort( NBTTagCompound data )
public void writeToNBT_TileSpatialIOPort( final NBTTagCompound data )
{
data.setInteger( "lastRedstoneState", this.lastRedstoneState.ordinal() );
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileSpatialIOPort( NBTTagCompound data )
public void readFromNBT_TileSpatialIOPort( final NBTTagCompound data )
{
if( data.hasKey( "lastRedstoneState" ) )
{
@@ -89,7 +89,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
public void updateRedstoneState()
{
YesNo currentState = this.worldObj.isBlockIndirectlyGettingPowered( pos ) != 0 ? YesNo.YES : YesNo.NO;
final YesNo currentState = this.worldObj.isBlockIndirectlyGettingPowered( pos ) != 0 ? YesNo.YES : YesNo.NO;
if( this.lastRedstoneState != currentState )
{
this.lastRedstoneState = currentState;
@@ -104,7 +104,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
{
if( Platform.isServer() )
{
ItemStack cell = this.getStackInSlot( 0 );
final ItemStack cell = this.getStackInSlot( 0 );
if( this.isSpatialCell( cell ) )
{
TickHandler.INSTANCE.addCallable( null, this );// this needs to be cross world synced.
@@ -112,38 +112,38 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
}
}
private boolean isSpatialCell( ItemStack cell )
private boolean isSpatialCell( final ItemStack cell )
{
if( cell != null && cell.getItem() instanceof ISpatialStorageCell )
{
ISpatialStorageCell sc = (ISpatialStorageCell) cell.getItem();
final ISpatialStorageCell sc = (ISpatialStorageCell) cell.getItem();
return sc != null && sc.isSpatialStorage( cell );
}
return false;
}
@Override
public Void call( World world ) throws Exception
public Void call( final World world ) throws Exception
{
ItemStack cell = this.getStackInSlot( 0 );
final ItemStack cell = this.getStackInSlot( 0 );
if( this.isSpatialCell( cell ) && this.getStackInSlot( 1 ) == null )
{
IGrid gi = this.gridProxy.getGrid();
IEnergyGrid energy = this.gridProxy.getEnergy();
final IGrid gi = this.gridProxy.getGrid();
final IEnergyGrid energy = this.gridProxy.getEnergy();
ISpatialStorageCell sc = (ISpatialStorageCell) cell.getItem();
final ISpatialStorageCell sc = (ISpatialStorageCell) cell.getItem();
SpatialPylonCache spc = gi.getCache( ISpatialCache.class );
final SpatialPylonCache spc = gi.getCache( ISpatialCache.class );
if( spc.hasRegion() && spc.isValidRegion() )
{
double req = spc.requiredPower();
double pr = energy.extractAEPower( req, Actionable.SIMULATE, PowerMultiplier.CONFIG );
final double req = spc.requiredPower();
final double pr = energy.extractAEPower( req, Actionable.SIMULATE, PowerMultiplier.CONFIG );
if( Math.abs( pr - req ) < req * 0.001 )
{
MENetworkEvent res = gi.postEvent( new MENetworkSpatialEvent( this, req ) );
final MENetworkEvent res = gi.postEvent( new MENetworkSpatialEvent( this, req ) );
if( !res.isCanceled() )
{
TransitionResult tr = sc.doSpatialTransition( cell, this.worldObj, spc.getMin(), spc.getMax(), true );
final TransitionResult tr = sc.doSpatialTransition( cell, this.worldObj, spc.getMin(), spc.getMax(), true );
if( tr.success )
{
energy.extractAEPower( req, Actionable.MODULATE, PowerMultiplier.CONFIG );
@@ -159,7 +159,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
}
@Override
public AECableType getCableConnectionType( AEPartLocation dir )
public AECableType getCableConnectionType( final AEPartLocation dir )
{
return AECableType.SMART;
}
@@ -177,31 +177,31 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return ( i == 0 && this.isSpatialCell( itemstack ) );
}
@Override
public void onChangeInventory( IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added )
public void onChangeInventory( final IInventory inv, final int slot, final InvOperation mc, final ItemStack removed, final ItemStack added )
{
}
@Override
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, EnumFacing side )
public boolean canInsertItem( final int slotIndex, final ItemStack insertingItem, final EnumFacing side )
{
return this.isItemValidForSlot( slotIndex, insertingItem );
}
@Override
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, EnumFacing side )
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final EnumFacing side )
{
return slotIndex == 1;
}
@Override
public int[] getAccessibleSlotsBySide( EnumFacing side )
public int[] getAccessibleSlotsBySide( final EnumFacing side )
{
return this.sides;
}
@@ -98,7 +98,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
}
@Override
public void disconnect( boolean b )
public void disconnect( final boolean b )
{
if( this.cluster != null )
{
@@ -119,7 +119,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
return true;
}
public void updateStatus( SpatialPylonCluster c )
public void updateStatus( final SpatialPylonCluster c )
{
this.cluster = c;
this.gridProxy.setValidSides( c == null ? EnumSet.noneOf( EnumFacing.class ) : EnumSet.allOf( EnumFacing.class ) );
@@ -128,7 +128,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
public void recalculateDisplay()
{
int oldBits = this.displayBits;
final int oldBits = this.displayBits;
this.displayBits = 0;
@@ -175,7 +175,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
this.displayBits |= DISPLAY_ENABLED;
}
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// nothing?
}
@@ -191,7 +191,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
public void markForUpdate()
{
super.markForUpdate();
boolean hasLight = this.getLightValue() > 0;
final boolean hasLight = this.getLightValue() > 0;
if( hasLight != this.didHaveLight )
{
this.didHaveLight = hasLight;
@@ -216,27 +216,27 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
}
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileSpatialPylon( ByteBuf data )
public boolean readFromStream_TileSpatialPylon( final ByteBuf data )
{
int old = this.displayBits;
final int old = this.displayBits;
this.displayBits = data.readByte();
return old != this.displayBits;
}
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileSpatialPylon( ByteBuf data )
public void writeToStream_TileSpatialPylon( final ByteBuf data )
{
data.writeByte( this.displayBits );
}
@MENetworkEventSubscribe
public void powerRender( MENetworkPowerStatusChange c )
public void powerRender( final MENetworkPowerStatusChange c )
{
this.recalculateDisplay();
}
@MENetworkEventSubscribe
public void activeRender( MENetworkChannelsChanged c )
public void activeRender( final MENetworkChannelsChanged c )
{
this.recalculateDisplay();
}
+100 -100
View File
@@ -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, EnumFacing side )
public boolean canInsertItem( final int slotIndex, final ItemStack insertingItem, final EnumFacing 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, EnumFacing side )
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final EnumFacing side )
{
return slotIndex == 1;
}
@Override
public int[] getAccessibleSlotsBySide( EnumFacing side )
public int[] getAccessibleSlotsBySide( final EnumFacing side )
{
if( EnumFacing.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( EnumFacing from, FluidStack resource, boolean doFill )
public int fill( final EnumFacing 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( EnumFacing from, FluidStack resource, boolean doDrain )
public FluidStack drain( final EnumFacing from, final FluidStack resource, final boolean doDrain )
{
return null;
}
@Override
public FluidStack drain( EnumFacing from, int maxDrain, boolean doDrain )
public FluidStack drain( final EnumFacing from, final int maxDrain, final boolean doDrain )
{
return null;
}
@Override
public boolean canFill( EnumFacing from, Fluid fluid )
public boolean canFill( final EnumFacing 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( EnumFacing from, Fluid fluid )
public boolean canDrain( final EnumFacing from, final Fluid fluid )
{
return false;
}
@Override
public FluidTankInfo[] getTankInfo( EnumFacing from )
public FluidTankInfo[] getTankInfo( final EnumFacing 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( EnumFacing side, BaseActionSource src )
public IStorageMonitorable getMonitorable( final EnumFacing 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, EnumFacing side )
public boolean openGui( final EntityPlayer p, final ICellHandler ch, final ItemStack cell, final EnumFacing 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
}
@@ -842,9 +842,9 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public boolean recolourBlock(
EnumFacing side,
AEColor newPaintedColor,
EntityPlayer who )
final EnumFacing side,
final AEColor newPaintedColor,
final EntityPlayer who )
{
if( this.paintedColor == newPaintedColor )
{
@@ -858,7 +858,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@Override
public void saveChanges( IMEInventory cellInventory )
public void saveChanges( final IMEInventory cellInventory )
{
this.worldObj.markChunkDirty( pos, this );
}
@@ -874,13 +874,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 )
{
@@ -894,7 +894,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 ) )
{
@@ -905,7 +905,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 )
{
// :(
}
@@ -925,14 +925,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();
@@ -941,7 +941,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 ) )
{
@@ -950,28 +950,28 @@ 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;
@@ -985,7 +985,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,29 +176,29 @@ 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();
}
@@ -206,7 +206,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
private void recalculateDisplay()
{
boolean currentActive = this.gridProxy.isActive();
final boolean currentActive = this.gridProxy.isActive();
if( currentActive )
{
this.state |= 0x80000000;
@@ -223,7 +223,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 +234,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 +242,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( AEPartLocation dir )
public AECableType getCableConnectionType( final AEPartLocation dir )
{
return AECableType.SMART;
}
@@ -266,13 +266,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 +284,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 +295,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
}
@Override
public int[] getAccessibleSlotsBySide( EnumFacing side )
public int[] getAccessibleSlotsBySide( final EnumFacing side )
{
return this.sides;
}
@@ -311,7 +311,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 +327,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 +340,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 +364,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 +381,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 +393,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 +415,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
}
@Override
public void saveChanges( IMEInventory cellInventory )
public void saveChanges( final IMEInventory cellInventory )
{
this.worldObj.markChunkDirty( pos, this );
}
@@ -121,7 +121,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" );
@@ -130,7 +130,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" );
@@ -142,7 +142,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
@Override
public AECableType getCableConnectionType( AEPartLocation dir )
public AECableType getCableConnectionType( final AEPartLocation dir )
{
return AECableType.SMART;
}
@@ -166,7 +166,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
}
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// :P
}
@@ -174,7 +174,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
public void updateRedstoneState()
{
YesNo currentState = this.worldObj.isBlockIndirectlyGettingPowered( pos ) != 0 ? YesNo.YES : YesNo.NO;
final YesNo currentState = this.worldObj.isBlockIndirectlyGettingPowered( pos ) != 0 ? YesNo.YES : YesNo.NO;
if( this.lastRedstoneState != currentState )
{
this.lastRedstoneState = currentState;
@@ -199,7 +199,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();
@@ -214,7 +214,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" ) )
{
@@ -230,7 +230,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();
}
@@ -258,7 +258,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 )
{
@@ -267,9 +267,9 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
@Override
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, EnumFacing side )
public boolean canInsertItem( final int slotIndex, final ItemStack insertingItem, final EnumFacing side )
{
for( int inputSlotIndex : this.input )
for( final int inputSlotIndex : this.input )
{
if( inputSlotIndex == slotIndex )
{
@@ -281,9 +281,9 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
@Override
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, EnumFacing side )
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final EnumFacing side )
{
for( int outputSlotIndex : this.output )
for( final int outputSlotIndex : this.output )
{
if( outputSlotIndex == slotIndex )
{
@@ -295,7 +295,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
@Override
public int[] getAccessibleSlotsBySide( EnumFacing d )
public int[] getAccessibleSlotsBySide( final EnumFacing d )
{
if( d == EnumFacing.UP || d == EnumFacing.DOWN )
{
@@ -306,13 +306,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() )
{
@@ -336,18 +336,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 )
{
@@ -386,7 +386,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
}
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
return TickRateModulation.IDLE;
}
@@ -396,12 +396,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 )
{
@@ -418,9 +418,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();
@@ -436,12 +436,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 )
@@ -458,11 +458,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 )
{
@@ -487,9 +487,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 )
{
@@ -507,10 +507,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, EnumFacing.UP ).addItems( this.getStackInSlot( x ) );
final WrapperInventoryRange wir = new WrapperInventoryRange( this, this.output, true );
final ItemStack result = InventoryAdaptor.getAdaptor( wir, EnumFacing.UP ).addItems( this.getStackInSlot( x ) );
if( result == null )
{
@@ -521,14 +521,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 )
{
@@ -544,7 +544,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 );
@@ -564,15 +564,15 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
*/
@Override
public void getDrops(
World w,
BlockPos pos,
List<ItemStack> drops )
final World w,
final BlockPos pos,
final List<ItemStack> drops )
{
super.getDrops( w, pos, 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 )
{
@@ -44,15 +44,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 )
@@ -76,7 +76,7 @@ public class TileSkyChest extends AEBaseInvTile
}
@Override
public void openInventory( EntityPlayer player )
public void openInventory( final EntityPlayer player )
{
if( Platform.isClient() )
{
@@ -93,7 +93,7 @@ public class TileSkyChest extends AEBaseInvTile
}
@Override
public void closeInventory( EntityPlayer player )
public void closeInventory( final EntityPlayer player )
{
if( Platform.isClient() )
{
@@ -115,13 +115,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( EnumFacing side )
public int[] getAccessibleSlotsBySide( final EnumFacing side )
{
return this.sides;
}