final variables and parameters
seeing some methods it does actually help to enforce the parameters
This commit is contained in:
@@ -28,7 +28,7 @@ public class AEGlassMaterial extends Material
|
||||
|
||||
public static final AEGlassMaterial INSTANCE = ( new AEGlassMaterial( MapColor.airColor ) );
|
||||
|
||||
public AEGlassMaterial( MapColor color )
|
||||
public AEGlassMaterial( final MapColor color )
|
||||
{
|
||||
super( color );
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
IMEInventory<IAEItemStack> destination;
|
||||
private boolean isWorking = false;
|
||||
|
||||
public DualityInterface( AENetworkProxy networkProxy, IInterfaceHost ih )
|
||||
public DualityInterface( final AENetworkProxy networkProxy, final IInterfaceHost ih )
|
||||
{
|
||||
this.gridProxy = networkProxy;
|
||||
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
|
||||
@@ -149,7 +149,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
@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.isWorking )
|
||||
{
|
||||
@@ -166,11 +166,11 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
else if( inv == this.storage && slot >= 0 )
|
||||
{
|
||||
boolean had = this.hasWorkToDo();
|
||||
final boolean had = this.hasWorkToDo();
|
||||
|
||||
this.updatePlan( slot );
|
||||
|
||||
boolean now = this.hasWorkToDo();
|
||||
final boolean now = this.hasWorkToDo();
|
||||
|
||||
if( had != now )
|
||||
{
|
||||
@@ -185,7 +185,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
@@ -193,7 +193,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT( NBTTagCompound data )
|
||||
public void writeToNBT( final NBTTagCompound data )
|
||||
{
|
||||
this.config.writeToNBT( data, "config" );
|
||||
this.patterns.writeToNBT( data, "patterns" );
|
||||
@@ -203,12 +203,12 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.craftingTracker.writeToNBT( data );
|
||||
data.setInteger( "priority", this.priority );
|
||||
|
||||
NBTTagList waitingToSend = new NBTTagList();
|
||||
final NBTTagList waitingToSend = new NBTTagList();
|
||||
if( this.waitingToSend != null )
|
||||
{
|
||||
for( ItemStack is : this.waitingToSend )
|
||||
for( final ItemStack is : this.waitingToSend )
|
||||
{
|
||||
NBTTagCompound item = new NBTTagCompound();
|
||||
final NBTTagCompound item = new NBTTagCompound();
|
||||
is.writeToNBT( item );
|
||||
waitingToSend.appendTag( item );
|
||||
}
|
||||
@@ -216,18 +216,18 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
data.setTag( "waitingToSend", waitingToSend );
|
||||
}
|
||||
|
||||
public void readFromNBT( NBTTagCompound data )
|
||||
public void readFromNBT( final NBTTagCompound data )
|
||||
{
|
||||
this.waitingToSend = null;
|
||||
NBTTagList waitingList = data.getTagList( "waitingToSend", 10 );
|
||||
final NBTTagList waitingList = data.getTagList( "waitingToSend", 10 );
|
||||
if( waitingList != null )
|
||||
{
|
||||
for( int x = 0; x < waitingList.tagCount(); x++ )
|
||||
{
|
||||
NBTTagCompound c = waitingList.getCompoundTagAt( x );
|
||||
final NBTTagCompound c = waitingList.getCompoundTagAt( x );
|
||||
if( c != null )
|
||||
{
|
||||
ItemStack is = ItemStack.loadItemStackFromNBT( c );
|
||||
final ItemStack is = ItemStack.loadItemStackFromNBT( c );
|
||||
this.addToSendList( is );
|
||||
}
|
||||
}
|
||||
@@ -244,7 +244,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.updateCraftingList();
|
||||
}
|
||||
|
||||
public void addToSendList( ItemStack is )
|
||||
public void addToSendList( final ItemStack is )
|
||||
{
|
||||
if( is == null )
|
||||
{
|
||||
@@ -262,7 +262,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
@@ -272,7 +272,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
this.hasConfig = false;
|
||||
|
||||
for( ItemStack p : this.config )
|
||||
for( final ItemStack p : this.config )
|
||||
{
|
||||
if( p != null )
|
||||
{
|
||||
@@ -281,14 +281,14 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
|
||||
boolean had = this.hasWorkToDo();
|
||||
final boolean had = this.hasWorkToDo();
|
||||
|
||||
for( int x = 0; x < NUMBER_OF_CONFIG_SLOTS; x++ )
|
||||
{
|
||||
this.updatePlan( x );
|
||||
}
|
||||
|
||||
boolean has = this.hasWorkToDo();
|
||||
final boolean has = this.hasWorkToDo();
|
||||
|
||||
if( had != has )
|
||||
{
|
||||
@@ -303,7 +303,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
@@ -314,7 +314,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
public void updateCraftingList()
|
||||
{
|
||||
Boolean[] accountedFor = { false, false, false, false, false, false, false, false, false }; // 9...
|
||||
final Boolean[] accountedFor = { false, false, false, false, false, false, false, false, false }; // 9...
|
||||
|
||||
assert ( accountedFor.length == this.patterns.getSizeInventory() );
|
||||
|
||||
@@ -325,15 +325,15 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
if( this.craftingList != null )
|
||||
{
|
||||
Iterator<ICraftingPatternDetails> i = this.craftingList.iterator();
|
||||
final Iterator<ICraftingPatternDetails> i = this.craftingList.iterator();
|
||||
while( i.hasNext() )
|
||||
{
|
||||
ICraftingPatternDetails details = i.next();
|
||||
final ICraftingPatternDetails details = i.next();
|
||||
boolean found = false;
|
||||
|
||||
for( int x = 0; x < accountedFor.length; x++ )
|
||||
{
|
||||
ItemStack is = this.patterns.getStackInSlot( x );
|
||||
final ItemStack is = this.patterns.getStackInSlot( x );
|
||||
if( details.getPattern() == is )
|
||||
{
|
||||
accountedFor[x] = found = true;
|
||||
@@ -359,7 +359,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
this.gridProxy.getGrid().postEvent( new MENetworkCraftingPatternChange( this, this.gridProxy.getNode() ) );
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
@@ -370,7 +370,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
return this.hasItemsToSend() || this.requireWork[0] != null || this.requireWork[1] != null || this.requireWork[2] != null || this.requireWork[3] != null || this.requireWork[4] != null || this.requireWork[5] != null || this.requireWork[6] != null || this.requireWork[7] != null;
|
||||
}
|
||||
|
||||
private void updatePlan( int slot )
|
||||
private void updatePlan( final int slot )
|
||||
{
|
||||
IAEItemStack req = this.config.getAEStackInSlot( slot );
|
||||
if( req != null && req.getStackSize() <= 0 )
|
||||
@@ -379,11 +379,11 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
req = null;
|
||||
}
|
||||
|
||||
ItemStack Stored = this.storage.getStackInSlot( slot );
|
||||
final ItemStack Stored = this.storage.getStackInSlot( slot );
|
||||
|
||||
if( req == null && Stored != null )
|
||||
{
|
||||
IAEItemStack work = AEApi.instance().storage().createItemStack( Stored );
|
||||
final IAEItemStack work = AEApi.instance().storage().createItemStack( Stored );
|
||||
this.requireWork[slot] = work.setStackSize( -work.getStackSize() );
|
||||
return;
|
||||
}
|
||||
@@ -406,7 +406,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
else
|
||||
// Stored != null; dispose!
|
||||
{
|
||||
IAEItemStack work = AEApi.instance().storage().createItemStack( Stored );
|
||||
final IAEItemStack work = AEApi.instance().storage().createItemStack( Stored );
|
||||
this.requireWork[slot] = work.setStackSize( -work.getStackSize() );
|
||||
return;
|
||||
}
|
||||
@@ -426,20 +426,20 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.gridProxy.getGrid().postEvent( new MENetworkCraftingPatternChange( this, this.gridProxy.getNode() ) );
|
||||
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
}
|
||||
|
||||
TileEntity te = this.iHost.getTileEntity();
|
||||
final TileEntity te = this.iHost.getTileEntity();
|
||||
if( te != null && te.getWorldObj() != null )
|
||||
{
|
||||
Platform.notifyBlocksOfNeighbors( te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord );
|
||||
}
|
||||
}
|
||||
|
||||
public void addToCraftingList( ItemStack is )
|
||||
public void addToCraftingList( final ItemStack is )
|
||||
{
|
||||
if( is == null )
|
||||
{
|
||||
@@ -448,8 +448,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
if( is.getItem() instanceof ICraftingPatternItem )
|
||||
{
|
||||
ICraftingPatternItem cpi = (ICraftingPatternItem) is.getItem();
|
||||
ICraftingPatternDetails details = cpi.getPatternForItem( is, this.iHost.getTileEntity().getWorldObj() );
|
||||
final ICraftingPatternItem cpi = (ICraftingPatternItem) is.getItem();
|
||||
final ICraftingPatternDetails details = cpi.getPatternForItem( is, this.iHost.getTileEntity().getWorldObj() );
|
||||
|
||||
if( details != null )
|
||||
{
|
||||
@@ -469,9 +469,9 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsert( ItemStack stack )
|
||||
public boolean canInsert( final ItemStack stack )
|
||||
{
|
||||
IAEItemStack out = this.destination.injectItems( AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE, null );
|
||||
final IAEItemStack out = this.destination.injectItems( AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE, null );
|
||||
if( out == null )
|
||||
{
|
||||
return true;
|
||||
@@ -500,7 +500,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.items.setInternal( this.gridProxy.getStorage().getItemInventory() );
|
||||
this.fluids.setInternal( this.gridProxy.getStorage().getFluidInventory() );
|
||||
}
|
||||
catch( GridAccessException gae )
|
||||
catch( final GridAccessException gae )
|
||||
{
|
||||
this.items.setInternal( new NullInventory<IAEItemStack>() );
|
||||
this.fluids.setInternal( new NullInventory<IAEFluidStack>() );
|
||||
@@ -509,7 +509,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.notifyNeighbors();
|
||||
}
|
||||
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( final ForgeDirection dir )
|
||||
{
|
||||
return AECableType.SMART;
|
||||
}
|
||||
@@ -532,19 +532,19 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getAccessibleSlotsFromSide( int side )
|
||||
public int[] getAccessibleSlotsFromSide( final int side )
|
||||
{
|
||||
return this.sides;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest( IGridNode node )
|
||||
public TickingRequest getTickingRequest( final IGridNode node )
|
||||
{
|
||||
return new TickingRequest( TickRates.Interface.min, TickRates.Interface.max, !this.hasWorkToDo(), true );
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest( IGridNode node, int ticksSinceLastCall )
|
||||
public TickRateModulation tickingRequest( final IGridNode node, final int ticksSinceLastCall )
|
||||
{
|
||||
if( !this.gridProxy.isActive() )
|
||||
{
|
||||
@@ -556,37 +556,37 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.pushItemsOut( this.iHost.getTargets() );
|
||||
}
|
||||
|
||||
boolean couldDoWork = this.updateStorage();
|
||||
final boolean couldDoWork = this.updateStorage();
|
||||
return this.hasWorkToDo() ? ( couldDoWork ? TickRateModulation.URGENT : TickRateModulation.SLOWER ) : TickRateModulation.SLEEP;
|
||||
}
|
||||
|
||||
private void pushItemsOut( EnumSet<ForgeDirection> possibleDirections )
|
||||
private void pushItemsOut( final EnumSet<ForgeDirection> possibleDirections )
|
||||
{
|
||||
if( !this.hasItemsToSend() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity tile = this.iHost.getTileEntity();
|
||||
World w = tile.getWorldObj();
|
||||
final TileEntity tile = this.iHost.getTileEntity();
|
||||
final World w = tile.getWorldObj();
|
||||
|
||||
Iterator<ItemStack> i = this.waitingToSend.iterator();
|
||||
final Iterator<ItemStack> i = this.waitingToSend.iterator();
|
||||
while( i.hasNext() )
|
||||
{
|
||||
ItemStack whatToSend = i.next();
|
||||
|
||||
for( ForgeDirection s : possibleDirections )
|
||||
for( final ForgeDirection s : possibleDirections )
|
||||
{
|
||||
TileEntity te = w.getTileEntity( tile.xCoord + s.offsetX, tile.yCoord + s.offsetY, tile.zCoord + s.offsetZ );
|
||||
final TileEntity te = w.getTileEntity( tile.xCoord + s.offsetX, tile.yCoord + s.offsetY, tile.zCoord + s.offsetZ );
|
||||
if( te == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
|
||||
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
|
||||
if( ad != null )
|
||||
{
|
||||
ItemStack Result = ad.addItems( whatToSend );
|
||||
final ItemStack Result = ad.addItems( whatToSend );
|
||||
|
||||
if( Result == null )
|
||||
{
|
||||
@@ -631,16 +631,16 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
return didSomething;
|
||||
}
|
||||
|
||||
private boolean usePlan( int x, IAEItemStack itemStack )
|
||||
private boolean usePlan( final int x, final IAEItemStack itemStack )
|
||||
{
|
||||
InventoryAdaptor adaptor = this.getAdaptor( x );
|
||||
final InventoryAdaptor adaptor = this.getAdaptor( x );
|
||||
this.isWorking = true;
|
||||
|
||||
boolean changed = false;
|
||||
try
|
||||
{
|
||||
this.destination = this.gridProxy.getStorage().getItemInventory();
|
||||
IEnergySource src = this.gridProxy.getEnergy();
|
||||
final IEnergySource src = this.gridProxy.getEnergy();
|
||||
|
||||
if( this.craftingTracker.isBusy( x ) )
|
||||
{
|
||||
@@ -655,11 +655,11 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
throw new GridAccessException();
|
||||
}
|
||||
|
||||
IAEItemStack acquired = Platform.poweredExtraction( src, this.destination, itemStack, this.interfaceRequestSource );
|
||||
final IAEItemStack acquired = Platform.poweredExtraction( src, this.destination, itemStack, this.interfaceRequestSource );
|
||||
if( acquired != null )
|
||||
{
|
||||
changed = true;
|
||||
ItemStack issue = adaptor.addItems( acquired.getItemStack() );
|
||||
final ItemStack issue = adaptor.addItems( acquired.getItemStack() );
|
||||
if( issue != null )
|
||||
{
|
||||
throw new IllegalStateException( "bad attempt at managing inventory. ( addItems )" );
|
||||
@@ -678,7 +678,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
long diff = toStore.getStackSize();
|
||||
|
||||
// make sure strange things didn't happen...
|
||||
ItemStack canExtract = adaptor.simulateRemove( (int) diff, toStore.getItemStack(), null );
|
||||
final ItemStack canExtract = adaptor.simulateRemove( (int) diff, toStore.getItemStack(), null );
|
||||
if( canExtract == null || canExtract.stackSize != diff )
|
||||
{
|
||||
changed = true;
|
||||
@@ -696,7 +696,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
// extract items!
|
||||
changed = true;
|
||||
ItemStack removed = adaptor.removeItems( (int) diff, null, null );
|
||||
final ItemStack removed = adaptor.removeItems( (int) diff, null, null );
|
||||
if( removed == null )
|
||||
{
|
||||
throw new IllegalStateException( "bad attempt at managing inventory. ( removeItems )" );
|
||||
@@ -709,7 +709,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
// else wtf?
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
@@ -723,12 +723,12 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
return changed;
|
||||
}
|
||||
|
||||
private InventoryAdaptor getAdaptor( int slot )
|
||||
private InventoryAdaptor getAdaptor( final int slot )
|
||||
{
|
||||
return new AdaptorIInventory( this.slotInv.getWrapper( slot ) );
|
||||
}
|
||||
|
||||
private boolean handleCrafting( int x, InventoryAdaptor d, IAEItemStack itemStack )
|
||||
private boolean handleCrafting( final int x, final InventoryAdaptor d, final IAEItemStack itemStack )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -737,7 +737,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
return this.craftingTracker.handleCrafting( x, itemStack.getStackSize(), itemStack, d, this.iHost.getTileEntity().getWorldObj(), this.gridProxy.getGrid(), this.gridProxy.getCrafting(), this.mySource );
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
@@ -746,7 +746,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInstalledUpgrades( Upgrades u )
|
||||
public int getInstalledUpgrades( final Upgrades u )
|
||||
{
|
||||
if( this.upgrades == null )
|
||||
{
|
||||
@@ -778,7 +778,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName( String name )
|
||||
public IInventory getInventoryByName( final String name )
|
||||
{
|
||||
if( name.equals( "storage" ) )
|
||||
{
|
||||
@@ -815,7 +815,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
|
||||
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
|
||||
{
|
||||
if( this.getInstalledUpgrades( Upgrades.CRAFTING ) == 0 )
|
||||
{
|
||||
@@ -841,7 +841,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.craftingTracker.cancel();
|
||||
}
|
||||
|
||||
public IStorageMonitorable getMonitorable( ForgeDirection side, BaseActionSource src, IStorageMonitorable myInterface )
|
||||
public IStorageMonitorable getMonitorable( final ForgeDirection side, final BaseActionSource src, final IStorageMonitorable myInterface )
|
||||
{
|
||||
if( Platform.canAccess( this.gridProxy, src ) )
|
||||
{
|
||||
@@ -868,20 +868,20 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pushPattern( ICraftingPatternDetails patternDetails, InventoryCrafting table )
|
||||
public boolean pushPattern( final ICraftingPatternDetails patternDetails, final InventoryCrafting table )
|
||||
{
|
||||
if( this.hasItemsToSend() || !this.gridProxy.isActive() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntity tile = this.iHost.getTileEntity();
|
||||
World w = tile.getWorldObj();
|
||||
final TileEntity tile = this.iHost.getTileEntity();
|
||||
final World w = tile.getWorldObj();
|
||||
|
||||
EnumSet<ForgeDirection> possibleDirections = this.iHost.getTargets();
|
||||
for( ForgeDirection s : possibleDirections )
|
||||
final EnumSet<ForgeDirection> possibleDirections = this.iHost.getTargets();
|
||||
for( final ForgeDirection s : possibleDirections )
|
||||
{
|
||||
TileEntity te = w.getTileEntity( tile.xCoord + s.offsetX, tile.yCoord + s.offsetY, tile.zCoord + s.offsetZ );
|
||||
final TileEntity te = w.getTileEntity( tile.xCoord + s.offsetX, tile.yCoord + s.offsetY, tile.zCoord + s.offsetZ );
|
||||
if( te instanceof IInterfaceHost )
|
||||
{
|
||||
try
|
||||
@@ -891,7 +891,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
continue;
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -899,7 +899,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
if( te instanceof ICraftingMachine )
|
||||
{
|
||||
ICraftingMachine cm = (ICraftingMachine) te;
|
||||
final ICraftingMachine cm = (ICraftingMachine) te;
|
||||
if( cm.acceptsPlans() )
|
||||
{
|
||||
if( cm.pushPattern( patternDetails, table, s.getOpposite() ) )
|
||||
@@ -910,7 +910,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
|
||||
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
|
||||
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
|
||||
if( ad != null )
|
||||
{
|
||||
if( this.isBlocking() )
|
||||
@@ -925,7 +925,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
for( int x = 0; x < table.getSizeInventory(); x++ )
|
||||
{
|
||||
ItemStack is = table.getStackInSlot( x );
|
||||
final ItemStack is = table.getStackInSlot( x );
|
||||
if( is != null )
|
||||
{
|
||||
final ItemStack added = ad.addItems( is );
|
||||
@@ -953,17 +953,17 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
if( this.isBlocking() )
|
||||
{
|
||||
EnumSet<ForgeDirection> possibleDirections = this.iHost.getTargets();
|
||||
TileEntity tile = this.iHost.getTileEntity();
|
||||
World w = tile.getWorldObj();
|
||||
final EnumSet<ForgeDirection> possibleDirections = this.iHost.getTargets();
|
||||
final TileEntity tile = this.iHost.getTileEntity();
|
||||
final World w = tile.getWorldObj();
|
||||
|
||||
boolean allAreBusy = true;
|
||||
|
||||
for( ForgeDirection s : possibleDirections )
|
||||
for( final ForgeDirection s : possibleDirections )
|
||||
{
|
||||
TileEntity te = w.getTileEntity( tile.xCoord + s.offsetX, tile.yCoord + s.offsetY, tile.zCoord + s.offsetZ );
|
||||
final TileEntity te = w.getTileEntity( tile.xCoord + s.offsetX, tile.yCoord + s.offsetY, tile.zCoord + s.offsetZ );
|
||||
|
||||
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
|
||||
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
|
||||
if( ad != null )
|
||||
{
|
||||
if( ad.simulateRemove( 1, null, null ) == null )
|
||||
@@ -980,7 +980,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
return busy;
|
||||
}
|
||||
|
||||
private boolean sameGrid( IGrid grid ) throws GridAccessException
|
||||
private boolean sameGrid( final IGrid grid ) throws GridAccessException
|
||||
{
|
||||
return grid == this.gridProxy.getGrid();
|
||||
}
|
||||
@@ -990,11 +990,11 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
return this.cm.getSetting( Settings.BLOCK ) == YesNo.YES;
|
||||
}
|
||||
|
||||
private boolean acceptsItems( InventoryAdaptor ad, InventoryCrafting table )
|
||||
private boolean acceptsItems( final InventoryAdaptor ad, final InventoryCrafting table )
|
||||
{
|
||||
for( int x = 0; x < table.getSizeInventory(); x++ )
|
||||
{
|
||||
ItemStack is = table.getStackInSlot( x );
|
||||
final ItemStack is = table.getStackInSlot( x );
|
||||
if( is == null )
|
||||
{
|
||||
continue;
|
||||
@@ -1010,11 +1010,11 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideCrafting( ICraftingProviderHelper craftingTracker )
|
||||
public void provideCrafting( final ICraftingProviderHelper craftingTracker )
|
||||
{
|
||||
if( this.gridProxy.isActive() && this.craftingList != null )
|
||||
{
|
||||
for( ICraftingPatternDetails details : this.craftingList )
|
||||
for( final ICraftingPatternDetails details : this.craftingList )
|
||||
{
|
||||
details.setPriority( this.priority );
|
||||
craftingTracker.addCraftingOption( this, details );
|
||||
@@ -1022,11 +1022,11 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
|
||||
public void addDrops( List<ItemStack> drops )
|
||||
public void addDrops( final List<ItemStack> drops )
|
||||
{
|
||||
if( this.waitingToSend != null )
|
||||
{
|
||||
for( ItemStack is : this.waitingToSend )
|
||||
for( final ItemStack is : this.waitingToSend )
|
||||
{
|
||||
if( is != null )
|
||||
{
|
||||
@@ -1035,7 +1035,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
|
||||
for( ItemStack is : this.upgrades )
|
||||
for( final ItemStack is : this.upgrades )
|
||||
{
|
||||
if( is != null )
|
||||
{
|
||||
@@ -1043,7 +1043,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
|
||||
for( ItemStack is : this.storage )
|
||||
for( final ItemStack is : this.storage )
|
||||
{
|
||||
if( is != null )
|
||||
{
|
||||
@@ -1051,7 +1051,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
|
||||
for( ItemStack is : this.patterns )
|
||||
for( final ItemStack is : this.patterns )
|
||||
{
|
||||
if( is != null )
|
||||
{
|
||||
@@ -1083,13 +1083,13 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
return this.craftingTracker.getRequestedJobs();
|
||||
}
|
||||
|
||||
public IAEItemStack injectCraftedItems( ICraftingLink link, IAEItemStack acquired, Actionable mode )
|
||||
public IAEItemStack injectCraftedItems( final ICraftingLink link, final IAEItemStack acquired, final Actionable mode )
|
||||
{
|
||||
int slot = this.craftingTracker.getSlot( link );
|
||||
final int slot = this.craftingTracker.getSlot( link );
|
||||
|
||||
if( acquired != null && slot >= 0 && slot <= this.requireWork.length )
|
||||
{
|
||||
InventoryAdaptor adaptor = this.getAdaptor( slot );
|
||||
final InventoryAdaptor adaptor = this.getAdaptor( slot );
|
||||
|
||||
if( mode == Actionable.SIMULATE )
|
||||
{
|
||||
@@ -1097,7 +1097,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
else
|
||||
{
|
||||
IAEItemStack is = AEItemStack.create( adaptor.addItems( acquired.getItemStack() ) );
|
||||
final IAEItemStack is = AEItemStack.create( adaptor.addItems( acquired.getItemStack() ) );
|
||||
this.updatePlan( slot );
|
||||
return is;
|
||||
}
|
||||
@@ -1106,7 +1106,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
return acquired;
|
||||
}
|
||||
|
||||
public void jobStateChange( ICraftingLink link )
|
||||
public void jobStateChange( final ICraftingLink link )
|
||||
{
|
||||
this.craftingTracker.jobStateChange( link );
|
||||
}
|
||||
@@ -1122,7 +1122,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
final EnumSet<ForgeDirection> possibleDirections = this.iHost.getTargets();
|
||||
for( ForgeDirection direction : possibleDirections )
|
||||
for( final ForgeDirection direction : possibleDirections )
|
||||
{
|
||||
final int xPos = hostTile.xCoord + direction.offsetX;
|
||||
final int yPos = hostTile.yCoord + direction.offsetY;
|
||||
@@ -1143,7 +1143,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
continue;
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -1159,7 +1159,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
if( directedTile instanceof ISidedInventory )
|
||||
{
|
||||
int[] sides = ( (ISidedInventory) directedTile ).getAccessibleSlotsFromSide( direction.getOpposite().ordinal() );
|
||||
final int[] sides = ( (ISidedInventory) directedTile ).getAccessibleSlotsFromSide( direction.getOpposite().ordinal() );
|
||||
|
||||
if( sides == null || sides.length == 0 )
|
||||
{
|
||||
@@ -1173,13 +1173,13 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
Vec3 from = Vec3.createVectorHelper( hostTile.xCoord + 0.5, hostTile.yCoord + 0.5, hostTile.zCoord + 0.5 );
|
||||
from = from.addVector( direction.offsetX * 0.501, direction.offsetY * 0.501, direction.offsetZ * 0.501 );
|
||||
Vec3 to = from.addVector( direction.offsetX, direction.offsetY, direction.offsetZ );
|
||||
MovingObjectPosition mop = hostWorld.rayTraceBlocks( from, to, true );
|
||||
final Vec3 to = from.addVector( direction.offsetX, direction.offsetY, direction.offsetZ );
|
||||
final MovingObjectPosition mop = hostWorld.rayTraceBlocks( from, to, true );
|
||||
if( mop != null && !BAD_BLOCKS.contains( directedBlock ) )
|
||||
{
|
||||
if( mop.blockX == directedTile.xCoord && mop.blockY == directedTile.yCoord && mop.blockZ == directedTile.zCoord )
|
||||
{
|
||||
ItemStack g = directedBlock.getPickBlock( mop, hostWorld, directedTile.xCoord, directedTile.yCoord, directedTile.zCoord, null );
|
||||
final ItemStack g = directedBlock.getPickBlock( mop, hostWorld, directedTile.xCoord, directedTile.yCoord, directedTile.zCoord, null );
|
||||
if( g != null )
|
||||
{
|
||||
what = g;
|
||||
@@ -1187,7 +1187,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( Throwable t )
|
||||
catch( final Throwable t )
|
||||
{
|
||||
BAD_BLOCKS.add( directedBlock ); // nope!
|
||||
}
|
||||
@@ -1197,7 +1197,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
return what.getUnlocalizedName();
|
||||
}
|
||||
|
||||
Item item = Item.getItemFromBlock( directedBlock );
|
||||
final Item item = Item.getItemFromBlock( directedBlock );
|
||||
if( item == null )
|
||||
{
|
||||
return directedBlock.getUnlocalizedName();
|
||||
@@ -1210,7 +1210,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
public long getSortValue()
|
||||
{
|
||||
TileEntity te = this.iHost.getTileEntity();
|
||||
final TileEntity te = this.iHost.getTileEntity();
|
||||
return ( te.zCoord << 24 ) ^ ( te.xCoord << 8 ) ^ te.yCoord;
|
||||
}
|
||||
|
||||
@@ -1226,7 +1226,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPriority( int newValue )
|
||||
public void setPriority( final int newValue )
|
||||
{
|
||||
this.priority = newValue;
|
||||
this.markDirty();
|
||||
@@ -1235,7 +1235,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
this.gridProxy.getGrid().postEvent( new MENetworkCraftingPatternChange( this, this.gridProxy.getNode() ) );
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
@@ -1244,7 +1244,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
private class InterfaceRequestSource extends MachineSource
|
||||
{
|
||||
|
||||
public InterfaceRequestSource( IActionHost v )
|
||||
public InterfaceRequestSource( final IActionHost v )
|
||||
{
|
||||
super( v );
|
||||
}
|
||||
@@ -1254,14 +1254,14 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
private class InterfaceInventory extends MEMonitorIInventory
|
||||
{
|
||||
|
||||
public InterfaceInventory( DualityInterface tileInterface )
|
||||
public InterfaceInventory( final DualityInterface tileInterface )
|
||||
{
|
||||
super( new AdaptorIInventory( tileInterface.storage ) );
|
||||
this.mySource = new MachineSource( DualityInterface.this.iHost );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems( IAEItemStack input, Actionable type, BaseActionSource src )
|
||||
public IAEItemStack injectItems( final IAEItemStack input, final Actionable type, final BaseActionSource src )
|
||||
{
|
||||
if( src instanceof InterfaceRequestSource )
|
||||
{
|
||||
@@ -1272,7 +1272,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems( IAEItemStack request, Actionable type, BaseActionSource src )
|
||||
public IAEItemStack extractItems( final IAEItemStack request, final Actionable type, final BaseActionSource src )
|
||||
{
|
||||
if( src instanceof InterfaceRequestSource )
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ public class LocationRotation implements IOrientable
|
||||
final int y;
|
||||
final int z;
|
||||
|
||||
public LocationRotation( IBlockAccess world, int x, int y, int z )
|
||||
public LocationRotation( final IBlockAccess world, final int x, final int y, final int z )
|
||||
{
|
||||
this.w = world;
|
||||
this.x = x;
|
||||
@@ -60,12 +60,12 @@ public class LocationRotation implements IOrientable
|
||||
@Override
|
||||
public ForgeDirection getUp()
|
||||
{
|
||||
int num = Math.abs( this.x + this.y + this.z ) % 6;
|
||||
final int num = Math.abs( this.x + this.y + this.z ) % 6;
|
||||
return ForgeDirection.getOrientation( num );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation( ForgeDirection forward, ForgeDirection up )
|
||||
public void setOrientation( final ForgeDirection forward, final ForgeDirection up )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class MetaRotation implements IOrientable
|
||||
final int y;
|
||||
final int z;
|
||||
|
||||
public MetaRotation( IBlockAccess world, int x, int y, int z )
|
||||
public MetaRotation( final IBlockAccess world, final int x, final int y, final int z )
|
||||
{
|
||||
this.w = world;
|
||||
this.x = x;
|
||||
@@ -65,7 +65,7 @@ public class MetaRotation implements IOrientable
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation( ForgeDirection forward, ForgeDirection up )
|
||||
public void setOrientation( final ForgeDirection forward, final ForgeDirection up )
|
||||
{
|
||||
if( this.w instanceof World )
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ public class MultiCraftingTracker
|
||||
private ICraftingLink[] links = null;
|
||||
private int failedCraftingAttempts = 0;
|
||||
|
||||
public MultiCraftingTracker( ICraftingRequester o, int size )
|
||||
public MultiCraftingTracker( final ICraftingRequester o, final int size )
|
||||
{
|
||||
this.owner = o;
|
||||
this.size = size;
|
||||
@@ -59,7 +59,7 @@ public class MultiCraftingTracker
|
||||
return failedCraftingAttempts;
|
||||
}
|
||||
|
||||
public void readFromNBT( NBTTagCompound extra )
|
||||
public void readFromNBT( final NBTTagCompound extra )
|
||||
{
|
||||
for( int x = 0; x < this.size; x++ )
|
||||
{
|
||||
@@ -72,7 +72,7 @@ public class MultiCraftingTracker
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT( NBTTagCompound extra )
|
||||
public void writeToNBT( final NBTTagCompound extra )
|
||||
{
|
||||
for( int x = 0; x < this.size; x++ )
|
||||
{
|
||||
@@ -87,7 +87,7 @@ public class MultiCraftingTracker
|
||||
}
|
||||
}
|
||||
|
||||
public boolean handleCrafting( int x, long itemToCraft, IAEItemStack ais, InventoryAdaptor d, World w, IGrid g, ICraftingGrid cg, BaseActionSource mySrc )
|
||||
public boolean handleCrafting( final int x, final long itemToCraft, final IAEItemStack ais, final InventoryAdaptor d, final World w, final IGrid g, final ICraftingGrid cg, final BaseActionSource mySrc )
|
||||
{
|
||||
if( ais != null && d.simulateAdd( ais.getItemStack() ) == null )
|
||||
{
|
||||
@@ -126,11 +126,11 @@ public class MultiCraftingTracker
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch( InterruptedException e )
|
||||
catch( final InterruptedException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
catch( ExecutionException e )
|
||||
catch( final ExecutionException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
@@ -159,7 +159,7 @@ public class MultiCraftingTracker
|
||||
return ImmutableSet.copyOf( new NonNullArrayIterator<ICraftingLink>( this.links ) );
|
||||
}
|
||||
|
||||
public void jobStateChange( ICraftingLink link )
|
||||
public void jobStateChange( final ICraftingLink link )
|
||||
{
|
||||
if( this.links != null )
|
||||
{
|
||||
@@ -174,7 +174,7 @@ public class MultiCraftingTracker
|
||||
}
|
||||
}
|
||||
|
||||
public int getSlot( ICraftingLink link )
|
||||
public int getSlot( final ICraftingLink link )
|
||||
{
|
||||
if( this.links != null )
|
||||
{
|
||||
@@ -194,7 +194,7 @@ public class MultiCraftingTracker
|
||||
{
|
||||
if( this.links != null )
|
||||
{
|
||||
for( ICraftingLink l : this.links )
|
||||
for( final ICraftingLink l : this.links )
|
||||
{
|
||||
if( l != null )
|
||||
{
|
||||
@@ -207,7 +207,7 @@ public class MultiCraftingTracker
|
||||
|
||||
if( this.jobs != null )
|
||||
{
|
||||
for( Future<ICraftingJob> l : this.jobs )
|
||||
for( final Future<ICraftingJob> l : this.jobs )
|
||||
{
|
||||
if( l != null )
|
||||
{
|
||||
@@ -219,12 +219,12 @@ public class MultiCraftingTracker
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isBusy( int slot )
|
||||
public boolean isBusy( final int slot )
|
||||
{
|
||||
return this.getLink( slot ) != null || this.getJob( slot ) != null;
|
||||
}
|
||||
|
||||
private ICraftingLink getLink( int slot )
|
||||
private ICraftingLink getLink( final int slot )
|
||||
{
|
||||
if( this.links == null )
|
||||
{
|
||||
@@ -234,7 +234,7 @@ public class MultiCraftingTracker
|
||||
return this.links[slot];
|
||||
}
|
||||
|
||||
private void setLink( int slot, ICraftingLink l )
|
||||
private void setLink( final int slot, final ICraftingLink l )
|
||||
{
|
||||
if( this.links == null )
|
||||
{
|
||||
@@ -264,7 +264,7 @@ public class MultiCraftingTracker
|
||||
}
|
||||
}
|
||||
|
||||
private Future<ICraftingJob> getJob( int slot )
|
||||
private Future<ICraftingJob> getJob( final int slot )
|
||||
{
|
||||
if( this.jobs == null )
|
||||
{
|
||||
@@ -274,7 +274,7 @@ public class MultiCraftingTracker
|
||||
return this.jobs[slot];
|
||||
}
|
||||
|
||||
private void setJob( int slot, Future<ICraftingJob> l )
|
||||
private void setJob( final int slot, final Future<ICraftingJob> l )
|
||||
{
|
||||
if( this.jobs == null )
|
||||
{
|
||||
@@ -285,7 +285,7 @@ public class MultiCraftingTracker
|
||||
|
||||
boolean hasStuff = false;
|
||||
|
||||
for( Future<ICraftingJob> job : this.jobs )
|
||||
for( final Future<ICraftingJob> job : this.jobs )
|
||||
{
|
||||
if( job != null )
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ public class NonNullArrayIterator<E> implements Iterator<E>
|
||||
private final E[] g;
|
||||
private int offset = 0;
|
||||
|
||||
public NonNullArrayIterator( E[] o )
|
||||
public NonNullArrayIterator( final E[] o )
|
||||
{
|
||||
this.g = o;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class NullRotation implements IOrientable
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation( ForgeDirection forward, ForgeDirection up )
|
||||
public void setOrientation( final ForgeDirection forward, final ForgeDirection up )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -60,27 +60,27 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
private final IAEItemStack pattern;
|
||||
public int priority = 0;
|
||||
|
||||
public PatternHelper( ItemStack is, World w )
|
||||
public PatternHelper( final ItemStack is, final World w )
|
||||
{
|
||||
NBTTagCompound encodedValue = is.getTagCompound();
|
||||
final NBTTagCompound encodedValue = is.getTagCompound();
|
||||
|
||||
if( encodedValue == null )
|
||||
{
|
||||
throw new IllegalArgumentException( "No pattern here!" );
|
||||
}
|
||||
|
||||
NBTTagList inTag = encodedValue.getTagList( "in", 10 );
|
||||
NBTTagList outTag = encodedValue.getTagList( "out", 10 );
|
||||
final NBTTagList inTag = encodedValue.getTagList( "in", 10 );
|
||||
final NBTTagList outTag = encodedValue.getTagList( "out", 10 );
|
||||
this.isCrafting = encodedValue.getBoolean( "crafting" );
|
||||
this.patternItem = is;
|
||||
this.pattern = AEItemStack.create( is );
|
||||
|
||||
List<IAEItemStack> in = new ArrayList<IAEItemStack>();
|
||||
List<IAEItemStack> out = new ArrayList<IAEItemStack>();
|
||||
final List<IAEItemStack> in = new ArrayList<IAEItemStack>();
|
||||
final List<IAEItemStack> out = new ArrayList<IAEItemStack>();
|
||||
|
||||
for( int x = 0; x < inTag.tagCount(); x++ )
|
||||
{
|
||||
ItemStack gs = ItemStack.loadItemStackFromNBT( inTag.getCompoundTagAt( x ) );
|
||||
final ItemStack gs = ItemStack.loadItemStackFromNBT( inTag.getCompoundTagAt( x ) );
|
||||
this.crafting.setInventorySlotContents( x, gs );
|
||||
|
||||
if( gs != null && ( !this.isCrafting || !gs.hasTagCompound() ) )
|
||||
@@ -112,7 +112,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
|
||||
for( int x = 0; x < outTag.tagCount(); x++ )
|
||||
{
|
||||
ItemStack gs = ItemStack.loadItemStackFromNBT( outTag.getCompoundTagAt( x ) );
|
||||
final ItemStack gs = ItemStack.loadItemStackFromNBT( outTag.getCompoundTagAt( x ) );
|
||||
if( gs != null )
|
||||
{
|
||||
out.add( AEApi.instance().storage().createItemStack( gs ) );
|
||||
@@ -123,15 +123,15 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
this.outputs = out.toArray( new IAEItemStack[out.size()] );
|
||||
this.inputs = in.toArray( new IAEItemStack[in.size()] );
|
||||
|
||||
HashMap<IAEItemStack, IAEItemStack> tmpOutputs = new HashMap<IAEItemStack, IAEItemStack>();
|
||||
for( IAEItemStack io : this.outputs )
|
||||
final HashMap<IAEItemStack, IAEItemStack> tmpOutputs = new HashMap<IAEItemStack, IAEItemStack>();
|
||||
for( final IAEItemStack io : this.outputs )
|
||||
{
|
||||
if( io == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
IAEItemStack g = tmpOutputs.get( io );
|
||||
final IAEItemStack g = tmpOutputs.get( io );
|
||||
if( g == null )
|
||||
{
|
||||
tmpOutputs.put( io, io.copy() );
|
||||
@@ -142,15 +142,15 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<IAEItemStack, IAEItemStack> tmpInputs = new HashMap<IAEItemStack, IAEItemStack>();
|
||||
for( IAEItemStack io : this.inputs )
|
||||
final HashMap<IAEItemStack, IAEItemStack> tmpInputs = new HashMap<IAEItemStack, IAEItemStack>();
|
||||
for( final IAEItemStack io : this.inputs )
|
||||
{
|
||||
if( io == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
IAEItemStack g = tmpInputs.get( io );
|
||||
final IAEItemStack g = tmpInputs.get( io );
|
||||
if( g == null )
|
||||
{
|
||||
tmpInputs.put( io, io.copy() );
|
||||
@@ -168,7 +168,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
|
||||
this.condensedInputs = new IAEItemStack[tmpInputs.size()];
|
||||
int offset = 0;
|
||||
for( IAEItemStack io : tmpInputs.values() )
|
||||
for( final IAEItemStack io : tmpInputs.values() )
|
||||
{
|
||||
this.condensedInputs[offset] = io;
|
||||
offset++;
|
||||
@@ -176,14 +176,14 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
|
||||
offset = 0;
|
||||
this.condensedOutputs = new IAEItemStack[tmpOutputs.size()];
|
||||
for( IAEItemStack io : tmpOutputs.values() )
|
||||
for( final IAEItemStack io : tmpOutputs.values() )
|
||||
{
|
||||
this.condensedOutputs[offset] = io;
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
|
||||
private void markItemAs( int slotIndex, ItemStack i, TestStatus b )
|
||||
private void markItemAs( final int slotIndex, final ItemStack i, final TestStatus b )
|
||||
{
|
||||
if( b == TestStatus.TEST || i.hasTagCompound() )
|
||||
{
|
||||
@@ -200,14 +200,14 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isValidItemForSlot( int slotIndex, ItemStack i, World w )
|
||||
public synchronized boolean isValidItemForSlot( final int slotIndex, final ItemStack i, final World w )
|
||||
{
|
||||
if( !this.isCrafting )
|
||||
{
|
||||
throw new IllegalStateException( "Only crafting recipes supported." );
|
||||
}
|
||||
|
||||
TestStatus result = this.getStatus( slotIndex, i );
|
||||
final TestStatus result = this.getStatus( slotIndex, i );
|
||||
|
||||
switch( result )
|
||||
{
|
||||
@@ -229,7 +229,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
|
||||
if( this.standardRecipe.matches( this.testFrame, w ) )
|
||||
{
|
||||
ItemStack testOutput = this.standardRecipe.getCraftingResult( this.testFrame );
|
||||
final ItemStack testOutput = this.standardRecipe.getCraftingResult( this.testFrame );
|
||||
|
||||
if( Platform.isSameItemPrecise( this.correctOutput, testOutput ) )
|
||||
{
|
||||
@@ -240,7 +240,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemStack testOutput = CraftingManager.getInstance().findMatchingRecipe( this.testFrame, w );
|
||||
final ItemStack testOutput = CraftingManager.getInstance().findMatchingRecipe( this.testFrame, w );
|
||||
|
||||
if( Platform.isSameItemPrecise( this.correctOutput, testOutput ) )
|
||||
{
|
||||
@@ -291,7 +291,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getOutput( InventoryCrafting craftingInv, World w )
|
||||
public ItemStack getOutput( final InventoryCrafting craftingInv, final World w )
|
||||
{
|
||||
if( !this.isCrafting )
|
||||
{
|
||||
@@ -314,7 +314,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
return null;
|
||||
}
|
||||
|
||||
private TestStatus getStatus( int slotIndex, ItemStack i )
|
||||
private TestStatus getStatus( final int slotIndex, final ItemStack i )
|
||||
{
|
||||
if( this.crafting.getStackInSlot( slotIndex ) == null )
|
||||
{
|
||||
@@ -351,13 +351,13 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPriority( int priority )
|
||||
public void setPriority( final int priority )
|
||||
{
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo( PatternHelper o )
|
||||
public int compareTo( final PatternHelper o )
|
||||
{
|
||||
return ItemSorters.compareInt( o.priority, this.priority );
|
||||
}
|
||||
@@ -380,16 +380,16 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
final int ref;
|
||||
final int hash;
|
||||
|
||||
public TestLookup( int slot, ItemStack i )
|
||||
public TestLookup( final int slot, final ItemStack i )
|
||||
{
|
||||
this( slot, i.getItem(), i.getItemDamage() );
|
||||
}
|
||||
|
||||
public TestLookup( int slot, Item item, int dmg )
|
||||
public TestLookup( final int slot, final Item item, final int dmg )
|
||||
{
|
||||
this.slot = slot;
|
||||
this.ref = ( dmg << Platform.DEF_OFFSET ) | ( Item.getIdFromItem( item ) & 0xffff );
|
||||
int offset = 3 * slot;
|
||||
final int offset = 3 * slot;
|
||||
this.hash = ( this.ref << offset ) | ( this.ref >> ( offset + 32 ) );
|
||||
}
|
||||
|
||||
@@ -400,13 +400,13 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object obj )
|
||||
public boolean equals( final Object obj )
|
||||
{
|
||||
final boolean equality;
|
||||
|
||||
if( obj instanceof TestLookup )
|
||||
{
|
||||
TestLookup b = (TestLookup) obj;
|
||||
final TestLookup b = (TestLookup) obj;
|
||||
equality = b.slot == this.slot && b.ref == this.ref;
|
||||
}
|
||||
else
|
||||
@@ -419,7 +419,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object obj )
|
||||
public boolean equals( final Object obj )
|
||||
{
|
||||
if( obj == null )
|
||||
{
|
||||
@@ -429,7 +429,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
{
|
||||
return false;
|
||||
}
|
||||
PatternHelper other = (PatternHelper) obj;
|
||||
final PatternHelper other = (PatternHelper) obj;
|
||||
if( this.pattern != null && other.pattern != null )
|
||||
{
|
||||
return this.pattern.equals( other.pattern );
|
||||
|
||||
@@ -32,13 +32,13 @@ public class PlayerSecurityWrapper implements ISecurityRegistry
|
||||
|
||||
final Map<Integer, EnumSet<SecurityPermissions>> target;
|
||||
|
||||
public PlayerSecurityWrapper( HashMap<Integer, EnumSet<SecurityPermissions>> playerPerms )
|
||||
public PlayerSecurityWrapper( final HashMap<Integer, EnumSet<SecurityPermissions>> playerPerms )
|
||||
{
|
||||
this.target = playerPerms;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPlayer( int playerID, EnumSet<SecurityPermissions> permissions )
|
||||
public void addPlayer( final int playerID, final EnumSet<SecurityPermissions> permissions )
|
||||
{
|
||||
this.target.put( playerID, permissions );
|
||||
}
|
||||
|
||||
@@ -35,13 +35,13 @@ public class Splotch
|
||||
public final AEColor color;
|
||||
private final int pos;
|
||||
|
||||
public Splotch( AEColor col, boolean lit, ForgeDirection side, Vec3 position )
|
||||
public Splotch( final AEColor col, final boolean lit, final ForgeDirection side, final Vec3 position )
|
||||
{
|
||||
this.color = col;
|
||||
this.lumen = lit;
|
||||
|
||||
double x;
|
||||
double y;
|
||||
final double x;
|
||||
final double y;
|
||||
|
||||
if( side == ForgeDirection.SOUTH || side == ForgeDirection.NORTH )
|
||||
{
|
||||
@@ -61,28 +61,28 @@ public class Splotch
|
||||
y = position.zCoord;
|
||||
}
|
||||
|
||||
int a = (int) ( x * 0xF );
|
||||
int b = (int) ( y * 0xF );
|
||||
final int a = (int) ( x * 0xF );
|
||||
final int b = (int) ( y * 0xF );
|
||||
this.pos = a | ( b << 4 );
|
||||
|
||||
this.side = side;
|
||||
}
|
||||
|
||||
public Splotch( ByteBuf data )
|
||||
public Splotch( final ByteBuf data )
|
||||
{
|
||||
|
||||
this.pos = data.readByte();
|
||||
int val = data.readByte();
|
||||
final int val = data.readByte();
|
||||
|
||||
this.side = ForgeDirection.getOrientation( val & 0x07 );
|
||||
this.color = AEColor.values()[( val >> 3 ) & 0x0F];
|
||||
this.lumen = ( ( val >> 7 ) & 0x01 ) > 0;
|
||||
}
|
||||
|
||||
public void writeToStream( ByteBuf stream )
|
||||
public void writeToStream( final ByteBuf stream )
|
||||
{
|
||||
stream.writeByte( this.pos );
|
||||
int val = this.side.ordinal() | ( this.color.ordinal() << 3 ) | ( this.lumen ? 0x80 : 0x00 );
|
||||
final int val = this.side.ordinal() | ( this.color.ordinal() << 3 ) | ( this.lumen ? 0x80 : 0x00 );
|
||||
stream.writeByte( val );
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class Splotch
|
||||
|
||||
public int getSeed()
|
||||
{
|
||||
int val = this.side.ordinal() | ( this.color.ordinal() << 3 ) | ( this.lumen ? 0x80 : 0x00 );
|
||||
final int val = this.side.ordinal() | ( this.color.ordinal() << 3 ) | ( this.lumen ? 0x80 : 0x00 );
|
||||
return Math.abs( this.pos + val );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
double myRange = Double.MAX_VALUE;
|
||||
private final int inventorySlot;
|
||||
|
||||
public WirelessTerminalGuiObject( IWirelessTermHandler wh, ItemStack is, EntityPlayer ep, World w, int x, int y, int z )
|
||||
public WirelessTerminalGuiObject( final IWirelessTermHandler wh, final ItemStack is, final EntityPlayer ep, final World w, final int x, final int y, final int z )
|
||||
{
|
||||
this.encryptionKey = wh.getEncryptionKey( is );
|
||||
this.effectiveItem = is;
|
||||
@@ -79,17 +79,17 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
|
||||
try
|
||||
{
|
||||
long encKey = Long.parseLong( this.encryptionKey );
|
||||
final long encKey = Long.parseLong( this.encryptionKey );
|
||||
obj = AEApi.instance().registries().locatable().getLocatableBy( encKey );
|
||||
}
|
||||
catch( NumberFormatException err )
|
||||
catch( final NumberFormatException err )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
|
||||
if( obj instanceof IGridHost )
|
||||
{
|
||||
IGridNode n = ( (IGridHost) obj ).getGridNode( ForgeDirection.UNKNOWN );
|
||||
final IGridNode n = ( (IGridHost) obj ).getGridNode( ForgeDirection.UNKNOWN );
|
||||
if( n != null )
|
||||
{
|
||||
this.targetGrid = n.getGrid();
|
||||
@@ -131,7 +131,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener( IMEMonitorHandlerReceiver<IAEItemStack> l, Object verificationToken )
|
||||
public void addListener( final IMEMonitorHandlerReceiver<IAEItemStack> l, final Object verificationToken )
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
@@ -140,7 +140,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener( IMEMonitorHandlerReceiver<IAEItemStack> l )
|
||||
public void removeListener( final IMEMonitorHandlerReceiver<IAEItemStack> l )
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
@@ -149,7 +149,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getAvailableItems( IItemList out )
|
||||
public IItemList<IAEItemStack> getAvailableItems( final IItemList out )
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
@@ -179,7 +179,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrioritized( IAEItemStack input )
|
||||
public boolean isPrioritized( final IAEItemStack input )
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
@@ -189,7 +189,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAccept( IAEItemStack input )
|
||||
public boolean canAccept( final IAEItemStack input )
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
@@ -219,13 +219,13 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validForPass( int i )
|
||||
public boolean validForPass( final int i )
|
||||
{
|
||||
return this.itemStorage.validForPass( i );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems( IAEItemStack input, Actionable type, BaseActionSource src )
|
||||
public IAEItemStack injectItems( final IAEItemStack input, final Actionable type, final BaseActionSource src )
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
@@ -235,7 +235,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
|
||||
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final BaseActionSource src )
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
@@ -255,7 +255,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
}
|
||||
|
||||
@Override
|
||||
public double extractAEPower( double amt, Actionable mode, PowerMultiplier usePowerMultiplier )
|
||||
public double extractAEPower( final double amt, final Actionable mode, final PowerMultiplier usePowerMultiplier )
|
||||
{
|
||||
if( this.wth != null && this.effectiveItem != null )
|
||||
{
|
||||
@@ -281,13 +281,13 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode getGridNode( ForgeDirection dir )
|
||||
public IGridNode getGridNode( final ForgeDirection dir )
|
||||
{
|
||||
return this.getActionableNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( final ForgeDirection dir )
|
||||
{
|
||||
return AECableType.NONE;
|
||||
}
|
||||
@@ -327,13 +327,13 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
return false;
|
||||
}
|
||||
|
||||
IMachineSet tw = this.targetGrid.getMachines( TileWireless.class );
|
||||
final IMachineSet tw = this.targetGrid.getMachines( TileWireless.class );
|
||||
|
||||
this.myWap = null;
|
||||
|
||||
for( IGridNode n : tw )
|
||||
for( final IGridNode n : tw )
|
||||
{
|
||||
IWirelessAccessPoint wap = (IWirelessAccessPoint) n.getMachine();
|
||||
final IWirelessAccessPoint wap = (IWirelessAccessPoint) n.getMachine();
|
||||
if( this.testWap( wap ) )
|
||||
{
|
||||
this.myWap = wap;
|
||||
@@ -345,20 +345,20 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean testWap( IWirelessAccessPoint wap )
|
||||
private boolean testWap( final IWirelessAccessPoint wap )
|
||||
{
|
||||
double rangeLimit = wap.getRange();
|
||||
rangeLimit *= rangeLimit;
|
||||
|
||||
DimensionalCoord dc = wap.getLocation();
|
||||
final DimensionalCoord dc = wap.getLocation();
|
||||
|
||||
if( dc.getWorld() == this.myPlayer.worldObj )
|
||||
{
|
||||
double offX = dc.x - this.myPlayer.posX;
|
||||
double offY = dc.y - this.myPlayer.posY;
|
||||
double offZ = dc.z - this.myPlayer.posZ;
|
||||
final double offX = dc.x - this.myPlayer.posX;
|
||||
final double offY = dc.y - this.myPlayer.posY;
|
||||
final double offZ = dc.z - this.myPlayer.posZ;
|
||||
|
||||
double r = offX * offX + offY * offY + offZ * offZ;
|
||||
final double r = offX * offX + offY * offY + offZ * offZ;
|
||||
if( r < rangeLimit && this.sqRange > r )
|
||||
{
|
||||
if( wap.isActive() )
|
||||
|
||||
Reference in New Issue
Block a user