final variables and 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 );
|
||||
}
|
||||
|
||||
@@ -128,7 +128,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 );
|
||||
@@ -150,7 +150,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 )
|
||||
{
|
||||
@@ -167,11 +167,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 )
|
||||
{
|
||||
@@ -186,7 +186,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
@@ -194,7 +194,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" );
|
||||
@@ -204,12 +204,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 );
|
||||
}
|
||||
@@ -217,18 +217,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 );
|
||||
}
|
||||
}
|
||||
@@ -245,7 +245,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.updateCraftingList();
|
||||
}
|
||||
|
||||
public void addToSendList( ItemStack is )
|
||||
public void addToSendList( final ItemStack is )
|
||||
{
|
||||
if( is == null )
|
||||
{
|
||||
@@ -263,7 +263,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
@@ -273,7 +273,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 )
|
||||
{
|
||||
@@ -282,14 +282,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 )
|
||||
{
|
||||
@@ -304,7 +304,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
@@ -315,7 +315,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() );
|
||||
|
||||
@@ -326,15 +326,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;
|
||||
@@ -360,7 +360,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
|
||||
}
|
||||
@@ -371,7 +371,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 )
|
||||
@@ -380,11 +380,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;
|
||||
}
|
||||
@@ -407,7 +407,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;
|
||||
}
|
||||
@@ -427,20 +427,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.getWorld() != null )
|
||||
{
|
||||
Platform.notifyBlocksOfNeighbors( te.getWorld(), te.getPos() );
|
||||
}
|
||||
}
|
||||
|
||||
public void addToCraftingList( ItemStack is )
|
||||
public void addToCraftingList( final ItemStack is )
|
||||
{
|
||||
if( is == null )
|
||||
{
|
||||
@@ -449,8 +449,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().getWorld() );
|
||||
final ICraftingPatternItem cpi = (ICraftingPatternItem) is.getItem();
|
||||
final ICraftingPatternDetails details = cpi.getPatternForItem( is, this.iHost.getTileEntity().getWorld() );
|
||||
|
||||
if( details != null )
|
||||
{
|
||||
@@ -470,9 +470,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;
|
||||
@@ -501,7 +501,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>() );
|
||||
@@ -510,7 +510,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.notifyNeighbors();
|
||||
}
|
||||
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
public AECableType getCableConnectionType( final AEPartLocation dir )
|
||||
{
|
||||
return AECableType.SMART;
|
||||
}
|
||||
@@ -533,19 +533,19 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getSlotsForFace( EnumFacing side )
|
||||
public int[] getSlotsForFace( final EnumFacing 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() )
|
||||
{
|
||||
@@ -557,37 +557,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<EnumFacing> possibleDirections )
|
||||
private void pushItemsOut( final EnumSet<EnumFacing> possibleDirections )
|
||||
{
|
||||
if( !this.hasItemsToSend() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity tile = this.iHost.getTileEntity();
|
||||
World w = tile.getWorld();
|
||||
final TileEntity tile = this.iHost.getTileEntity();
|
||||
final World w = tile.getWorld();
|
||||
|
||||
Iterator<ItemStack> i = this.waitingToSend.iterator();
|
||||
final Iterator<ItemStack> i = this.waitingToSend.iterator();
|
||||
while( i.hasNext() )
|
||||
{
|
||||
ItemStack whatToSend = i.next();
|
||||
|
||||
for( EnumFacing s : possibleDirections )
|
||||
for( final EnumFacing s : possibleDirections )
|
||||
{
|
||||
TileEntity te = w.getTileEntity( tile.getPos().offset( s ) );
|
||||
final TileEntity te = w.getTileEntity( tile.getPos().offset( s ) );
|
||||
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 )
|
||||
{
|
||||
@@ -632,16 +632,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 ) )
|
||||
{
|
||||
@@ -656,11 +656,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 )" );
|
||||
@@ -679,7 +679,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;
|
||||
@@ -697,7 +697,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 )" );
|
||||
@@ -710,7 +710,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
// else wtf?
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
@@ -724,12 +724,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
|
||||
{
|
||||
@@ -738,7 +738,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
return this.craftingTracker.handleCrafting( x, itemStack.getStackSize(), itemStack, d, this.iHost.getTileEntity().getWorld(), this.gridProxy.getGrid(), this.gridProxy.getCrafting(), this.mySource );
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
@@ -747,7 +747,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInstalledUpgrades( Upgrades u )
|
||||
public int getInstalledUpgrades( final Upgrades u )
|
||||
{
|
||||
if( this.upgrades == null )
|
||||
{
|
||||
@@ -779,7 +779,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName( String name )
|
||||
public IInventory getInventoryByName( final String name )
|
||||
{
|
||||
if( name.equals( "storage" ) )
|
||||
{
|
||||
@@ -816,7 +816,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 )
|
||||
{
|
||||
@@ -842,7 +842,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.craftingTracker.cancel();
|
||||
}
|
||||
|
||||
public IStorageMonitorable getMonitorable( EnumFacing side, BaseActionSource src, IStorageMonitorable myInterface )
|
||||
public IStorageMonitorable getMonitorable( final EnumFacing side, final BaseActionSource src, final IStorageMonitorable myInterface )
|
||||
{
|
||||
if( Platform.canAccess( this.gridProxy, src ) )
|
||||
{
|
||||
@@ -869,20 +869,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.getWorld();
|
||||
final TileEntity tile = this.iHost.getTileEntity();
|
||||
final World w = tile.getWorld();
|
||||
|
||||
EnumSet<EnumFacing> possibleDirections = this.iHost.getTargets();
|
||||
for( EnumFacing s : possibleDirections )
|
||||
final EnumSet<EnumFacing> possibleDirections = this.iHost.getTargets();
|
||||
for( final EnumFacing s : possibleDirections )
|
||||
{
|
||||
TileEntity te = w.getTileEntity( tile.getPos().offset( s ) );
|
||||
final TileEntity te = w.getTileEntity( tile.getPos().offset( s ) );
|
||||
if( te instanceof IInterfaceHost )
|
||||
{
|
||||
try
|
||||
@@ -892,7 +892,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
continue;
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -900,7 +900,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() ) )
|
||||
@@ -911,7 +911,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() )
|
||||
@@ -926,7 +926,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 );
|
||||
@@ -954,17 +954,17 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
if( this.isBlocking() )
|
||||
{
|
||||
EnumSet<EnumFacing> possibleDirections = this.iHost.getTargets();
|
||||
TileEntity tile = this.iHost.getTileEntity();
|
||||
World w = tile.getWorld();
|
||||
final EnumSet<EnumFacing> possibleDirections = this.iHost.getTargets();
|
||||
final TileEntity tile = this.iHost.getTileEntity();
|
||||
final World w = tile.getWorld();
|
||||
|
||||
boolean allAreBusy = true;
|
||||
|
||||
for( EnumFacing s : possibleDirections )
|
||||
for( final EnumFacing s : possibleDirections )
|
||||
{
|
||||
TileEntity te = w.getTileEntity( tile.getPos().offset( s ) );
|
||||
final TileEntity te = w.getTileEntity( tile.getPos().offset( s ) );
|
||||
|
||||
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 )
|
||||
@@ -981,7 +981,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();
|
||||
}
|
||||
@@ -991,11 +991,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;
|
||||
@@ -1011,11 +1011,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 );
|
||||
@@ -1023,11 +1023,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 )
|
||||
{
|
||||
@@ -1036,7 +1036,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
|
||||
for( ItemStack is : this.upgrades )
|
||||
for( final ItemStack is : this.upgrades )
|
||||
{
|
||||
if( is != null )
|
||||
{
|
||||
@@ -1044,7 +1044,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
|
||||
for( ItemStack is : this.storage )
|
||||
for( final ItemStack is : this.storage )
|
||||
{
|
||||
if( is != null )
|
||||
{
|
||||
@@ -1052,7 +1052,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
|
||||
for( ItemStack is : this.patterns )
|
||||
for( final ItemStack is : this.patterns )
|
||||
{
|
||||
if( is != null )
|
||||
{
|
||||
@@ -1084,13 +1084,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 )
|
||||
{
|
||||
@@ -1098,7 +1098,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;
|
||||
}
|
||||
@@ -1107,7 +1107,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 );
|
||||
}
|
||||
@@ -1123,9 +1123,9 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
final EnumSet<EnumFacing> possibleDirections = this.iHost.getTargets();
|
||||
for( EnumFacing direction : possibleDirections )
|
||||
for( final EnumFacing direction : possibleDirections )
|
||||
{
|
||||
BlockPos targ = hostTile.getPos().offset( direction );
|
||||
final BlockPos targ = hostTile.getPos().offset( direction );
|
||||
final TileEntity directedTile = hostWorld.getTileEntity( targ );
|
||||
|
||||
if( directedTile == null )
|
||||
@@ -1142,7 +1142,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
continue;
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -1158,7 +1158,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
if( directedTile instanceof ISidedInventory )
|
||||
{
|
||||
int[] sides = ( (ISidedInventory) directedTile ).getSlotsForFace( direction.getOpposite() );
|
||||
final int[] sides = ( (ISidedInventory) directedTile ).getSlotsForFace( direction.getOpposite() );
|
||||
|
||||
if( sides == null || sides.length == 0 )
|
||||
{
|
||||
@@ -1172,13 +1172,13 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
Vec3 from = new Vec3( hostTile.getPos().getX() + 0.5, hostTile.getPos().getY() + 0.5, hostTile.getPos().getZ() + 0.5 );
|
||||
from = from.addVector( direction.getFrontOffsetX() * 0.501, direction.getFrontOffsetY() * 0.501, direction.getFrontOffsetZ() * 0.501 );
|
||||
Vec3 to = from.addVector( direction.getFrontOffsetX(), direction.getFrontOffsetY(), direction.getFrontOffsetZ() );
|
||||
MovingObjectPosition mop = hostWorld.rayTraceBlocks( from, to, true );
|
||||
final Vec3 to = from.addVector( direction.getFrontOffsetX(), direction.getFrontOffsetY(), direction.getFrontOffsetZ() );
|
||||
final MovingObjectPosition mop = hostWorld.rayTraceBlocks( from, to, true );
|
||||
if( mop != null && !BAD_BLOCKS.contains( directedBlock ) )
|
||||
{
|
||||
if( mop.getBlockPos().equals( directedTile.getPos() ) )
|
||||
{
|
||||
ItemStack g = directedBlock.getPickBlock( mop, hostWorld, directedTile.getPos() );
|
||||
final ItemStack g = directedBlock.getPickBlock( mop, hostWorld, directedTile.getPos() );
|
||||
if( g != null )
|
||||
{
|
||||
what = g;
|
||||
@@ -1186,7 +1186,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( Throwable t )
|
||||
catch( final Throwable t )
|
||||
{
|
||||
BAD_BLOCKS.add( directedBlock ); // nope!
|
||||
}
|
||||
@@ -1196,7 +1196,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();
|
||||
@@ -1209,7 +1209,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
public long getSortValue()
|
||||
{
|
||||
TileEntity te = this.iHost.getTileEntity();
|
||||
final TileEntity te = this.iHost.getTileEntity();
|
||||
return ( te.getPos().getZ() << 24 ) ^ ( te.getPos().getX() << 8 ) ^ te.getPos().getY();
|
||||
}
|
||||
|
||||
@@ -1225,7 +1225,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();
|
||||
@@ -1234,7 +1234,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
|
||||
}
|
||||
@@ -1243,7 +1243,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
private class InterfaceRequestSource extends MachineSource
|
||||
{
|
||||
|
||||
public InterfaceRequestSource( IActionHost v )
|
||||
public InterfaceRequestSource( final IActionHost v )
|
||||
{
|
||||
super( v );
|
||||
}
|
||||
@@ -1253,14 +1253,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 )
|
||||
{
|
||||
@@ -1271,7 +1271,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 )
|
||||
{
|
||||
|
||||
@@ -32,7 +32,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;
|
||||
@@ -59,12 +59,12 @@ public class LocationRotation implements IOrientable
|
||||
@Override
|
||||
public EnumFacing 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 EnumFacing.VALUES[ num ];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation( EnumFacing forward, EnumFacing up )
|
||||
public void setOrientation( final EnumFacing forward, final EnumFacing up )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class MetaRotation implements IOrientable
|
||||
final IBlockAccess w;
|
||||
final BlockPos pos;
|
||||
|
||||
public MetaRotation( IBlockAccess world, BlockPos pos, boolean FullFacing )
|
||||
public MetaRotation( final IBlockAccess world, final BlockPos pos, final boolean FullFacing )
|
||||
{
|
||||
this.w = world;
|
||||
this.pos = pos;
|
||||
@@ -63,11 +63,11 @@ public class MetaRotation implements IOrientable
|
||||
@Override
|
||||
public EnumFacing getUp()
|
||||
{
|
||||
IBlockState state = w.getBlockState( pos );
|
||||
final IBlockState state = w.getBlockState( pos );
|
||||
|
||||
if (useFacing )
|
||||
{
|
||||
EnumFacing f = state == null ? EnumFacing.UP : (EnumFacing) state.getValue( BlockTorch.FACING );
|
||||
final EnumFacing f = state == null ? EnumFacing.UP : (EnumFacing) state.getValue( BlockTorch.FACING );
|
||||
return f;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public class MetaRotation implements IOrientable
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation( EnumFacing forward, EnumFacing up )
|
||||
public void setOrientation( final EnumFacing forward, final EnumFacing up )
|
||||
{
|
||||
if( this.w instanceof World )
|
||||
{
|
||||
|
||||
@@ -47,7 +47,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;
|
||||
@@ -58,7 +58,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++ )
|
||||
{
|
||||
@@ -71,7 +71,7 @@ public class MultiCraftingTracker
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT( NBTTagCompound extra )
|
||||
public void writeToNBT( final NBTTagCompound extra )
|
||||
{
|
||||
for( int x = 0; x < this.size; x++ )
|
||||
{
|
||||
@@ -86,7 +86,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;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class NullRotation implements IOrientable
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation( EnumFacing forward, EnumFacing up )
|
||||
public void setOrientation( final EnumFacing forward, final EnumFacing up )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -59,27 +59,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() ) )
|
||||
@@ -111,7 +111,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 ) );
|
||||
@@ -122,15 +122,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() );
|
||||
@@ -141,15 +141,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() );
|
||||
@@ -167,7 +167,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++;
|
||||
@@ -175,14 +175,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() )
|
||||
{
|
||||
@@ -199,14 +199,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 )
|
||||
{
|
||||
@@ -228,7 +228,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 ) )
|
||||
{
|
||||
@@ -239,7 +239,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 ) )
|
||||
{
|
||||
@@ -290,7 +290,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 )
|
||||
{
|
||||
@@ -313,7 +313,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 )
|
||||
{
|
||||
@@ -350,13 +350,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 );
|
||||
}
|
||||
|
||||
@@ -33,13 +33,13 @@ public class Splotch
|
||||
public final AEColor color;
|
||||
private final int pos;
|
||||
|
||||
public Splotch( AEColor col, boolean lit, EnumFacing side, Vec3 position )
|
||||
public Splotch( final AEColor col, final boolean lit, final EnumFacing side, final Vec3 position )
|
||||
{
|
||||
this.color = col;
|
||||
this.lumen = lit;
|
||||
|
||||
double x;
|
||||
double y;
|
||||
final double x;
|
||||
final double y;
|
||||
|
||||
if( side == EnumFacing.SOUTH || side == EnumFacing.NORTH )
|
||||
{
|
||||
@@ -59,28 +59,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 = EnumFacing.VALUES[ 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 );
|
||||
}
|
||||
|
||||
@@ -96,7 +96,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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,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;
|
||||
@@ -78,17 +78,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( AEPartLocation.INTERNAL );
|
||||
final IGridNode n = ( (IGridHost) obj ).getGridNode( AEPartLocation.INTERNAL );
|
||||
if( n != null )
|
||||
{
|
||||
this.targetGrid = n.getGrid();
|
||||
@@ -130,7 +130,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 )
|
||||
{
|
||||
@@ -139,7 +139,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 )
|
||||
{
|
||||
@@ -148,7 +148,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 )
|
||||
{
|
||||
@@ -178,7 +178,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrioritized( IAEItemStack input )
|
||||
public boolean isPrioritized( final IAEItemStack input )
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
@@ -188,7 +188,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAccept( IAEItemStack input )
|
||||
public boolean canAccept( final IAEItemStack input )
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
@@ -218,13 +218,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 )
|
||||
{
|
||||
@@ -234,7 +234,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 )
|
||||
{
|
||||
@@ -254,7 +254,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 )
|
||||
{
|
||||
@@ -280,13 +280,13 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode getGridNode( AEPartLocation dir )
|
||||
public IGridNode getGridNode( final AEPartLocation dir )
|
||||
{
|
||||
return this.getActionableNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
public AECableType getCableConnectionType( final AEPartLocation dir )
|
||||
{
|
||||
return AECableType.NONE;
|
||||
}
|
||||
@@ -326,13 +326,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;
|
||||
@@ -344,20 +344,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