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 AbstractPartTerminal extends AbstractPartDisplay implement
|
||||
|
||||
for( final ItemStack is : this.viewCell )
|
||||
{
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
drops.add( is );
|
||||
}
|
||||
|
||||
@@ -120,14 +120,14 @@ public class PartConversionMonitor extends AbstractPartMonitor
|
||||
final IAEItemStack insertItem = input.copy();
|
||||
insertItem.setStackSize( targetStack.getCount() );
|
||||
final IAEItemStack failedToInsert = Platform.poweredInsert( energy, cell, insertItem, new PlayerSource( player, this ) );
|
||||
player.inventory.setInventorySlotContents( x, failedToInsert == null ? null : failedToInsert.getItemStack() );
|
||||
player.inventory.setInventorySlotContents( x, failedToInsert == null ? ItemStack.EMPTY : failedToInsert.getItemStack() );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
final IAEItemStack failedToInsert = Platform.poweredInsert( energy, cell, input, new PlayerSource( player, this ) );
|
||||
player.inventory.setInventorySlotContents( player.inventory.currentItem, failedToInsert == null ? null : failedToInsert.getItemStack() );
|
||||
player.inventory.setInventorySlotContents( player.inventory.currentItem, failedToInsert == null ? ItemStack.EMPTY : failedToInsert.getItemStack() );
|
||||
}
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
@@ -163,7 +163,7 @@ public class PartConversionMonitor extends AbstractPartMonitor
|
||||
ItemStack newItems = retrieved.getItemStack();
|
||||
final InventoryAdaptor adaptor = InventoryAdaptor.getAdaptor( player, EnumFacing.UP );
|
||||
newItems = adaptor.addItems( newItems );
|
||||
if( newItems != null )
|
||||
if( !newItems.isEmpty() )
|
||||
{
|
||||
final TileEntity te = this.getTile();
|
||||
final List<ItemStack> list = Collections.singletonList( newItems );
|
||||
|
||||
@@ -63,7 +63,7 @@ public class PartCraftingTerminal extends AbstractPartTerminal
|
||||
|
||||
for( final ItemStack is : this.craftingGrid )
|
||||
{
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
drops.add( is );
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class PartPatternTerminal extends AbstractPartTerminal
|
||||
{
|
||||
for( final ItemStack is : this.pattern )
|
||||
{
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
drops.add( is );
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public class PartPatternTerminal extends AbstractPartTerminal
|
||||
if( inv == this.pattern && slot == 1 )
|
||||
{
|
||||
final ItemStack is = this.pattern.getStackInSlot( 1 );
|
||||
if( is != null && is.getItem() instanceof ICraftingPatternItem )
|
||||
if( !is.isEmpty() && is.getItem() instanceof ICraftingPatternItem )
|
||||
{
|
||||
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
|
||||
final ICraftingPatternDetails details = pattern.getPatternForItem( is, this.getHost().getTile().getWorld() );
|
||||
@@ -137,13 +137,13 @@ public class PartPatternTerminal extends AbstractPartTerminal
|
||||
for( int x = 0; x < this.crafting.getSizeInventory() && x < details.getInputs().length; x++ )
|
||||
{
|
||||
final IAEItemStack item = details.getInputs()[x];
|
||||
this.crafting.setInventorySlotContents( x, item == null ? null : item.getItemStack() );
|
||||
this.crafting.setInventorySlotContents( x, item == null ? ItemStack.EMPTY : item.getItemStack() );
|
||||
}
|
||||
|
||||
for( int x = 0; x < this.output.getSizeInventory() && x < details.getOutputs().length; x++ )
|
||||
{
|
||||
final IAEItemStack item = details.getOutputs()[x];
|
||||
this.output.setInventorySlotContents( x, item == null ? null : item.getItemStack() );
|
||||
this.output.setInventorySlotContents( x, item == null ? ItemStack.EMPTY : item.getItemStack() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -163,7 +163,7 @@ public class PartPatternTerminal extends AbstractPartTerminal
|
||||
for( int x = 0; x < this.crafting.getSizeInventory(); x++ )
|
||||
{
|
||||
final ItemStack is = this.crafting.getStackInSlot( x );
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
is.setCount( 1 );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user