final variables and parameters
seeing some methods it does actually help to enforce the parameters
This commit is contained in:
@@ -113,7 +113,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pushPattern( ICraftingPatternDetails patternDetails, InventoryCrafting table, ForgeDirection where )
|
||||
public boolean pushPattern( final ICraftingPatternDetails patternDetails, final InventoryCrafting table, final ForgeDirection where )
|
||||
{
|
||||
if( this.myPattern == null )
|
||||
{
|
||||
@@ -144,7 +144,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
|
||||
private void updateSleepiness()
|
||||
{
|
||||
boolean wasEnabled = this.isAwake;
|
||||
final boolean wasEnabled = this.isAwake;
|
||||
this.isAwake = this.myPlan != null && this.hasMats() || this.canPush();
|
||||
if( wasEnabled != this.isAwake )
|
||||
{
|
||||
@@ -159,7 +159,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
@@ -193,34 +193,34 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInstalledUpgrades( Upgrades u )
|
||||
public int getInstalledUpgrades( final Upgrades u )
|
||||
{
|
||||
return this.upgrades.getInstalledUpgrades( u );
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.NETWORK_READ )
|
||||
public boolean readFromStream_TileMolecularAssembler( ByteBuf data )
|
||||
public boolean readFromStream_TileMolecularAssembler( final ByteBuf data )
|
||||
{
|
||||
boolean oldPower = this.isPowered;
|
||||
final boolean oldPower = this.isPowered;
|
||||
this.isPowered = data.readBoolean();
|
||||
return this.isPowered != oldPower;
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.NETWORK_WRITE )
|
||||
public void writeToStream_TileMolecularAssembler( ByteBuf data )
|
||||
public void writeToStream_TileMolecularAssembler( final ByteBuf data )
|
||||
{
|
||||
data.writeBoolean( this.isPowered );
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_WRITE )
|
||||
public void writeToNBT_TileMolecularAssembler( NBTTagCompound data )
|
||||
public void writeToNBT_TileMolecularAssembler( final NBTTagCompound data )
|
||||
{
|
||||
if( this.forcePlan && this.myPlan != null )
|
||||
{
|
||||
ItemStack pattern = this.myPlan.getPattern();
|
||||
final ItemStack pattern = this.myPlan.getPattern();
|
||||
if( pattern != null )
|
||||
{
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
final NBTTagCompound compound = new NBTTagCompound();
|
||||
pattern.writeToNBT( compound );
|
||||
data.setTag( "myPlan", compound );
|
||||
data.setInteger( "pushDirection", this.pushDirection.ordinal() );
|
||||
@@ -233,17 +233,17 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_READ )
|
||||
public void readFromNBT_TileMolecularAssembler( NBTTagCompound data )
|
||||
public void readFromNBT_TileMolecularAssembler( final NBTTagCompound data )
|
||||
{
|
||||
if( data.hasKey( "myPlan" ) )
|
||||
{
|
||||
ItemStack myPat = ItemStack.loadItemStackFromNBT( data.getCompoundTag( "myPlan" ) );
|
||||
final ItemStack myPat = ItemStack.loadItemStackFromNBT( data.getCompoundTag( "myPlan" ) );
|
||||
|
||||
if( myPat != null && myPat.getItem() instanceof ItemEncodedPattern )
|
||||
{
|
||||
World w = this.getWorldObj();
|
||||
ItemEncodedPattern iep = (ItemEncodedPattern) myPat.getItem();
|
||||
ICraftingPatternDetails ph = iep.getPatternForItem( myPat, w );
|
||||
final World w = this.getWorldObj();
|
||||
final ItemEncodedPattern iep = (ItemEncodedPattern) myPat.getItem();
|
||||
final ICraftingPatternDetails ph = iep.getPatternForItem( myPat, w );
|
||||
if( ph != null && ph.isCraftable() )
|
||||
{
|
||||
this.forcePlan = true;
|
||||
@@ -268,15 +268,15 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack is = this.inv.getStackInSlot( 10 );
|
||||
final ItemStack is = this.inv.getStackInSlot( 10 );
|
||||
|
||||
if( is != null && is.getItem() instanceof ItemEncodedPattern )
|
||||
{
|
||||
if( !Platform.isSameItem( is, this.myPattern ) )
|
||||
{
|
||||
World w = this.getWorldObj();
|
||||
ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
|
||||
ICraftingPatternDetails ph = iep.getPatternForItem( is, w );
|
||||
final World w = this.getWorldObj();
|
||||
final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
|
||||
final ICraftingPatternDetails ph = iep.getPatternForItem( is, w );
|
||||
|
||||
if( ph != null && ph.isCraftable() )
|
||||
{
|
||||
@@ -299,7 +299,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( final ForgeDirection dir )
|
||||
{
|
||||
return AECableType.COVERED;
|
||||
}
|
||||
@@ -317,7 +317,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName( String name )
|
||||
public IInventory getInventoryByName( final String name )
|
||||
{
|
||||
if( name.equals( "upgrades" ) )
|
||||
{
|
||||
@@ -333,7 +333,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
|
||||
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
|
||||
{
|
||||
|
||||
}
|
||||
@@ -351,7 +351,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot( int i, ItemStack itemstack )
|
||||
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
|
||||
{
|
||||
if( i >= 9 )
|
||||
{
|
||||
@@ -372,7 +372,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory( IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added )
|
||||
public void onChangeInventory( final IInventory inv, final int slot, final InvOperation mc, final ItemStack removed, final ItemStack added )
|
||||
{
|
||||
if( inv == this.inv )
|
||||
{
|
||||
@@ -381,13 +381,13 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
|
||||
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final int side )
|
||||
{
|
||||
return slotIndex == 9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide( ForgeDirection whichSide )
|
||||
public int[] getAccessibleSlotsBySide( final ForgeDirection whichSide )
|
||||
{
|
||||
return SIDES;
|
||||
}
|
||||
@@ -398,13 +398,13 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops( World w, int x, int y, int z, List<ItemStack> drops )
|
||||
public void getDrops( final World w, final int x, final int y, final int z, final List<ItemStack> drops )
|
||||
{
|
||||
super.getDrops( w, x, y, z, drops );
|
||||
|
||||
for( int h = 0; h < this.upgrades.getSizeInventory(); h++ )
|
||||
{
|
||||
ItemStack is = this.upgrades.getStackInSlot( h );
|
||||
final ItemStack is = this.upgrades.getStackInSlot( h );
|
||||
if( is != null )
|
||||
{
|
||||
drops.add( is );
|
||||
@@ -413,7 +413,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest( IGridNode node )
|
||||
public TickingRequest getTickingRequest( final IGridNode node )
|
||||
{
|
||||
this.recalculatePlan();
|
||||
this.updateSleepiness();
|
||||
@@ -421,7 +421,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest( IGridNode node, int ticksSinceLastCall )
|
||||
public TickRateModulation tickingRequest( final IGridNode node, int ticksSinceLastCall )
|
||||
{
|
||||
if( this.inv.getStackInSlot( 9 ) != null )
|
||||
{
|
||||
@@ -487,7 +487,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
this.progress = 0;
|
||||
ItemStack output = this.myPlan.getOutput( this.craftingInv, this.getWorldObj() );
|
||||
final ItemStack output = this.myPlan.getOutput( this.craftingInv, this.getWorldObj() );
|
||||
if( output != null )
|
||||
{
|
||||
FMLCommonHandler.instance().firePlayerCraftingEvent( Platform.getPlayer( (WorldServer) this.getWorldObj() ), output, this.craftingInv );
|
||||
@@ -510,11 +510,11 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
|
||||
try
|
||||
{
|
||||
TargetPoint where = new TargetPoint( this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, 32 );
|
||||
IAEItemStack item = AEItemStack.create( output );
|
||||
final TargetPoint where = new TargetPoint( this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, 32 );
|
||||
final IAEItemStack item = AEItemStack.create( output );
|
||||
NetworkHandler.instance.sendToAllAround( new PacketAssemblerAnimation( this.xCoord, this.yCoord, this.zCoord, (byte) speed, item ), where );
|
||||
}
|
||||
catch( IOException e )
|
||||
catch( final IOException e )
|
||||
{
|
||||
// ;P
|
||||
}
|
||||
@@ -534,7 +534,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
{
|
||||
for( int x = 0; x < 9; x++ )
|
||||
{
|
||||
ItemStack is = this.inv.getStackInSlot( x );
|
||||
final ItemStack is = this.inv.getStackInSlot( x );
|
||||
if( is != null )
|
||||
{
|
||||
if( this.myPlan == null || !this.myPlan.isValidItemForSlot( x, is, this.worldObj ) )
|
||||
@@ -549,13 +549,13 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
}
|
||||
|
||||
private int userPower( int ticksPassed, int bonusValue, double acceleratorTax )
|
||||
private int userPower( final int ticksPassed, final int bonusValue, final double acceleratorTax )
|
||||
{
|
||||
try
|
||||
{
|
||||
return (int) ( this.gridProxy.getEnergy().extractAEPower( ticksPassed * bonusValue * acceleratorTax, Actionable.MODULATE, PowerMultiplier.CONFIG ) / acceleratorTax );
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -565,7 +565,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
{
|
||||
if( this.pushDirection == ForgeDirection.UNKNOWN )
|
||||
{
|
||||
for( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
|
||||
for( final ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
|
||||
{
|
||||
output = this.pushTo( output, d );
|
||||
}
|
||||
@@ -584,30 +584,30 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
this.inv.setInventorySlotContents( 9, output );
|
||||
}
|
||||
|
||||
private ItemStack pushTo( ItemStack output, ForgeDirection d )
|
||||
private ItemStack pushTo( ItemStack output, final ForgeDirection d )
|
||||
{
|
||||
if( output == null )
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
TileEntity te = this.getWorldObj().getTileEntity( this.xCoord + d.offsetX, this.yCoord + d.offsetY, this.zCoord + d.offsetZ );
|
||||
final TileEntity te = this.getWorldObj().getTileEntity( this.xCoord + d.offsetX, this.yCoord + d.offsetY, this.zCoord + d.offsetZ );
|
||||
|
||||
if( te == null )
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
InventoryAdaptor adaptor = InventoryAdaptor.getAdaptor( te, d.getOpposite() );
|
||||
final InventoryAdaptor adaptor = InventoryAdaptor.getAdaptor( te, d.getOpposite() );
|
||||
|
||||
if( adaptor == null )
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
int size = output.stackSize;
|
||||
final int size = output.stackSize;
|
||||
output = adaptor.addItems( output );
|
||||
int newSize = output == null ? 0 : output.stackSize;
|
||||
final int newSize = output == null ? 0 : output.stackSize;
|
||||
|
||||
if( size != newSize )
|
||||
{
|
||||
@@ -618,7 +618,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void onPowerEvent( MENetworkPowerStatusChange p )
|
||||
public void onPowerEvent( final MENetworkPowerStatusChange p )
|
||||
{
|
||||
this.updatePowerState();
|
||||
}
|
||||
@@ -631,7 +631,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
{
|
||||
newState = this.gridProxy.isActive() && this.gridProxy.getEnergy().extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.0001;
|
||||
}
|
||||
catch( GridAccessException ignored )
|
||||
catch( final GridAccessException ignored )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user