First batch of null -> isEmpty() checks.
I most likely still missed a ton of checks...
This commit is contained in:
@@ -62,7 +62,7 @@ public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> imple
|
||||
for( int x = 0; x < upgrades.getSizeInventory(); x++ )
|
||||
{
|
||||
final ItemStack is = upgrades.getStackInSlot( x );
|
||||
if( is != null && is.getItem() instanceof IUpgradeModule )
|
||||
if( !is.isEmpty() && is.getItem() instanceof IUpgradeModule )
|
||||
{
|
||||
final Upgrades u = ( (IUpgradeModule) is.getItem() ).getType( is );
|
||||
if( u != null )
|
||||
@@ -84,7 +84,7 @@ public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> imple
|
||||
for( int x = 0; x < config.getSizeInventory(); x++ )
|
||||
{
|
||||
final ItemStack is = config.getStackInSlot( x );
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
priorityList.add( AEItemStack.create( is ) );
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
|
||||
final CellConfig cc = new CellConfig( o );
|
||||
for( final ItemStack is : cc )
|
||||
{
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
final IAEItemStack i = AEItemStack.create( is );
|
||||
i.setStackSize( Integer.MAX_VALUE );
|
||||
|
||||
@@ -75,7 +75,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
|
||||
@Override
|
||||
public IAEItemStack injectItems( final IAEItemStack input, final Actionable type, final BaseActionSource src )
|
||||
{
|
||||
ItemStack out = null;
|
||||
ItemStack out = ItemStack.EMPTY;
|
||||
|
||||
if( type == Actionable.SIMULATE )
|
||||
{
|
||||
@@ -91,7 +91,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
|
||||
this.onTick();
|
||||
}
|
||||
|
||||
if( out == null )
|
||||
if( out.isEmpty() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
|
||||
@Override
|
||||
public IAEItemStack extractItems( final IAEItemStack request, final Actionable type, final BaseActionSource src )
|
||||
{
|
||||
ItemStack out = null;
|
||||
ItemStack out = ItemStack.EMPTY;
|
||||
|
||||
if( type == Actionable.SIMULATE )
|
||||
{
|
||||
@@ -116,7 +116,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
|
||||
out = this.adaptor.removeItems( (int) request.getStackSize(), request.getItemStack(), null );
|
||||
}
|
||||
|
||||
if( out == null )
|
||||
if( out.isEmpty() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -154,7 +154,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
|
||||
high = Math.max( high, is.getSlot() );
|
||||
|
||||
final ItemStack newIS = !is.isExtractable() && this.getMode() == StorageFilter.EXTRACTABLE_ONLY ? null : is.getItemStack();
|
||||
final ItemStack oldIS = old == null ? null : old.itemStack;
|
||||
final ItemStack oldIS = old == null ? ItemStack.EMPTY : old.itemStack;
|
||||
|
||||
if( this.isDifferent( newIS, oldIS ) )
|
||||
{
|
||||
@@ -177,8 +177,8 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
|
||||
}
|
||||
else
|
||||
{
|
||||
final int newSize = ( newIS == null ? 0 : newIS.getCount() );
|
||||
final int diff = newSize - ( oldIS == null ? 0 : oldIS.getCount() );
|
||||
final int newSize = ( newIS.isEmpty() ? 0 : newIS.getCount() );
|
||||
final int diff = newSize - ( oldIS.isEmpty() ? 0 : oldIS.getCount() );
|
||||
|
||||
final IAEItemStack stack = ( old == null || old.aeStack == null ? AEApi.instance().storage().createItemStack( newIS ) : old.aeStack.copy() );
|
||||
if( stack != null )
|
||||
@@ -227,12 +227,12 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
|
||||
|
||||
private boolean isDifferent( final ItemStack a, final ItemStack b )
|
||||
{
|
||||
if( a == b && b == null )
|
||||
if( a == b && b.isEmpty() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( ( a == null && b != null ) || ( a != null && b == null ) )
|
||||
if( ( a.isEmpty() && !b.isEmpty() ) || ( !a.isEmpty() && b.isEmpty() ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -344,9 +344,9 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
|
||||
|
||||
public CachedItemStack( final ItemStack is )
|
||||
{
|
||||
if( is == null )
|
||||
if( is.isEmpty() )
|
||||
{
|
||||
this.itemStack = null;
|
||||
this.itemStack = ItemStack.EMPTY;
|
||||
this.aeStack = null;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user