First batch of null -> isEmpty() checks.
I most likely still missed a ton of checks...
This commit is contained in:
@@ -224,8 +224,8 @@ public abstract class AEBaseContainer extends Container
|
||||
// client doesn't need to re-send, makes for lower overhead rapid packets.
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
final ItemStack a = stack == null ? null : stack.getItemStack();
|
||||
final ItemStack b = this.clientRequestedTargetItem == null ? null : this.clientRequestedTargetItem.getItemStack();
|
||||
final ItemStack a = stack == null ? ItemStack.EMPTY : stack.getItemStack();
|
||||
final ItemStack b = this.clientRequestedTargetItem == null ? ItemStack.EMPTY : this.clientRequestedTargetItem.getItemStack();
|
||||
|
||||
if( Platform.itemComparisons().isSameItem( a, b ) )
|
||||
{
|
||||
@@ -483,7 +483,7 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
ItemStack tis = clickSlot.getStack();
|
||||
|
||||
if( tis == null )
|
||||
if( tis.isEmpty() )
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
@@ -533,7 +533,7 @@ public abstract class AEBaseContainer extends Container
|
||||
*/
|
||||
if( selectedSlots.isEmpty() && clickSlot.isPlayerSide() )
|
||||
{
|
||||
if( tis != null )
|
||||
if( !tis.isEmpty() )
|
||||
{
|
||||
// target slots in the container...
|
||||
for( final Object inventorySlot : this.inventorySlots )
|
||||
@@ -547,7 +547,7 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if( destination == null )
|
||||
else if( destination.isEmpty() )
|
||||
{
|
||||
cs.putStack( tis.copy() );
|
||||
cs.onSlotChanged();
|
||||
@@ -559,7 +559,7 @@ public abstract class AEBaseContainer extends Container
|
||||
}
|
||||
}
|
||||
|
||||
if( tis != null )
|
||||
if( !tis.isEmpty() )
|
||||
{
|
||||
// find partials..
|
||||
for( final Slot d : selectedSlots )
|
||||
@@ -595,7 +595,7 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
if( tis.getCount() <= 0 )
|
||||
{
|
||||
clickSlot.putStack( null );
|
||||
clickSlot.putStack( ItemStack.EMPTY );
|
||||
d.onSlotChanged();
|
||||
|
||||
// if ( hasMETiles ) updateClient();
|
||||
@@ -647,7 +647,7 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
if( tis.getCount() <= 0 )
|
||||
{
|
||||
clickSlot.putStack( null );
|
||||
clickSlot.putStack( ItemStack.EMPTY );
|
||||
d.onSlotChanged();
|
||||
|
||||
// if ( worldEntity != null )
|
||||
@@ -683,7 +683,7 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
if( tis.getCount() <= 0 )
|
||||
{
|
||||
clickSlot.putStack( null );
|
||||
clickSlot.putStack( ItemStack.EMPTY );
|
||||
d.onSlotChanged();
|
||||
|
||||
// if ( worldEntity != null )
|
||||
@@ -703,7 +703,7 @@ public abstract class AEBaseContainer extends Container
|
||||
}
|
||||
}
|
||||
|
||||
clickSlot.putStack( tis != null ? tis.copy() : null );
|
||||
clickSlot.putStack( !tis.isEmpty() ? tis.copy() : ItemStack.EMPTY );
|
||||
}
|
||||
|
||||
this.updateSlot( clickSlot );
|
||||
@@ -766,9 +766,9 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
case PICKUP_OR_SET_DOWN:
|
||||
|
||||
if( hand == null )
|
||||
if( hand.isEmpty() )
|
||||
{
|
||||
s.putStack( null );
|
||||
s.putStack( ItemStack.EMPTY );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -778,7 +778,7 @@ public abstract class AEBaseContainer extends Container
|
||||
break;
|
||||
case PLACE_SINGLE:
|
||||
|
||||
if( hand != null )
|
||||
if( !hand.isEmpty() )
|
||||
{
|
||||
final ItemStack is = hand.copy();
|
||||
is.setCount( 1 );
|
||||
@@ -789,9 +789,9 @@ public abstract class AEBaseContainer extends Container
|
||||
case SPLIT_OR_PLACE_SINGLE:
|
||||
|
||||
ItemStack is = s.getStack();
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
if( hand == null )
|
||||
if( hand.isEmpty() )
|
||||
{
|
||||
is.setCount( Math.max( 1, is.getCount() - 1 ) );
|
||||
}
|
||||
@@ -807,7 +807,7 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
s.putStack( is );
|
||||
}
|
||||
else if( hand != null )
|
||||
else if( !hand.isEmpty() )
|
||||
{
|
||||
is = hand.copy();
|
||||
is.setCount( 1 );
|
||||
@@ -866,7 +866,7 @@ public abstract class AEBaseContainer extends Container
|
||||
myItem.setCount( (int) ais.getStackSize() );
|
||||
myItem = adp.simulateAdd( myItem );
|
||||
|
||||
if( myItem != null )
|
||||
if( !myItem.isEmpty() )
|
||||
{
|
||||
ais.setStackSize( ais.getStackSize() - myItem.getCount() );
|
||||
}
|
||||
@@ -887,7 +887,7 @@ public abstract class AEBaseContainer extends Container
|
||||
final int releaseQty = 1;
|
||||
final ItemStack isg = player.inventory.getItemStack();
|
||||
|
||||
if( isg != null && releaseQty > 0 )
|
||||
if( !isg.isEmpty() && releaseQty > 0 )
|
||||
{
|
||||
IAEItemStack ais = AEApi.instance().storage().createItemStack( isg );
|
||||
ais.setStackSize( 1 );
|
||||
@@ -899,7 +899,7 @@ public abstract class AEBaseContainer extends Container
|
||||
final InventoryAdaptor ia = new AdaptorPlayerHand( player );
|
||||
|
||||
final ItemStack fail = ia.removeItems( 1, extracted.getItemStack(), null );
|
||||
if( fail == null )
|
||||
if( fail.isEmpty() )
|
||||
{
|
||||
this.getCellInventory().extractItems( extracted, Actionable.MODULATE, this.getActionSource() );
|
||||
}
|
||||
@@ -921,7 +921,7 @@ public abstract class AEBaseContainer extends Container
|
||||
int liftQty = 1;
|
||||
final ItemStack item = player.inventory.getItemStack();
|
||||
|
||||
if( item != null )
|
||||
if( !item.isEmpty() )
|
||||
{
|
||||
if( item.getCount() >= item.getMaxStackSize() )
|
||||
{
|
||||
@@ -943,7 +943,7 @@ public abstract class AEBaseContainer extends Container
|
||||
final InventoryAdaptor ia = new AdaptorPlayerHand( player );
|
||||
|
||||
final ItemStack fail = ia.addItems( ais.getItemStack() );
|
||||
if( fail != null )
|
||||
if( !fail.isEmpty() )
|
||||
{
|
||||
this.getCellInventory().injectItems( ais, Actionable.MODULATE, this.getActionSource() );
|
||||
}
|
||||
@@ -959,7 +959,7 @@ public abstract class AEBaseContainer extends Container
|
||||
return;
|
||||
}
|
||||
|
||||
if( player.inventory.getItemStack() == null )
|
||||
if( player.inventory.getItemStack().isEmpty() )
|
||||
{
|
||||
if( slotItem != null )
|
||||
{
|
||||
@@ -972,7 +972,7 @@ public abstract class AEBaseContainer extends Container
|
||||
}
|
||||
else
|
||||
{
|
||||
player.inventory.setItemStack( null );
|
||||
player.inventory.setItemStack( ItemStack.EMPTY );
|
||||
}
|
||||
this.updateHeld( player );
|
||||
}
|
||||
@@ -987,7 +987,7 @@ public abstract class AEBaseContainer extends Container
|
||||
}
|
||||
else
|
||||
{
|
||||
player.inventory.setItemStack( null );
|
||||
player.inventory.setItemStack( ItemStack.EMPTY );
|
||||
}
|
||||
this.updateHeld( player );
|
||||
}
|
||||
@@ -999,7 +999,7 @@ public abstract class AEBaseContainer extends Container
|
||||
return;
|
||||
}
|
||||
|
||||
if( player.inventory.getItemStack() == null )
|
||||
if( player.inventory.getItemStack().isEmpty() )
|
||||
{
|
||||
if( slotItem != null )
|
||||
{
|
||||
@@ -1021,7 +1021,7 @@ public abstract class AEBaseContainer extends Container
|
||||
}
|
||||
else
|
||||
{
|
||||
player.inventory.setItemStack( null );
|
||||
player.inventory.setItemStack( ItemStack.EMPTY );
|
||||
}
|
||||
this.updateHeld( player );
|
||||
}
|
||||
@@ -1037,7 +1037,7 @@ public abstract class AEBaseContainer extends Container
|
||||
is.setCount( is.getCount() - 1 );
|
||||
if( is.getCount() <= 0 )
|
||||
{
|
||||
player.inventory.setItemStack( null );
|
||||
player.inventory.setItemStack( ItemStack.EMPTY );
|
||||
}
|
||||
this.updateHeld( player );
|
||||
}
|
||||
@@ -1074,7 +1074,7 @@ public abstract class AEBaseContainer extends Container
|
||||
myItem.setCount( (int) ais.getStackSize() );
|
||||
myItem = adp.simulateAdd( myItem );
|
||||
|
||||
if( myItem != null )
|
||||
if( !myItem.isEmpty() )
|
||||
{
|
||||
ais.setStackSize( ais.getStackSize() - myItem.getCount() );
|
||||
}
|
||||
@@ -1123,7 +1123,7 @@ public abstract class AEBaseContainer extends Container
|
||||
this.getActionSource() );
|
||||
if( ais == null )
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
return ais.getItemStack();
|
||||
}
|
||||
@@ -1202,42 +1202,42 @@ public abstract class AEBaseContainer extends Container
|
||||
final ItemStack isB = b.getStack();
|
||||
|
||||
// something to do?
|
||||
if( isA == null && isB == null )
|
||||
if( isA.isEmpty() && isB.isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// can take?
|
||||
|
||||
if( isA != null && !a.canTakeStack( this.getInventoryPlayer().player ) )
|
||||
if( !isA.isEmpty() && !a.canTakeStack( this.getInventoryPlayer().player ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( isB != null && !b.canTakeStack( this.getInventoryPlayer().player ) )
|
||||
if( !isB.isEmpty() && !b.canTakeStack( this.getInventoryPlayer().player ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// swap valid?
|
||||
|
||||
if( isB != null && !a.isItemValid( isB ) )
|
||||
if( !isB.isEmpty() && !a.isItemValid( isB ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( isA != null && !b.isItemValid( isA ) )
|
||||
if( !isA.isEmpty() && !b.isItemValid( isA ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack testA = isB == null ? null : isB.copy();
|
||||
ItemStack testB = isA == null ? null : isA.copy();
|
||||
ItemStack testA = isB.isEmpty() ? ItemStack.EMPTY : isB.copy();
|
||||
ItemStack testB = isA.isEmpty() ? ItemStack.EMPTY : isA.copy();
|
||||
|
||||
// can put some back?
|
||||
if( testA != null && testA.getCount() > a.getSlotStackLimit() )
|
||||
if( !testA.isEmpty() && testA.getCount() > a.getSlotStackLimit() )
|
||||
{
|
||||
if( testB != null )
|
||||
if( !testB.isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1249,9 +1249,9 @@ public abstract class AEBaseContainer extends Container
|
||||
testB.setCount( totalA - testA.getCount() );
|
||||
}
|
||||
|
||||
if( testB != null && testB.getCount() > b.getSlotStackLimit() )
|
||||
if( !testB.isEmpty() && testB.getCount() > b.getSlotStackLimit() )
|
||||
{
|
||||
if( testA != null )
|
||||
if ( !testA.isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
final IInventory inv = this.getUpgradeable().getInventoryByName( "config" );
|
||||
for( int x = 0; x < inv.getSizeInventory(); x++ )
|
||||
{
|
||||
inv.setInventorySlotContents( x, null );
|
||||
inv.setInventorySlotContents( x, ItemStack.EMPTY );
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
@@ -248,7 +248,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
}
|
||||
else
|
||||
{
|
||||
inv.setInventorySlotContents( x, null );
|
||||
inv.setInventorySlotContents( x, ItemStack.EMPTY );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,11 +126,11 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
||||
|
||||
for( final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
|
||||
{
|
||||
final boolean matchA = ( top == null && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top, recipe.getTopOptional().orElse( null ) ) ) && // and...
|
||||
( bot == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.itemComparisons().isSameItem( bot, recipe.getBottomOptional().orElse( null ) ) );
|
||||
final boolean matchA = ( top.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top, recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
||||
( bot.isEmpty() && !recipe.getBottomOptional().isPresent() ) | ( Platform.itemComparisons().isSameItem( bot, recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) );
|
||||
|
||||
final boolean matchB = ( bot == null && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot, recipe.getTopOptional().orElse( null ) ) ) && // and...
|
||||
( top == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.itemComparisons().isSameItem( top, recipe.getBottomOptional().orElse( null ) ) );
|
||||
final boolean matchB = ( bot.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot, recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
||||
( top.isEmpty() && !recipe.getBottomOptional().isPresent() ) | ( Platform.itemComparisons().isSameItem( top, recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) );
|
||||
|
||||
if( matchA || matchB )
|
||||
{
|
||||
@@ -151,9 +151,9 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
||||
}
|
||||
}
|
||||
|
||||
if( ( s == this.top && bot != null ) || ( s == this.bottom && top != null ) )
|
||||
if( ( s == this.top && !bot.isEmpty() ) || ( s == this.bottom && !top.isEmpty() ) )
|
||||
{
|
||||
ItemStack otherSlot = null;
|
||||
ItemStack otherSlot = ItemStack.EMPTY;
|
||||
if( s == this.top )
|
||||
{
|
||||
otherSlot = this.bottom.getStack();
|
||||
@@ -174,13 +174,13 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
||||
boolean isValid = false;
|
||||
for( final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
|
||||
{
|
||||
if( Platform.itemComparisons().isSameItem( recipe.getTopOptional().orElse( null ), otherSlot ) )
|
||||
if( Platform.itemComparisons().isSameItem( recipe.getTopOptional().orElse( ItemStack.EMPTY ), otherSlot ) )
|
||||
{
|
||||
isValid = Platform.itemComparisons().isSameItem( is, recipe.getBottomOptional().orElse( null ) );
|
||||
isValid = Platform.itemComparisons().isSameItem( is, recipe.getBottomOptional().orElse( ItemStack.EMPTY ) );
|
||||
}
|
||||
else if( Platform.itemComparisons().isSameItem( recipe.getBottomOptional().orElse( null ), otherSlot ) )
|
||||
else if( Platform.itemComparisons().isSameItem( recipe.getBottomOptional().orElse( ItemStack.EMPTY ), otherSlot ) )
|
||||
{
|
||||
isValid = Platform.itemComparisons().isSameItem( is, recipe.getTopOptional().orElse( null ) );
|
||||
isValid = Platform.itemComparisons().isSameItem( is, recipe.getTopOptional().orElse( ItemStack.EMPTY ) );
|
||||
}
|
||||
|
||||
if( isValid )
|
||||
|
||||
@@ -204,7 +204,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
if( inv != null )
|
||||
{
|
||||
final ItemStack is = inv.server.getStackInSlot( slot );
|
||||
final boolean hasItemInHand = player.inventory.getItemStack() != null;
|
||||
final boolean hasItemInHand = !player.inventory.getItemStack().isEmpty();
|
||||
|
||||
final InventoryAdaptor playerHand = new AdaptorPlayerHand( player );
|
||||
|
||||
@@ -220,7 +220,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
if( hasItemInHand )
|
||||
{
|
||||
ItemStack inSlot = theSlot.getStackInSlot( 0 );
|
||||
if( inSlot == null )
|
||||
if( inSlot.isEmpty() )
|
||||
{
|
||||
player.inventory.setItemStack( interfaceSlot.addItems( player.inventory.getItemStack() ) );
|
||||
}
|
||||
@@ -229,12 +229,12 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
inSlot = inSlot.copy();
|
||||
final ItemStack inHand = player.inventory.getItemStack().copy();
|
||||
|
||||
theSlot.setInventorySlotContents( 0, null );
|
||||
player.inventory.setItemStack( null );
|
||||
theSlot.setInventorySlotContents( 0, ItemStack.EMPTY );
|
||||
player.inventory.setItemStack( ItemStack.EMPTY );
|
||||
|
||||
player.inventory.setItemStack( interfaceSlot.addItems( inHand.copy() ) );
|
||||
|
||||
if( player.inventory.getItemStack() == null )
|
||||
if( player.inventory.getItemStack().isEmpty() )
|
||||
{
|
||||
player.inventory.setItemStack( inSlot );
|
||||
}
|
||||
@@ -256,24 +256,24 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
|
||||
if( hasItemInHand )
|
||||
{
|
||||
ItemStack extra = playerHand.removeItems( 1, null, null );
|
||||
if( extra != null )
|
||||
ItemStack extra = playerHand.removeItems( 1, ItemStack.EMPTY, null );
|
||||
if( !extra.isEmpty() )
|
||||
{
|
||||
extra = interfaceSlot.addItems( extra );
|
||||
}
|
||||
if( extra != null )
|
||||
if( !extra.isEmpty() )
|
||||
{
|
||||
playerHand.addItems( extra );
|
||||
}
|
||||
}
|
||||
else if( is != null )
|
||||
else if( !is.isEmpty() )
|
||||
{
|
||||
ItemStack extra = interfaceSlot.removeItems( ( is.getCount() + 1 ) / 2, null, null );
|
||||
if( extra != null )
|
||||
ItemStack extra = interfaceSlot.removeItems( ( is.getCount() + 1 ) / 2, ItemStack.EMPTY, null );
|
||||
if( !extra.isEmpty() )
|
||||
{
|
||||
extra = playerHand.addItems( extra );
|
||||
}
|
||||
if( extra != null )
|
||||
if( !extra.isEmpty() )
|
||||
{
|
||||
interfaceSlot.addItems( extra );
|
||||
}
|
||||
@@ -300,7 +300,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
|
||||
if( player.capabilities.isCreativeMode && !hasItemInHand )
|
||||
{
|
||||
player.inventory.setItemStack( is == null ? null : is.copy() );
|
||||
player.inventory.setItemStack( is.isEmpty() ? ItemStack.EMPTY : is.copy() );
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -357,12 +357,12 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
|
||||
private boolean isDifferent( final ItemStack a, final ItemStack b )
|
||||
{
|
||||
if( a == null && b == null )
|
||||
if( a.isEmpty() && b.isEmpty() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( a == null || b == null )
|
||||
if( a.isEmpty() || b.isEmpty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -388,9 +388,9 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
final ItemStack is = inv.server.getStackInSlot( x + offset );
|
||||
|
||||
// "update" client side.
|
||||
inv.client.setInventorySlotContents( x + offset, is == null ? null : is.copy() );
|
||||
inv.client.setInventorySlotContents( x + offset, is.isEmpty() ? ItemStack.EMPTY : is.copy() );
|
||||
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
is.writeToNBT( itemNBT );
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi
|
||||
final IInventory mac = this.getUpgradeable().getInventoryByName( "mac" );
|
||||
|
||||
final ItemStack is = mac.getStackInSlot( 10 );
|
||||
if( is == null )
|
||||
if( is.isEmpty() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable
|
||||
{
|
||||
if( currentItem != this.civ.getItemStack() )
|
||||
{
|
||||
if( currentItem != null )
|
||||
if( !currentItem.isEmpty() )
|
||||
{
|
||||
if( Platform.itemComparisons().isEqualItem( this.civ.getItemStack(), currentItem ) )
|
||||
{
|
||||
|
||||
@@ -118,7 +118,7 @@ public class ContainerNetworkStatus extends AEBaseContainer
|
||||
{
|
||||
final IGridBlock blk = machine.getGridBlock();
|
||||
final ItemStack is = blk.getMachineRepresentation();
|
||||
if( is != null && is.getItem() != null )
|
||||
if( !is.isEmpty() && is.getItem() != null )
|
||||
{
|
||||
final IAEItemStack ais = AEItemStack.create( is );
|
||||
ais.setStackSize( 1 );
|
||||
|
||||
@@ -70,7 +70,7 @@ public class ContainerNetworkTool extends AEBaseContainer
|
||||
|
||||
if( currentItem != this.toolInv.getItemStack() )
|
||||
{
|
||||
if( currentItem != null )
|
||||
if( !currentItem.isEmpty() )
|
||||
{
|
||||
if( Platform.itemComparisons().isEqualItem( this.toolInv.getItemStack(), currentItem ) )
|
||||
{
|
||||
|
||||
@@ -190,14 +190,14 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
}
|
||||
|
||||
// first check the output slots, should either be null, or a pattern
|
||||
if( output != null && !this.isPattern( output ) )
|
||||
if( !output.isEmpty() && !this.isPattern( output ) )
|
||||
{
|
||||
return;
|
||||
} // if nothing is there we should snag a new pattern.
|
||||
else if( output == null )
|
||||
else if( output.isEmpty() )
|
||||
{
|
||||
output = this.patternSlotIN.getStack();
|
||||
if( output == null || !this.isPattern( output ) )
|
||||
if( output.isEmpty() || !this.isPattern( output ) )
|
||||
{
|
||||
return; // no blanks.
|
||||
}
|
||||
@@ -206,7 +206,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
output.setCount( output.getCount() );
|
||||
if( output.getCount() == 0 )
|
||||
{
|
||||
this.patternSlotIN.putStack( null );
|
||||
this.patternSlotIN.putStack( ItemStack.EMPTY );
|
||||
}
|
||||
|
||||
// add a new encoded pattern.
|
||||
@@ -250,7 +250,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
for( int x = 0; x < this.craftingSlots.length; x++ )
|
||||
{
|
||||
input[x] = this.craftingSlots[x].getStack();
|
||||
if( input[x] != null )
|
||||
if( !input[x].isEmpty() )
|
||||
{
|
||||
hasValue = true;
|
||||
}
|
||||
@@ -270,7 +270,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
{
|
||||
final ItemStack out = this.getAndUpdateOutput();
|
||||
|
||||
if( out != null && out.getCount() > 0 )
|
||||
if( !out.isEmpty() && out.getCount() > 0 )
|
||||
{
|
||||
return new ItemStack[] { out };
|
||||
}
|
||||
@@ -284,7 +284,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
{
|
||||
final ItemStack out = outputSlot.getStack();
|
||||
|
||||
if( out != null && out.getCount() > 0 )
|
||||
if( !out.isEmpty() && out.getCount() > 0 )
|
||||
{
|
||||
list.add( out );
|
||||
hasValue = true;
|
||||
@@ -302,7 +302,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
|
||||
private boolean isPattern( final ItemStack output )
|
||||
{
|
||||
if( output == null )
|
||||
if( output.isEmpty() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -357,7 +357,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
inv = playerInv;
|
||||
}
|
||||
|
||||
if( inv.simulateAdd( out.getItemStack() ) != null )
|
||||
if( !inv.simulateAdd( out.getItemStack() ).isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -381,7 +381,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
|
||||
for( int x = 0; x < 9; x++ )
|
||||
{
|
||||
ic.setInventorySlotContents( x, packetPatternSlot.pattern[x] == null ? null : packetPatternSlot.pattern[x].getItemStack() );
|
||||
ic.setInventorySlotContents( x, packetPatternSlot.pattern[x] == null ? ItemStack.EMPTY : packetPatternSlot.pattern[x].getItemStack() );
|
||||
}
|
||||
|
||||
final IRecipe r = Platform.findMatchingRecipe( ic, p.world );
|
||||
@@ -398,7 +398,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
|
||||
for( int x = 0; x < ic.getSizeInventory(); x++ )
|
||||
{
|
||||
if( ic.getStackInSlot( x ) != null )
|
||||
if( !ic.getStackInSlot( x ).isEmpty() )
|
||||
{
|
||||
final ItemStack pulled = Platform.extractItemsByRecipe( this.getPowerSource(), this.getActionSource(), storage, p.world, r, is, ic, ic.getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.getViewCells() ) );
|
||||
real.setInventorySlotContents( x, pulled );
|
||||
@@ -416,7 +416,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
{
|
||||
final ItemStack failed = playerInv.addItems( real.getStackInSlot( x ) );
|
||||
|
||||
if( failed != null )
|
||||
if( !failed.isEmpty() )
|
||||
{
|
||||
p.dropItem( failed, false );
|
||||
}
|
||||
@@ -434,7 +434,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
for( int x = 0; x < real.getSizeInventory(); x++ )
|
||||
{
|
||||
final ItemStack failed = real.getStackInSlot( x );
|
||||
if( failed != null )
|
||||
if( !failed.isEmpty() )
|
||||
{
|
||||
this.getCellInventory().injectItems( AEItemStack.create( failed ), Actionable.MODULATE, new MachineSource( this.getPatternTerminal() ) );
|
||||
}
|
||||
@@ -498,12 +498,12 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
{
|
||||
for( final Slot s : this.craftingSlots )
|
||||
{
|
||||
s.putStack( null );
|
||||
s.putStack( ItemStack.EMPTY );
|
||||
}
|
||||
|
||||
for( final Slot s : this.outputSlots )
|
||||
{
|
||||
s.putStack( null );
|
||||
s.putStack( ItemStack.EMPTY );
|
||||
}
|
||||
|
||||
this.detectAndSendChanges();
|
||||
|
||||
@@ -143,7 +143,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
|
||||
compound.setString( "InscribeName", this.myName );
|
||||
|
||||
return namePressStack;
|
||||
} ).orElse( null );
|
||||
} ).orElse( ItemStack.EMPTY );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
|
||||
public ItemStack decrStackSize( final int var1, final int var2 )
|
||||
{
|
||||
final ItemStack is = this.getStackInSlot( 0 );
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
if( this.makePlate() )
|
||||
{
|
||||
@@ -272,7 +272,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
this.inSlot.setInventorySlotContents( 0, null );
|
||||
this.inSlot.setInventorySlotContents( 0, ItemStack.EMPTY );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -75,7 +75,7 @@ public class ContainerSecurityStation extends ContainerMEMonitorable implements
|
||||
final SecurityPermissions permission = SecurityPermissions.valueOf( value );
|
||||
|
||||
final ItemStack a = this.configSlot.getStack();
|
||||
if( a != null && a.getItem() instanceof IBiometricCard )
|
||||
if( !a.isEmpty() && a.getItem() instanceof IBiometricCard )
|
||||
{
|
||||
final IBiometricCard bc = (IBiometricCard) a.getItem();
|
||||
if( bc.hasPermission( a, permission ) )
|
||||
@@ -102,7 +102,7 @@ public class ContainerSecurityStation extends ContainerMEMonitorable implements
|
||||
this.setPermissionMode( 0 );
|
||||
|
||||
final ItemStack a = this.configSlot.getStack();
|
||||
if( a != null && a.getItem() instanceof IBiometricCard )
|
||||
if( !a.isEmpty() && a.getItem() instanceof IBiometricCard )
|
||||
{
|
||||
final IBiometricCard bc = (IBiometricCard) a.getItem();
|
||||
|
||||
@@ -164,7 +164,7 @@ public class ContainerSecurityStation extends ContainerMEMonitorable implements
|
||||
{
|
||||
networkEncodable.setEncryptionKey( term, String.valueOf( this.securityBox.getSecurityKey() ), "" );
|
||||
|
||||
this.wirelessIn.putStack( null );
|
||||
this.wirelessIn.putStack( ItemStack.EMPTY );
|
||||
this.wirelessOut.putStack( term );
|
||||
|
||||
// update the two slots in question...
|
||||
|
||||
@@ -137,7 +137,7 @@ public class ContainerStorageBus extends ContainerUpgradeable
|
||||
final IInventory inv = this.getUpgradeable().getInventoryByName( "config" );
|
||||
for( int x = 0; x < inv.getSizeInventory(); x++ )
|
||||
{
|
||||
inv.setInventorySlotContents( x, null );
|
||||
inv.setInventorySlotContents( x, ItemStack.EMPTY );
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public class ContainerStorageBus extends ContainerUpgradeable
|
||||
}
|
||||
else
|
||||
{
|
||||
inv.setInventorySlotContents( x, null );
|
||||
inv.setInventorySlotContents( x, ItemStack.EMPTY );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
|
||||
for( int x = 0; x < pi.getSizeInventory(); x++ )
|
||||
{
|
||||
final ItemStack pii = pi.getStackInSlot( x );
|
||||
if( pii != null && pii.getItem() instanceof ToolNetworkTool )
|
||||
if( !pii.isEmpty() && pii.getItem() instanceof ToolNetworkTool )
|
||||
{
|
||||
this.lockPlayerInventorySlot( x );
|
||||
this.tbSlot = x;
|
||||
@@ -204,7 +204,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
|
||||
if( o instanceof OptionalSlotFake )
|
||||
{
|
||||
final OptionalSlotFake fs = (OptionalSlotFake) o;
|
||||
if( !fs.isEnabled() && fs.getDisplayStack() != null )
|
||||
if( !fs.isEnabled() && !fs.getDisplayStack().isEmpty() )
|
||||
{
|
||||
fs.clearStack();
|
||||
}
|
||||
@@ -233,7 +233,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
|
||||
|
||||
if( currentItem != this.tbInventory.getItemStack() )
|
||||
{
|
||||
if( currentItem != null )
|
||||
if( !currentItem.isEmpty() )
|
||||
{
|
||||
if( Platform.itemComparisons().isEqualItem( this.tbInventory.getItemStack(), currentItem ) )
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ContainerWireless extends AEBaseContainer
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
final int boosters = this.boosterSlot.getStack() == null ? 0 : this.boosterSlot.getStack().getCount();
|
||||
final int boosters = this.boosterSlot.getStack().isEmpty() ? 0 : this.boosterSlot.getStack().getCount();
|
||||
|
||||
this.setRange( (long) ( 10 * AEConfig.instance().wireless_getMaxRange( boosters ) ) );
|
||||
this.setDrain( (long) ( 100 * AEConfig.instance().wireless_getPowerDrain( boosters ) ) );
|
||||
|
||||
@@ -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