First batch of null -> isEmpty() checks.

I most likely still missed a ton of checks...
This commit is contained in:
Gunther De Wachter
2017-06-26 05:15:25 +02:00
parent 370fc49357
commit da5879b667
117 changed files with 594 additions and 570 deletions
@@ -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;
}