First batch of null -> isEmpty() checks.
I most likely still missed a ton of checks...
This commit is contained in:
@@ -81,7 +81,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
|
||||
{
|
||||
final NBTTagCompound item = new NBTTagCompound();
|
||||
final ItemStack is = this.getStackInSlot( x );
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
is.writeToNBT( item );
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
for( int l = 0; l < inv.getSizeInventory(); l++ )
|
||||
{
|
||||
final ItemStack is = inv.getStackInSlot( l );
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
drops.add( is );
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
private final UpgradeInventory upgrades;
|
||||
private boolean isPowered = false;
|
||||
private AEPartLocation pushDirection = AEPartLocation.INTERNAL;
|
||||
private ItemStack myPattern = null;
|
||||
private ItemStack myPattern = ItemStack.EMPTY;
|
||||
private ICraftingPatternDetails myPlan = null;
|
||||
private double progress = 0;
|
||||
private boolean isAwake = false;
|
||||
@@ -114,12 +114,12 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
@Override
|
||||
public boolean pushPattern( final ICraftingPatternDetails patternDetails, final InventoryCrafting table, final EnumFacing where )
|
||||
{
|
||||
if( this.myPattern == null )
|
||||
if( this.myPattern.isEmpty() )
|
||||
{
|
||||
boolean isEmpty = true;
|
||||
for( int x = 0; x < this.inv.getSizeInventory(); x++ )
|
||||
{
|
||||
isEmpty = this.inv.getStackInSlot( x ) == null && isEmpty;
|
||||
isEmpty = this.inv.getStackInSlot( x ).isEmpty() && isEmpty;
|
||||
}
|
||||
|
||||
if( isEmpty && patternDetails.isCraftable() )
|
||||
@@ -167,7 +167,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
|
||||
private boolean canPush()
|
||||
{
|
||||
return this.inv.getStackInSlot( 9 ) != null;
|
||||
return !this.inv.getStackInSlot( 9 ).isEmpty();
|
||||
}
|
||||
|
||||
private boolean hasMats()
|
||||
@@ -182,13 +182,13 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
this.craftingInv.setInventorySlotContents( x, this.inv.getStackInSlot( x ) );
|
||||
}
|
||||
|
||||
return this.myPlan.getOutput( this.craftingInv, this.getWorld() ) != null;
|
||||
return !this.myPlan.getOutput( this.craftingInv, this.getWorld() ).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptsPlans()
|
||||
{
|
||||
return this.inv.getStackInSlot( 10 ) == null;
|
||||
return this.inv.getStackInSlot( 10 ).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -217,7 +217,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
if( this.forcePlan && this.myPlan != null )
|
||||
{
|
||||
final ItemStack pattern = this.myPlan.getPattern();
|
||||
if( pattern != null )
|
||||
if( !pattern.isEmpty() )
|
||||
{
|
||||
final NBTTagCompound compound = new NBTTagCompound();
|
||||
pattern.writeToNBT( compound );
|
||||
@@ -238,7 +238,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
{
|
||||
final ItemStack myPat = new ItemStack( data.getCompoundTag( "myPlan" ) );
|
||||
|
||||
if( myPat != null && myPat.getItem() instanceof ItemEncodedPattern )
|
||||
if( !myPat.isEmpty() && myPat.getItem() instanceof ItemEncodedPattern )
|
||||
{
|
||||
final World w = this.getWorld();
|
||||
final ItemEncodedPattern iep = (ItemEncodedPattern) myPat.getItem();
|
||||
@@ -269,7 +269,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
|
||||
final ItemStack is = this.inv.getStackInSlot( 10 );
|
||||
|
||||
if( is != null && is.getItem() instanceof ItemEncodedPattern )
|
||||
if( !is.isEmpty() && is.getItem() instanceof ItemEncodedPattern )
|
||||
{
|
||||
if( !Platform.itemComparisons().isEqualItem( is, this.myPattern ) )
|
||||
{
|
||||
@@ -290,7 +290,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
this.progress = 0;
|
||||
this.forcePlan = false;
|
||||
this.myPlan = null;
|
||||
this.myPattern = null;
|
||||
this.myPattern = ItemStack.EMPTY;
|
||||
this.pushDirection = AEPartLocation.INTERNAL;
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
|
||||
private boolean hasPattern()
|
||||
{
|
||||
return this.myPlan != null && this.inv.getStackInSlot( 10 ) != null;
|
||||
return this.myPlan != null && !this.inv.getStackInSlot( 10 ).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -404,7 +404,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
for( int h = 0; h < this.upgrades.getSizeInventory(); h++ )
|
||||
{
|
||||
final ItemStack is = this.upgrades.getStackInSlot( h );
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
drops.add( is );
|
||||
}
|
||||
@@ -422,12 +422,12 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
@Override
|
||||
public TickRateModulation tickingRequest( final IGridNode node, int ticksSinceLastCall )
|
||||
{
|
||||
if( this.inv.getStackInSlot( 9 ) != null )
|
||||
if( !this.inv.getStackInSlot( 9 ).isEmpty() )
|
||||
{
|
||||
this.pushOut( this.inv.getStackInSlot( 9 ) );
|
||||
|
||||
// did it eject?
|
||||
if( this.inv.getStackInSlot( 9 ) == null )
|
||||
if( this.inv.getStackInSlot( 9 ).isEmpty() )
|
||||
{
|
||||
this.markDirty();
|
||||
}
|
||||
@@ -487,7 +487,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
|
||||
this.progress = 0;
|
||||
final ItemStack output = this.myPlan.getOutput( this.craftingInv, this.getWorld() );
|
||||
if( output != null )
|
||||
if( !output.isEmpty() )
|
||||
{
|
||||
FMLCommonHandler.instance().firePlayerCraftingEvent( Platform.getPlayer( (WorldServer) this.getWorld() ), output, this.craftingInv );
|
||||
|
||||
@@ -498,7 +498,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
this.inv.setInventorySlotContents( x, Platform.getContainerItem( this.craftingInv.getStackInSlot( x ) ) );
|
||||
}
|
||||
|
||||
if( this.inv.getStackInSlot( 10 ) == null )
|
||||
if( this.inv.getStackInSlot( 10 ).isEmpty() )
|
||||
{
|
||||
this.forcePlan = false;
|
||||
this.myPlan = null;
|
||||
@@ -529,17 +529,17 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
|
||||
private void ejectHeldItems()
|
||||
{
|
||||
if( this.inv.getStackInSlot( 9 ) == null )
|
||||
if( this.inv.getStackInSlot( 9 ).isEmpty() )
|
||||
{
|
||||
for( int x = 0; x < 9; x++ )
|
||||
{
|
||||
final ItemStack is = this.inv.getStackInSlot( x );
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
if( this.myPlan == null || !this.myPlan.isValidItemForSlot( x, is, this.world ) )
|
||||
{
|
||||
this.inv.setInventorySlotContents( 9, is );
|
||||
this.inv.setInventorySlotContents( x, null );
|
||||
this.inv.setInventorySlotContents( x, ItemStack.EMPTY );
|
||||
this.markDirty();
|
||||
return;
|
||||
}
|
||||
@@ -574,7 +574,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
output = this.pushTo( output, this.pushDirection.getFacing() );
|
||||
}
|
||||
|
||||
if( output == null && this.forcePlan )
|
||||
if( output.isEmpty() && this.forcePlan )
|
||||
{
|
||||
this.forcePlan = false;
|
||||
this.recalculatePlan();
|
||||
@@ -585,7 +585,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
|
||||
private ItemStack pushTo( ItemStack output, final EnumFacing d )
|
||||
{
|
||||
if( output == null )
|
||||
if( output.isEmpty() )
|
||||
{
|
||||
return output;
|
||||
}
|
||||
@@ -606,7 +606,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
|
||||
final int size = output.getCount();
|
||||
output = adaptor.addItems( output );
|
||||
final int newSize = output == null ? 0 : output.getCount();
|
||||
final int newSize = output.isEmpty() ? 0 : output.getCount();
|
||||
|
||||
if( size != newSize )
|
||||
{
|
||||
|
||||
@@ -177,7 +177,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
|
||||
}
|
||||
} );
|
||||
|
||||
this.setInventorySlotContents( 6, null );
|
||||
this.setInventorySlotContents( 6, ItemStack.EMPTY );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
|
||||
}
|
||||
|
||||
final ItemStack notAdded = sia.addItems( output );
|
||||
if( notAdded != null )
|
||||
if( !notAdded.isEmpty() )
|
||||
{
|
||||
final List<ItemStack> out = new ArrayList<ItemStack>();
|
||||
out.add( notAdded );
|
||||
|
||||
@@ -56,7 +56,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
|
||||
{
|
||||
for( int x = 0; x < this.size; x++ )
|
||||
{
|
||||
if( this.getStackInSlot( x ) != null )
|
||||
if( !this.getStackInSlot( x ).isEmpty() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
|
||||
{
|
||||
if( this.inv[var1] == null )
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
return this.inv[var1].getItemStack();
|
||||
@@ -154,7 +154,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
|
||||
if( this.inv[slot] != null )
|
||||
{
|
||||
final ItemStack split = this.getStackInSlot( slot );
|
||||
ItemStack ns = null;
|
||||
ItemStack ns = ItemStack.EMPTY;
|
||||
|
||||
if( qty >= split.getCount() )
|
||||
{
|
||||
@@ -168,7 +168,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
|
||||
|
||||
if( this.te != null && Platform.isServer() )
|
||||
{
|
||||
this.te.onChangeInventory( this, slot, InvOperation.decreaseStackSize, ns, null );
|
||||
this.te.onChangeInventory( this, slot, InvOperation.decreaseStackSize, ns, ItemStack.EMPTY );
|
||||
}
|
||||
|
||||
return ns;
|
||||
@@ -194,23 +194,23 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
|
||||
ItemStack removed = oldStack;
|
||||
ItemStack added = newItemStack;
|
||||
|
||||
if( oldStack != null && newItemStack != null && Platform.itemComparisons().isEqualItem( oldStack, newItemStack ) )
|
||||
if( !oldStack.isEmpty() && !newItemStack.isEmpty() && Platform.itemComparisons().isEqualItem( oldStack, newItemStack ) )
|
||||
{
|
||||
if( oldStack.getCount() > newItemStack.getCount() )
|
||||
{
|
||||
removed = removed.copy();
|
||||
removed.grow( -newItemStack.getCount() );
|
||||
added = null;
|
||||
added = ItemStack.EMPTY;
|
||||
}
|
||||
else if( oldStack.getCount() < newItemStack.getCount() )
|
||||
{
|
||||
added = added.copy();
|
||||
added.grow( -oldStack.getCount() );
|
||||
removed = null;
|
||||
removed = ItemStack.EMPTY;
|
||||
}
|
||||
else
|
||||
{
|
||||
removed = added = null;
|
||||
removed = added = ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
|
||||
{
|
||||
if( this.te != null && Platform.isServer() )
|
||||
{
|
||||
this.te.onChangeInventory( this, -1, InvOperation.markDirty, null, null );
|
||||
this.te.onChangeInventory( this, -1, InvOperation.markDirty, ItemStack.EMPTY, ItemStack.EMPTY );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
|
||||
{
|
||||
for( int x = 0; x < this.size; x++ )
|
||||
{
|
||||
this.setInventorySlotContents( x, null );
|
||||
this.setInventorySlotContents( x, ItemStack.EMPTY );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
|
||||
@Override
|
||||
public ItemStack getStackInSlot( final int var1 )
|
||||
{
|
||||
return this.inv[var1];
|
||||
return this.inv[var1] == null ? ItemStack.EMPTY : this.inv[var1];
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,12 +78,12 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
|
||||
if( this.inv[slot] != null )
|
||||
{
|
||||
final ItemStack split = this.getStackInSlot( slot );
|
||||
ItemStack ns = null;
|
||||
ItemStack ns = ItemStack.EMPTY;
|
||||
|
||||
if( qty >= split.getCount() )
|
||||
{
|
||||
ns = this.inv[slot];
|
||||
this.inv[slot] = null;
|
||||
this.inv[slot] = ItemStack.EMPTY;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -92,7 +92,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
|
||||
|
||||
if( this.getTileEntity() != null && this.eventsEnabled() )
|
||||
{
|
||||
this.getTileEntity().onChangeInventory( this, slot, InvOperation.decreaseStackSize, ns, null );
|
||||
this.getTileEntity().onChangeInventory( this, slot, InvOperation.decreaseStackSize, ns, ItemStack.EMPTY );
|
||||
}
|
||||
|
||||
this.markDirty();
|
||||
@@ -124,7 +124,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
|
||||
ItemStack removed = oldStack;
|
||||
ItemStack added = newItemStack;
|
||||
|
||||
if( oldStack != null && newItemStack != null && Platform.itemComparisons().isEqualItem( oldStack, newItemStack ) )
|
||||
if( !oldStack.isEmpty() && !newItemStack.isEmpty() && Platform.itemComparisons().isEqualItem( oldStack, newItemStack ) )
|
||||
{
|
||||
if( oldStack.getCount() > newItemStack.getCount() )
|
||||
{
|
||||
@@ -136,11 +136,11 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
|
||||
{
|
||||
added = added.copy();
|
||||
added.grow( -oldStack.getCount() );
|
||||
removed = null;
|
||||
removed = ItemStack.EMPTY;
|
||||
}
|
||||
else
|
||||
{
|
||||
removed = added = null;
|
||||
removed = added = ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
|
||||
{
|
||||
if( this.getTileEntity() != null && this.eventsEnabled() )
|
||||
{
|
||||
this.getTileEntity().onChangeInventory( this, -1, InvOperation.markDirty, null, null );
|
||||
this.getTileEntity().onChangeInventory( this, -1, InvOperation.markDirty, ItemStack.EMPTY, ItemStack.EMPTY );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
|
||||
{
|
||||
if( this.getTileEntity() != null && this.eventsEnabled() )
|
||||
{
|
||||
this.getTileEntity().onChangeInventory( this, slotIndex, InvOperation.markDirty, null, null );
|
||||
this.getTileEntity().onChangeInventory( this, slotIndex, InvOperation.markDirty, ItemStack.EMPTY, ItemStack.EMPTY );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
|
||||
{
|
||||
for( int x = 0; x < this.size; x++ )
|
||||
{
|
||||
this.setInventorySlotContents( x, null );
|
||||
this.setInventorySlotContents( x, ItemStack.EMPTY );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
||||
}
|
||||
|
||||
final ItemStack is = this.cell.getStackInSlot( 0 );
|
||||
if( is == null )
|
||||
if( is.isEmpty() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
||||
|
||||
public ICellWorkbenchItem getCell()
|
||||
{
|
||||
if( this.cell.getStackInSlot( 0 ) == null )
|
||||
if( this.cell.getStackInSlot( 0 ).isEmpty() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -157,7 +157,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
||||
boolean cellHasConfig = false;
|
||||
for( int x = 0; x < configInventory.getSizeInventory(); x++ )
|
||||
{
|
||||
if( configInventory.getStackInSlot( x ) != null )
|
||||
if( !configInventory.getStackInSlot( x ).isEmpty() )
|
||||
{
|
||||
cellHasConfig = true;
|
||||
break;
|
||||
@@ -185,7 +185,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
||||
{
|
||||
for( int x = 0; x < this.config.getSizeInventory(); x++ )
|
||||
{
|
||||
this.config.setInventorySlotContents( x, null );
|
||||
this.config.setInventorySlotContents( x, ItemStack.EMPTY );
|
||||
}
|
||||
|
||||
this.markDirty();
|
||||
@@ -219,7 +219,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
||||
}
|
||||
|
||||
final ItemStack is = this.cell.getStackInSlot( 0 );
|
||||
if( is == null )
|
||||
if( is.isEmpty() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
|
||||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
this.inv.setInventorySlotContents( 0, null );
|
||||
this.inv.setInventorySlotContents( 0, ItemStack.EMPTY );
|
||||
}
|
||||
return false; // TESR doesn't need updates!
|
||||
}
|
||||
@@ -217,7 +217,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
|
||||
}
|
||||
|
||||
final ItemStack myItem = this.getStackInSlot( 0 );
|
||||
if( myItem == null )
|
||||
if( myItem.isEmpty() )
|
||||
{
|
||||
ItemStack held = player.inventory.getCurrentItem();
|
||||
|
||||
@@ -231,7 +231,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
|
||||
{
|
||||
final List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
drops.add( myItem );
|
||||
this.setInventorySlotContents( 0, null );
|
||||
this.setInventorySlotContents( 0, ItemStack.EMPTY );
|
||||
Platform.spawnDrops( this.world, this.pos.offset( this.getForward() ), drops );
|
||||
}
|
||||
}
|
||||
@@ -267,7 +267,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
|
||||
return true;
|
||||
}
|
||||
|
||||
if( myItem == null )
|
||||
if( myItem.isEmpty() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
|
||||
public double getStorage()
|
||||
{
|
||||
final ItemStack is = this.inv.getStackInSlot( 2 );
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
if( is.getItem() instanceof IStorageComponent )
|
||||
{
|
||||
@@ -118,7 +118,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
|
||||
|
||||
final double requiredPower = this.getRequiredPower();
|
||||
final ItemStack output = this.getOutput();
|
||||
while( requiredPower <= this.getStoredPower() && output != null && requiredPower > 0 )
|
||||
while( requiredPower <= this.getStoredPower() && !output.isEmpty() && requiredPower > 0 )
|
||||
{
|
||||
if( this.canAddOutput( output ) )
|
||||
{
|
||||
@@ -135,7 +135,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
|
||||
private boolean canAddOutput( final ItemStack output )
|
||||
{
|
||||
final ItemStack outputStack = this.getStackInSlot( 1 );
|
||||
return outputStack == null || ( Platform.itemComparisons().isEqualItem( outputStack,
|
||||
return outputStack.isEmpty() || ( Platform.itemComparisons().isEqualItem( outputStack,
|
||||
output ) && outputStack.getCount() < outputStack.getMaxStackSize() );
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
|
||||
private void addOutput( final ItemStack output )
|
||||
{
|
||||
final ItemStack outputStack = this.getStackInSlot( 1 );
|
||||
if( outputStack == null )
|
||||
if( outputStack.isEmpty() )
|
||||
{
|
||||
this.setInventorySlotContents( 1, output.copy() );
|
||||
}
|
||||
@@ -165,10 +165,10 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
|
||||
switch( (CondenserOutput) this.cm.getSetting( Settings.CONDENSER_OUTPUT ) )
|
||||
{
|
||||
case MATTER_BALLS:
|
||||
return materials.matterBall().maybeStack( 1 ).orElse( null );
|
||||
return materials.matterBall().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
||||
|
||||
case SINGULARITY:
|
||||
return materials.singularity().maybeStack( 1 ).orElse( null );
|
||||
return materials.singularity().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
||||
|
||||
case TRASH:
|
||||
default:
|
||||
@@ -192,7 +192,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
|
||||
{
|
||||
if( i == 0 )
|
||||
{
|
||||
if( itemstack != null )
|
||||
if( !itemstack.isEmpty() )
|
||||
{
|
||||
this.addPower( itemstack.getCount() );
|
||||
}
|
||||
@@ -215,10 +215,10 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
|
||||
if( slot == 0 )
|
||||
{
|
||||
final ItemStack is = inv.getStackInSlot( 0 );
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
this.addPower( is.getCount() );
|
||||
inv.setInventorySlotContents( 0, null );
|
||||
inv.setInventorySlotContents( 0, ItemStack.EMPTY );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -324,7 +324,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
if( !simulate && stack != null )
|
||||
if( !simulate && !stack.isEmpty() )
|
||||
{
|
||||
addPower( stack.getCount() );
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
}
|
||||
else
|
||||
{
|
||||
this.inv.setInventorySlotContents( num, null );
|
||||
this.inv.setInventorySlotContents( num, ItemStack.EMPTY );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
for( int h = 0; h < this.upgrades.getSizeInventory(); h++ )
|
||||
{
|
||||
final ItemStack is = this.upgrades.getStackInSlot( h );
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
drops.add( is );
|
||||
}
|
||||
@@ -344,17 +344,17 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
final ItemStack plateB = this.getStackInSlot( 1 );
|
||||
ItemStack renamedItem = this.getStackInSlot( 2 );
|
||||
|
||||
if( plateA != null && plateA.getCount() > 1 )
|
||||
if( !plateA.isEmpty() && plateA.getCount() > 1 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if( plateB != null && plateB.getCount() > 1 )
|
||||
if( !plateB.isEmpty() && plateB.getCount() > 1 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if( renamedItem != null && renamedItem.getCount() > 1 )
|
||||
if( !renamedItem.isEmpty() && renamedItem.getCount() > 1 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -363,19 +363,19 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
final boolean isNameA = namePress.isSameAs( plateA );
|
||||
final boolean isNameB = namePress.isSameAs( plateB );
|
||||
|
||||
if( ( isNameA || isNameB ) && ( isNameA || plateA == null ) && ( isNameB || plateB == null ) )
|
||||
if( ( isNameA || isNameB ) && ( isNameA || plateA.isEmpty() ) && ( isNameB || plateB.isEmpty() ) )
|
||||
{
|
||||
if( renamedItem != null )
|
||||
if( !renamedItem.isEmpty() )
|
||||
{
|
||||
String name = "";
|
||||
|
||||
if( plateA != null )
|
||||
if( !plateA.isEmpty() )
|
||||
{
|
||||
final NBTTagCompound tag = Platform.openNbtData( plateA );
|
||||
name += tag.getString( "InscribeName" );
|
||||
}
|
||||
|
||||
if( plateB != null )
|
||||
if( !plateB.isEmpty() )
|
||||
{
|
||||
final NBTTagCompound tag = Platform.openNbtData( plateB );
|
||||
if( name.length() > 0 )
|
||||
@@ -417,15 +417,15 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
for( final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
|
||||
{
|
||||
|
||||
final boolean matchA = ( plateA == null && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( plateA,
|
||||
recipe.getTopOptional().orElse( null ) ) ) && // and...
|
||||
( plateB == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.itemComparisons().isSameItem( plateB,
|
||||
recipe.getBottomOptional().orElse( null ) ) );
|
||||
final boolean matchA = ( plateA.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( plateA,
|
||||
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
||||
( plateB.isEmpty() && !recipe.getBottomOptional().isPresent() ) | ( Platform.itemComparisons().isSameItem( plateB,
|
||||
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) );
|
||||
|
||||
final boolean matchB = ( plateB == null && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( plateB,
|
||||
recipe.getTopOptional().orElse( null ) ) ) && // and...
|
||||
( plateA == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.itemComparisons().isSameItem( plateA,
|
||||
recipe.getBottomOptional().orElse( null ) ) );
|
||||
final boolean matchB = ( plateB.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( plateB,
|
||||
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
||||
( plateA.isEmpty() && !recipe.getBottomOptional().isPresent() ) | ( Platform.itemComparisons().isSameItem( plateA,
|
||||
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) );
|
||||
|
||||
if( matchA || matchB )
|
||||
{
|
||||
@@ -455,15 +455,15 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
final ItemStack outputCopy = out.getOutput().copy();
|
||||
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this.inv, SLOT_OUT, 1, true ), EnumFacing.UP );
|
||||
|
||||
if( ad.addItems( outputCopy ) == null )
|
||||
if( ad.addItems( outputCopy ).isEmpty() )
|
||||
{
|
||||
this.setProcessingTime( 0 );
|
||||
if( out.getProcessType() == InscriberProcessType.PRESS )
|
||||
{
|
||||
this.setInventorySlotContents( SLOT_TOP, null );
|
||||
this.setInventorySlotContents( SLOT_BOTTOM, null );
|
||||
this.setInventorySlotContents( SLOT_TOP, ItemStack.EMPTY );
|
||||
this.setInventorySlotContents( SLOT_BOTTOM, ItemStack.EMPTY );
|
||||
}
|
||||
this.setInventorySlotContents( SLOT_MIDDLE, null );
|
||||
this.setInventorySlotContents( SLOT_MIDDLE, ItemStack.EMPTY );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -522,7 +522,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
{
|
||||
final ItemStack outputCopy = out.getOutput().copy();
|
||||
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this.inv, SLOT_OUT, 1, true ), EnumFacing.UP );
|
||||
if( ad.simulateAdd( outputCopy ) == null )
|
||||
if( ad.simulateAdd( outputCopy ).isEmpty() )
|
||||
{
|
||||
this.setSmash( true );
|
||||
this.finalStep = 0;
|
||||
@@ -678,13 +678,13 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
@Override
|
||||
public ItemStack insertItem( int slot, ItemStack stack, boolean simulate )
|
||||
{
|
||||
if( slot != 0 || stack == null )
|
||||
if( slot != 0 || stack.isEmpty() )
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
// If there's already an item stack in the slot, we don't allow insertion and don't do any other checks
|
||||
if( inv.getStackInSlot( insertSlot ) != null )
|
||||
if( !inv.getStackInSlot( insertSlot ).isEmpty() )
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
@@ -715,11 +715,11 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
|
||||
if( simulate )
|
||||
{
|
||||
return adapter.simulateRemove( amount, null, null );
|
||||
return adapter.simulateRemove( amount, ItemStack.EMPTY, null );
|
||||
}
|
||||
else
|
||||
{
|
||||
return adapter.removeItems( amount, null, null );
|
||||
return adapter.removeItems( amount, ItemStack.EMPTY, null );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
|
||||
private boolean canEatFuel()
|
||||
{
|
||||
final ItemStack is = this.getStackInSlot( FUEL_SLOT_INDEX );
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
final int newBurnTime = TileEntityFurnace.getItemBurnTime( is );
|
||||
if( newBurnTime > 0 && is.getCount() > 0 )
|
||||
@@ -244,7 +244,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
|
||||
private void eatFuel()
|
||||
{
|
||||
final ItemStack is = this.getStackInSlot( FUEL_SLOT_INDEX );
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
final int newBurnTime = TileEntityFurnace.getItemBurnTime( is );
|
||||
if( newBurnTime > 0 && is.getCount() > 0 )
|
||||
|
||||
@@ -94,7 +94,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
||||
{
|
||||
int out = this.constructed;
|
||||
|
||||
if( this.getStackInSlot( 0 ) != null && this.constructed != -1 )
|
||||
if( !this.getStackInSlot( 0 ).isEmpty() && this.constructed != -1 )
|
||||
{
|
||||
out |= this.hasSingularity;
|
||||
}
|
||||
@@ -272,7 +272,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
||||
public long getQEFrequency()
|
||||
{
|
||||
final ItemStack is = this.internalInventory.getStackInSlot( 0 );
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
final NBTTagCompound c = is.getTagCompound();
|
||||
if( c != null )
|
||||
|
||||
@@ -114,7 +114,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
|
||||
|
||||
private boolean isSpatialCell( final ItemStack cell )
|
||||
{
|
||||
if( cell != null && cell.getItem() instanceof ISpatialStorageCell )
|
||||
if( !cell.isEmpty() && cell.getItem() instanceof ISpatialStorageCell )
|
||||
{
|
||||
final ISpatialStorageCell sc = (ISpatialStorageCell) cell.getItem();
|
||||
return sc != null && sc.isSpatialStorage( cell );
|
||||
@@ -126,7 +126,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
|
||||
public Void call( final World world ) throws Exception
|
||||
{
|
||||
final ItemStack cell = this.getStackInSlot( 0 );
|
||||
if( this.isSpatialCell( cell ) && this.getStackInSlot( 1 ) == null )
|
||||
if( this.isSpatialCell( cell ) && this.getStackInSlot( 1 ).isEmpty() )
|
||||
{
|
||||
final IGrid gi = this.getProxy().getGrid();
|
||||
final IEnergyGrid energy = this.getProxy().getEnergy();
|
||||
@@ -147,7 +147,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
|
||||
if( tr.success )
|
||||
{
|
||||
energy.extractAEPower( req, Actionable.MODULATE, PowerMultiplier.CONFIG );
|
||||
this.setInventorySlotContents( 0, null );
|
||||
this.setInventorySlotContents( 0, ItemStack.EMPTY );
|
||||
this.setInventorySlotContents( 1, cell );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
this.fluidCell = null;
|
||||
|
||||
final ItemStack is = this.inv.getStackInSlot( 1 );
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
this.isCached = true;
|
||||
this.cellHandler = AEApi.instance().registries().cell().getHandler( is );
|
||||
@@ -393,7 +393,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
}
|
||||
}
|
||||
|
||||
if( this.inv.getStackInSlot( 0 ) != null )
|
||||
if( !this.inv.getStackInSlot( 0 ).isEmpty() )
|
||||
{
|
||||
this.tryToStoreContents();
|
||||
}
|
||||
@@ -430,7 +430,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
|
||||
final ItemStack is = this.inv.getStackInSlot( 1 );
|
||||
|
||||
if( is == null )
|
||||
if( is.isEmpty() )
|
||||
{
|
||||
data.writeInt( 0 );
|
||||
}
|
||||
@@ -454,7 +454,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
|
||||
if( item == 0 )
|
||||
{
|
||||
this.storageType = null;
|
||||
this.storageType = ItemStack.EMPTY;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -616,7 +616,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
{
|
||||
try
|
||||
{
|
||||
if( this.getStackInSlot( 0 ) != null )
|
||||
if( !this.getStackInSlot( 0 ).isEmpty() )
|
||||
{
|
||||
final IMEInventory<IAEItemStack> cell = this.getHandler( StorageChannel.ITEMS );
|
||||
|
||||
@@ -624,7 +624,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
|
||||
if( returns == null )
|
||||
{
|
||||
this.inv.setInventorySlotContents( 0, null );
|
||||
this.inv.setInventorySlotContents( 0, ItemStack.EMPTY );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -241,7 +241,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
||||
@MENetworkEventSubscribe
|
||||
public void channelRender( final MENetworkChannelsChanged c )
|
||||
{
|
||||
this.recalculateDisplay();
|
||||
this.recalculateDisplay();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -312,7 +312,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
||||
this.invBySlot[x] = null;
|
||||
this.handlersBySlot[x] = null;
|
||||
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
this.handlersBySlot[x] = AEApi.instance().registries().cell().getHandler( is );
|
||||
|
||||
|
||||
@@ -343,7 +343,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
for( int x = 0; x < 6; x++ )
|
||||
{
|
||||
final ItemStack is = this.cells.getStackInSlot( x );
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
if( ItemsToMove > 0 )
|
||||
{
|
||||
@@ -513,9 +513,9 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
final WrapperInventoryRange wir = new WrapperInventoryRange( this, this.output, true );
|
||||
final ItemStack result = InventoryAdaptor.getAdaptor( wir, EnumFacing.UP ).addItems( this.getStackInSlot( x ) );
|
||||
|
||||
if( result == null )
|
||||
if( result.isEmpty() )
|
||||
{
|
||||
this.setInventorySlotContents( x, null );
|
||||
this.setInventorySlotContents( x, ItemStack.EMPTY );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user