First batch of null -> isEmpty() checks.
I most likely still missed a ton of checks...
This commit is contained in:
@@ -167,14 +167,14 @@ public class AppEngCraftingSlot extends AppEngSlot
|
||||
final ItemStack itemstack1 = this.craftMatrix.getStackInSlot( i );
|
||||
final ItemStack itemstack2 = aitemstack.get( i );
|
||||
|
||||
if( itemstack1 != null )
|
||||
if( !itemstack1.isEmpty() )
|
||||
{
|
||||
this.craftMatrix.decrStackSize( i, 1 );
|
||||
}
|
||||
|
||||
if( itemstack2 != null )
|
||||
if( !itemstack2.isEmpty() )
|
||||
{
|
||||
if( this.craftMatrix.getStackInSlot( i ) == null )
|
||||
if( this.craftMatrix.getStackInSlot( i ).isEmpty() )
|
||||
{
|
||||
this.craftMatrix.setInventorySlotContents( i, itemstack2 );
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public class AppEngSlot extends Slot
|
||||
|
||||
public void clearStack()
|
||||
{
|
||||
super.putStack( null );
|
||||
super.putStack( ItemStack.EMPTY );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -46,7 +46,7 @@ public class OptionalSlotFake extends SlotFake
|
||||
{
|
||||
if( !this.isEnabled() )
|
||||
{
|
||||
if( this.getDisplayStack() != null )
|
||||
if( !this.getDisplayStack().isEmpty() )
|
||||
{
|
||||
this.clearStack();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class OptionalSlotFakeTypeOnly extends OptionalSlotFake
|
||||
@Override
|
||||
public void putStack( ItemStack is )
|
||||
{
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
is = is.copy();
|
||||
if( is.getCount() > 1 )
|
||||
|
||||
@@ -89,7 +89,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
|
||||
public void doClick( final InventoryAction action, final EntityPlayer who )
|
||||
{
|
||||
if( this.getStack() == null )
|
||||
if( this.getStack().isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -128,18 +128,18 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
}
|
||||
|
||||
final ItemStack rs = Platform.cloneItemStack( this.getStack() );
|
||||
if( rs == null )
|
||||
if( rs.isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for( int x = 0; x < maxTimesToCraft; x++ )
|
||||
{
|
||||
if( ia.simulateAdd( rs ) == null )
|
||||
if( ia.simulateAdd( rs ).isEmpty() )
|
||||
{
|
||||
final IItemList<IAEItemStack> all = inv.getStorageList();
|
||||
final ItemStack extra = ia.addItems( this.craftItem( who, rs, inv, all ) );
|
||||
if( extra != null )
|
||||
if( !extra.isEmpty() )
|
||||
{
|
||||
final List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
drops.add( extra );
|
||||
@@ -160,7 +160,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
// update crafting matrix...
|
||||
ItemStack is = this.getStack();
|
||||
|
||||
if( is != null && Platform.itemComparisons().isEqualItem( request, is ) )
|
||||
if( !is.isEmpty() && Platform.itemComparisons().isEqualItem( request, is ) )
|
||||
{
|
||||
final ItemStack[] set = new ItemStack[this.getPattern().getSizeInventory()];
|
||||
// Safeguard for empty slots in the inventory for now
|
||||
@@ -186,7 +186,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
for( int x = 0; x < ic.getSizeInventory(); x++ )
|
||||
{
|
||||
final ItemStack pis = ic.getStackInSlot( x );
|
||||
if( pis == null )
|
||||
if( pis.isEmpty() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -212,7 +212,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
{
|
||||
for( int x = 0; x < this.getPattern().getSizeInventory(); x++ )
|
||||
{
|
||||
if( this.getPattern().getStackInSlot( x ) != null )
|
||||
if( !this.getPattern().getStackInSlot( x ).isEmpty() )
|
||||
{
|
||||
set[x] = Platform.extractItemsByRecipe( this.energySrc, this.mySrc, inv, p.world, r, is, ic, this.getPattern().getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.container.getViewCells() ) );
|
||||
ic.setInventorySlotContents( x, set[x] );
|
||||
@@ -257,11 +257,11 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
// set new items onto the crafting table...
|
||||
for( int x = 0; x < this.craftInv.getSizeInventory(); x++ )
|
||||
{
|
||||
if( this.craftInv.getStackInSlot( x ) == null )
|
||||
if( this.craftInv.getStackInSlot( x ).isEmpty() )
|
||||
{
|
||||
this.craftInv.setInventorySlotContents( x, set[x] );
|
||||
}
|
||||
else if( set[x] != null )
|
||||
else if( !set[x].isEmpty() )
|
||||
{
|
||||
// eek! put it back!
|
||||
final IAEItemStack fail = inv.injectItems( AEItemStack.create( set[x] ), Actionable.MODULATE, this.mySrc );
|
||||
|
||||
@@ -53,7 +53,7 @@ public class SlotFake extends AppEngSlot
|
||||
@Override
|
||||
public void putStack( ItemStack is )
|
||||
{
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
is = is.copy();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class SlotFakeTypeOnly extends SlotFake
|
||||
@Override
|
||||
public void putStack( ItemStack is )
|
||||
{
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
is = is.copy();
|
||||
if( is.getCount() > 1 )
|
||||
|
||||
@@ -27,7 +27,7 @@ import net.minecraft.item.ItemStack;
|
||||
public class SlotInaccessible extends AppEngSlot
|
||||
{
|
||||
|
||||
private ItemStack dspStack = null;
|
||||
private ItemStack dspStack = ItemStack.EMPTY;
|
||||
|
||||
public SlotInaccessible( final IInventory i, final int slotIdx, final int x, final int y )
|
||||
{
|
||||
@@ -44,7 +44,7 @@ public class SlotInaccessible extends AppEngSlot
|
||||
public void onSlotChanged()
|
||||
{
|
||||
super.onSlotChanged();
|
||||
this.dspStack = null;
|
||||
this.dspStack = ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,10 +56,10 @@ public class SlotInaccessible extends AppEngSlot
|
||||
@Override
|
||||
public ItemStack getDisplayStack()
|
||||
{
|
||||
if( this.dspStack == null )
|
||||
if( this.dspStack.isEmpty() )
|
||||
{
|
||||
final ItemStack dsp = super.getDisplayStack();
|
||||
if( dsp != null )
|
||||
if( !dsp.isEmpty() )
|
||||
{
|
||||
this.dspStack = dsp.copy();
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
return false;
|
||||
}
|
||||
|
||||
if( i == null )
|
||||
if( i.isEmpty() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -243,11 +243,11 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
if( Platform.isClient() && ( this.which == PlacableItemType.ENCODED_PATTERN ) )
|
||||
{
|
||||
final ItemStack is = super.getStack();
|
||||
if( is != null && is.getItem() instanceof ItemEncodedPattern )
|
||||
if( !is.isEmpty() && is.getItem() instanceof ItemEncodedPattern )
|
||||
{
|
||||
final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
|
||||
final ItemStack out = iep.getOutput( is );
|
||||
if( out != null )
|
||||
if( !out.isEmpty() )
|
||||
{
|
||||
return out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user