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
@@ -22,6 +22,7 @@ package appeng.util.inv;
import java.util.Iterator;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import appeng.api.config.FuzzyMode;
@@ -45,12 +46,12 @@ public class AdaptorIInventory extends InventoryAdaptor
public ItemStack removeItems( int amount, ItemStack filter, final IInventoryDestination destination )
{
final int s = this.i.getSizeInventory();
ItemStack rv = null;
ItemStack rv = ItemStack.EMPTY;
for( int x = 0; x < s && amount > 0; x++ )
{
final ItemStack is = this.i.getStackInSlot( x );
if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.itemComparisons().isSameItem( is, filter ) ) )
if( !is.isEmpty() && this.canRemoveStackFromSlot( x, is ) && ( filter.isEmpty() || Platform.itemComparisons().isSameItem( is, filter ) ) )
{
int boundAmounts = amount;
if( boundAmounts > is.getCount() )
@@ -64,7 +65,7 @@ public class AdaptorIInventory extends InventoryAdaptor
if( boundAmounts > 0 )
{
if( rv == null )
if( rv.isEmpty() )
{
rv = is.copy();
filter = rv;
@@ -79,7 +80,7 @@ public class AdaptorIInventory extends InventoryAdaptor
if( is.getCount() == boundAmounts )
{
this.i.setInventorySlotContents( x, null );
this.i.setInventorySlotContents( x, ItemStack.EMPTY );
this.i.markDirty();
}
else
@@ -103,12 +104,12 @@ public class AdaptorIInventory extends InventoryAdaptor
public ItemStack simulateRemove( int amount, final ItemStack filter, final IInventoryDestination destination )
{
final int s = this.i.getSizeInventory();
ItemStack rv = null;
ItemStack rv = ItemStack.EMPTY;
for( int x = 0; x < s && amount > 0; x++ )
{
final ItemStack is = this.i.getStackInSlot( x );
if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.itemComparisons().isSameItem( is, filter ) ) )
if( !is.isEmpty() && this.canRemoveStackFromSlot( x, is ) && ( filter.isEmpty() || Platform.itemComparisons().isSameItem( is, filter ) ) )
{
int boundAmount = amount;
if( boundAmount > is.getCount() )
@@ -122,7 +123,7 @@ public class AdaptorIInventory extends InventoryAdaptor
if( boundAmount > 0 )
{
if( rv == null )
if( rv.isEmpty() )
{
rv = is.copy();
rv.setCount( boundAmount );
@@ -147,8 +148,8 @@ public class AdaptorIInventory extends InventoryAdaptor
for( int x = 0; x < s; x++ )
{
final ItemStack is = this.i.getStackInSlot( x );
if( is != null && this.canRemoveStackFromSlot( x,
is ) && ( filter == null || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
if( !is.isEmpty() && this.canRemoveStackFromSlot( x,
is ) && ( filter.isEmpty() || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
{
int newAmount = amount;
if( newAmount > is.getCount() )
@@ -160,7 +161,7 @@ public class AdaptorIInventory extends InventoryAdaptor
newAmount = 0;
}
ItemStack rv = null;
ItemStack rv = ItemStack.EMPTY;
if( newAmount > 0 )
{
rv = is.copy();
@@ -168,7 +169,7 @@ public class AdaptorIInventory extends InventoryAdaptor
if( is.getCount() == rv.getCount() )
{
this.i.setInventorySlotContents( x, null );
this.i.setInventorySlotContents( x, ItemStack.EMPTY );
this.i.markDirty();
}
else
@@ -180,14 +181,14 @@ public class AdaptorIInventory extends InventoryAdaptor
}
}
if( rv != null )
if( !rv.isEmpty() )
{
// i.markDirty();
return rv;
}
}
}
return null;
return ItemStack.EMPTY;
}
@Override
@@ -198,8 +199,8 @@ public class AdaptorIInventory extends InventoryAdaptor
{
final ItemStack is = this.i.getStackInSlot( x );
if( is != null && this.canRemoveStackFromSlot( x,
is ) && ( filter == null || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
if( !is.isEmpty() && this.canRemoveStackFromSlot( x,
is ) && ( filter.isEmpty() || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
{
int boundAmount = amount;
if( boundAmount > is.getCount() )
@@ -219,7 +220,7 @@ public class AdaptorIInventory extends InventoryAdaptor
}
}
}
return null;
return ItemStack.EMPTY;
}
@Override
@@ -240,7 +241,7 @@ public class AdaptorIInventory extends InventoryAdaptor
final int s = this.i.getSizeInventory();
for( int x = 0; x < s; x++ )
{
if( this.i.getStackInSlot( x ) != null )
if( !this.i.getStackInSlot( x ).isEmpty() )
{
return true;
}
@@ -262,7 +263,7 @@ public class AdaptorIInventory extends InventoryAdaptor
*/
private ItemStack addItems( final ItemStack itemsToAdd, final boolean modulate )
{
if( itemsToAdd == null || itemsToAdd.getCount() == 0 )
if( itemsToAdd.isEmpty() || itemsToAdd.getCount() == 0 )
{
return ItemStack.EMPTY;
}
@@ -280,7 +281,7 @@ public class AdaptorIInventory extends InventoryAdaptor
if( this.i.isItemValidForSlot( slot, next ) )
{
final ItemStack is = this.i.getStackInSlot( slot );
if( is == null )
if( is.isEmpty() )
{
left.grow( -next.getCount() );
@@ -42,12 +42,12 @@ public class AdaptorItemHandler extends InventoryAdaptor
public ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination )
{
int slots = itemHandler.getSlots();
ItemStack rv = null;
ItemStack rv = ItemStack.EMPTY;
for( int slot = 0; slot < slots && amount > 0; slot++ )
{
final ItemStack is = itemHandler.getStackInSlot( slot );
if( is == null || ( filter != null && !Platform.itemComparisons().isSameItem( is, filter ) ) )
if( is.isEmpty() || ( !filter.isEmpty() && !Platform.itemComparisons().isSameItem( is, filter ) ) )
{
continue;
}
@@ -55,7 +55,7 @@ public class AdaptorItemHandler extends InventoryAdaptor
if( destination != null )
{
ItemStack extracted = itemHandler.extractItem( slot, amount, true );
if( extracted == null )
if( extracted.isEmpty() )
{
continue;
}
@@ -69,12 +69,12 @@ public class AdaptorItemHandler extends InventoryAdaptor
// Attempt extracting it
ItemStack extracted = itemHandler.extractItem( slot, amount, false );
if( extracted == null )
if( extracted.isEmpty() )
{
continue;
}
if( rv == null )
if( rv.isEmpty() )
{
// Use the first stack as a template for the result
rv = extracted;
@@ -96,16 +96,16 @@ public class AdaptorItemHandler extends InventoryAdaptor
public ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination )
{
int slots = itemHandler.getSlots();
ItemStack rv = null;
ItemStack rv = ItemStack.EMPTY;
for( int slot = 0; slot < slots && amount > 0; slot++ )
{
final ItemStack is = itemHandler.getStackInSlot( slot );
if( is != null && ( filter == null || Platform.itemComparisons().isSameItem( is, filter ) ) )
if( !is.isEmpty() && ( filter.isEmpty() || Platform.itemComparisons().isSameItem( is, filter ) ) )
{
ItemStack extracted = itemHandler.extractItem( slot, amount, true );
if( extracted == null )
if( extracted.isEmpty() )
{
continue;
}
@@ -118,7 +118,7 @@ public class AdaptorItemHandler extends InventoryAdaptor
}
}
if( rv == null )
if( rv.isEmpty() )
{
// Use the first stack as a template for the result
rv = extracted.copy();
@@ -145,12 +145,12 @@ public class AdaptorItemHandler extends InventoryAdaptor
public ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
{
int slots = itemHandler.getSlots();
ItemStack extracted = null;
ItemStack extracted = ItemStack.EMPTY;
for( int slot = 0; slot < slots && extracted == null; slot++ )
for( int slot = 0; slot < slots && extracted.isEmpty(); slot++ )
{
final ItemStack is = itemHandler.getStackInSlot( slot );
if( is == null || ( filter != null && !Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
if( is.isEmpty() || ( !filter.isEmpty() && !Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
{
continue;
}
@@ -158,7 +158,7 @@ public class AdaptorItemHandler extends InventoryAdaptor
if( destination != null )
{
ItemStack simulated = itemHandler.extractItem( slot, amount, true );
if( simulated == null )
if( simulated.isEmpty() )
{
continue;
}
@@ -180,12 +180,12 @@ public class AdaptorItemHandler extends InventoryAdaptor
public ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
{
int slots = itemHandler.getSlots();
ItemStack extracted = null;
ItemStack extracted = ItemStack.EMPTY;
for( int slot = 0; slot < slots && extracted == null; slot++ )
for( int slot = 0; slot < slots && extracted.isEmpty(); slot++ )
{
final ItemStack is = itemHandler.getStackInSlot( slot );
if( is == null || ( filter != null && !Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
if( is.isEmpty() || ( !filter.isEmpty() && !Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
{
continue;
}
@@ -193,11 +193,11 @@ public class AdaptorItemHandler extends InventoryAdaptor
// Attempt extracting it
extracted = itemHandler.extractItem( slot, amount, true );
if( extracted != null && destination != null )
if( !extracted.isEmpty() && destination != null )
{
if( !destination.canInsert( extracted ) )
{
extracted = null; // Keep on looking...
extracted = ItemStack.EMPTY; // Keep on looking...
}
}
}
@@ -219,9 +219,9 @@ public class AdaptorItemHandler extends InventoryAdaptor
private ItemStack addItems( final ItemStack itemsToAdd, final boolean simulate )
{
if( itemsToAdd == null || itemsToAdd.getCount() == 0 )
if( itemsToAdd.isEmpty() || itemsToAdd.getCount() == 0 )
{
return null;
return ItemStack.EMPTY;
}
ItemStack left = itemsToAdd.copy();
@@ -230,13 +230,13 @@ public class AdaptorItemHandler extends InventoryAdaptor
{
ItemStack is = itemHandler.getStackInSlot( slot );
if( is == null || Platform.itemComparisons().isSameItem( is, left ) )
if( is.isEmpty() || Platform.itemComparisons().isSameItem( is, left ) )
{
left = itemHandler.insertItem( slot, left, simulate );
if( left == null || left.getCount() <= 0 )
if( left.isEmpty() || left.getCount() <= 0 )
{
return null;
return ItemStack.EMPTY;
}
}
}
@@ -250,7 +250,7 @@ public class AdaptorItemHandler extends InventoryAdaptor
int slots = itemHandler.getSlots();
for( int slot = 0; slot < slots; slot++ )
{
if( itemHandler.getStackInSlot( slot ) != null )
if( !itemHandler.getStackInSlot( slot ).isEmpty() )
{
return true;
}
+15 -15
View File
@@ -47,7 +47,7 @@ public class AdaptorList extends InventoryAdaptor
for( int x = 0; x < s; x++ )
{
final ItemStack is = this.i.get( x );
if( is != null && ( filter == null || Platform.itemComparisons().isSameItem( is, filter ) ) )
if( !is.isEmpty() && ( filter.isEmpty() || Platform.itemComparisons().isSameItem( is, filter ) ) )
{
if( amount > is.getCount() )
{
@@ -74,7 +74,7 @@ public class AdaptorList extends InventoryAdaptor
}
}
}
return null;
return ItemStack.EMPTY;
}
@Override
@@ -82,7 +82,7 @@ public class AdaptorList extends InventoryAdaptor
{
for( final ItemStack is : this.i )
{
if( is != null && ( filter == null || Platform.itemComparisons().isSameItem( is, filter ) ) )
if( !is.isEmpty() && ( filter.isEmpty() || Platform.itemComparisons().isSameItem( is, filter ) ) )
{
if( amount > is.getCount() )
{
@@ -101,7 +101,7 @@ public class AdaptorList extends InventoryAdaptor
}
}
}
return null;
return ItemStack.EMPTY;
}
@Override
@@ -111,7 +111,7 @@ public class AdaptorList extends InventoryAdaptor
for( int x = 0; x < s; x++ )
{
final ItemStack is = this.i.get( x );
if( is != null && ( filter == null || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
if( !is.isEmpty() && ( filter.isEmpty() || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
{
if( amount > is.getCount() )
{
@@ -138,7 +138,7 @@ public class AdaptorList extends InventoryAdaptor
}
}
}
return null;
return ItemStack.EMPTY;
}
@Override
@@ -146,7 +146,7 @@ public class AdaptorList extends InventoryAdaptor
{
for( final ItemStack is : this.i )
{
if( is != null && ( filter == null || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
if( !is.isEmpty() && ( filter.isEmpty() || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
{
if( amount > is.getCount() )
{
@@ -165,19 +165,19 @@ public class AdaptorList extends InventoryAdaptor
}
}
}
return null;
return ItemStack.EMPTY;
}
@Override
public ItemStack addItems( final ItemStack toBeAdded )
{
if( toBeAdded == null )
if( toBeAdded.isEmpty() )
{
return null;
return ItemStack.EMPTY;
}
if( toBeAdded.getCount() == 0 )
{
return null;
return ItemStack.EMPTY;
}
final ItemStack left = toBeAdded.copy();
@@ -187,18 +187,18 @@ public class AdaptorList extends InventoryAdaptor
if( Platform.itemComparisons().isEqualItem( is, left ) )
{
is.grow( left.getCount() );
return null;
return ItemStack.EMPTY;
}
}
this.i.add( left );
return null;
return ItemStack.EMPTY;
}
@Override
public ItemStack simulateAdd( final ItemStack toBeSimulated )
{
return null;
return ItemStack.EMPTY;
}
@Override
@@ -206,7 +206,7 @@ public class AdaptorList extends InventoryAdaptor
{
for( final ItemStack is : this.i )
{
if( is != null )
if( !is.isEmpty() )
{
return true;
}
@@ -47,24 +47,24 @@ public class AdaptorPlayerHand extends InventoryAdaptor
public ItemStack removeItems( final int amount, final ItemStack filter, final IInventoryDestination destination )
{
final ItemStack hand = this.player.inventory.getItemStack();
if( hand == null )
if( hand.isEmpty() )
{
return null;
return ItemStack.EMPTY;
}
if( filter == null || Platform.itemComparisons().isSameItem( filter, hand ) )
if( filter.isEmpty() || Platform.itemComparisons().isSameItem( filter, hand ) )
{
final ItemStack result = hand.copy();
result.setCount( hand.getCount() > amount ? amount : hand.getCount() );
hand.grow( -amount );
if( hand.getCount() <= 0 )
{
this.player.inventory.setItemStack( null );
this.player.inventory.setItemStack( ItemStack.EMPTY );
}
return result;
}
return null;
return ItemStack.EMPTY;
}
@Override
@@ -72,9 +72,9 @@ public class AdaptorPlayerHand extends InventoryAdaptor
{
final ItemStack hand = this.player.inventory.getItemStack();
if( hand == null )
if( hand.isEmpty() )
{
return null;
return ItemStack.EMPTY;
}
if( filter == null || Platform.itemComparisons().isSameItem( filter, hand ) )
@@ -84,31 +84,31 @@ public class AdaptorPlayerHand extends InventoryAdaptor
return result;
}
return null;
return ItemStack.EMPTY;
}
@Override
public ItemStack removeSimilarItems( final int amount, final ItemStack filter, final FuzzyMode fuzzyMode, final IInventoryDestination destination )
{
final ItemStack hand = this.player.inventory.getItemStack();
if( hand == null )
if( hand.isEmpty() )
{
return null;
return ItemStack.EMPTY;
}
if( filter == null || Platform.itemComparisons().isFuzzyEqualItem( filter, hand, fuzzyMode ) )
if( filter.isEmpty() || Platform.itemComparisons().isFuzzyEqualItem( filter, hand, fuzzyMode ) )
{
final ItemStack result = hand.copy();
result.setCount( hand.getCount() > amount ? amount : hand.getCount() );
hand.grow( -amount );
if( hand.getCount() <= 0 )
{
this.player.inventory.setItemStack( null );
this.player.inventory.setItemStack( ItemStack.EMPTY );
}
return result;
}
return null;
return ItemStack.EMPTY;
}
@Override
@@ -116,32 +116,32 @@ public class AdaptorPlayerHand extends InventoryAdaptor
{
final ItemStack hand = this.player.inventory.getItemStack();
if( hand == null )
if( hand.isEmpty() )
{
return null;
return ItemStack.EMPTY;
}
if( filter == null || Platform.itemComparisons().isFuzzyEqualItem( filter, hand, fuzzyMode ) )
if( filter.isEmpty() || Platform.itemComparisons().isFuzzyEqualItem( filter, hand, fuzzyMode ) )
{
final ItemStack result = hand.copy();
result.setCount( hand.getCount() > amount ? amount : hand.getCount() );
return result;
}
return null;
return ItemStack.EMPTY;
}
@Override
public ItemStack addItems( final ItemStack toBeAdded )
{
if( toBeAdded == null )
if( toBeAdded.isEmpty() )
{
return null;
return ItemStack.EMPTY;
}
if( toBeAdded.getCount() == 0 )
{
return null;
return ItemStack.EMPTY;
}
if( this.player == null )
{
@@ -154,14 +154,14 @@ public class AdaptorPlayerHand extends InventoryAdaptor
final ItemStack hand = this.player.inventory.getItemStack();
if( hand != null && !Platform.itemComparisons().isSameItem( toBeAdded, hand ) )
if( !hand.isEmpty() && !Platform.itemComparisons().isSameItem( toBeAdded, hand ) )
{
return toBeAdded;
}
int original = 0;
ItemStack newHand = null;
if( hand == null )
ItemStack newHand = ItemStack.EMPTY;
if( hand.isEmpty() )
{
newHand = toBeAdded.copy();
}
@@ -182,26 +182,26 @@ public class AdaptorPlayerHand extends InventoryAdaptor
}
this.player.inventory.setItemStack( newHand );
return null;
return ItemStack.EMPTY;
}
@Override
public ItemStack simulateAdd( final ItemStack toBeSimulated )
{
final ItemStack hand = this.player.inventory.getItemStack();
if( toBeSimulated == null )
if( toBeSimulated.isEmpty() )
{
return null;
return ItemStack.EMPTY;
}
if( hand != null && !Platform.itemComparisons().isEqualItem( toBeSimulated, hand ) )
if( !hand.isEmpty() && !Platform.itemComparisons().isEqualItem( toBeSimulated, hand ) )
{
return toBeSimulated;
}
int original = 0;
ItemStack newHand = null;
if( hand == null )
ItemStack newHand = ItemStack.EMPTY;
if( hand.isEmpty() )
{
newHand = toBeSimulated.copy();
}
@@ -220,13 +220,13 @@ public class AdaptorPlayerHand extends InventoryAdaptor
return B;
}
return null;
return ItemStack.EMPTY;
}
@Override
public boolean containsItems()
{
return this.player.inventory.getItemStack() != null;
return !this.player.inventory.getItemStack().isEmpty();
}
@Override
@@ -70,7 +70,7 @@ public class IMEAdaptor extends InventoryAdaptor
{
IAEItemStack req = null;
if( filter == null )
if( filter.isEmpty() )
{
final IItemList<IAEItemStack> list = this.getList();
if( !list.isEmpty() )
@@ -96,7 +96,7 @@ public class IMEAdaptor extends InventoryAdaptor
return out.getItemStack();
}
return null;
return ItemStack.EMPTY;
}
@Override
@@ -108,7 +108,7 @@ public class IMEAdaptor extends InventoryAdaptor
@Override
public ItemStack removeSimilarItems( final int amount, final ItemStack filter, final FuzzyMode fuzzyMode, final IInventoryDestination destination )
{
if( filter == null )
if( filter.isEmpty() )
{
return this.doRemoveItems( amount, null, destination, Actionable.MODULATE );
}
@@ -120,7 +120,7 @@ public class IMEAdaptor extends InventoryAdaptor
final IAEItemStack reqFilter = AEItemStack.create( filter );
if( reqFilter == null )
{
return null;
return ItemStack.EMPTY;
}
IAEItemStack out = null;
@@ -138,15 +138,15 @@ public class IMEAdaptor extends InventoryAdaptor
}
}
return null;
return ItemStack.EMPTY;
}
@Override
public ItemStack simulateSimilarRemove( final int amount, final ItemStack filter, final FuzzyMode fuzzyMode, final IInventoryDestination destination )
{
if( filter == null )
if( filter.isEmpty() )
{
return this.doRemoveItems( amount, null, destination, Actionable.SIMULATE );
return this.doRemoveItems( amount, ItemStack.EMPTY, destination, Actionable.SIMULATE );
}
return this.doRemoveItemsFuzzy( amount, filter, destination, Actionable.SIMULATE, fuzzyMode );
}
@@ -163,7 +163,7 @@ public class IMEAdaptor extends InventoryAdaptor
return out.getItemStack();
}
}
return null;
return ItemStack.EMPTY;
}
@Override
@@ -178,7 +178,7 @@ public class IMEAdaptor extends InventoryAdaptor
return out.getItemStack();
}
}
return null;
return ItemStack.EMPTY;
}
@Override
@@ -23,6 +23,7 @@ import java.util.Iterator;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import net.minecraft.item.ItemStack;
public final class IMEAdaptorIterator implements Iterator<ItemSlot>
@@ -68,7 +69,7 @@ public final class IMEAdaptorIterator implements Iterator<ItemSlot>
return this.slot;
}
this.slot.setItemStack( null );
this.slot.setItemStack( ItemStack.EMPTY );
return this.slot;
}
@@ -41,7 +41,7 @@ public class IMEInventoryDestination implements IInventoryDestination
public boolean canInsert( final ItemStack stack )
{
if( stack == null )
if( stack.isEmpty() )
{
return false;
}
@@ -52,7 +52,7 @@ class ItemHandlerIterator implements Iterator<ItemSlot>
{
throw new NoSuchElementException();
}
itemSlot.setExtractable( itemHandler.extractItem( slot, 1, true ) != null );
itemSlot.setExtractable( !itemHandler.extractItem( slot, 1, true ).isEmpty() );
itemSlot.setItemStack( itemHandler.getStackInSlot( slot ) );
itemSlot.setSlot( slot );
slot++;
+3 -3
View File
@@ -36,7 +36,7 @@ public class ItemSlot
public ItemStack getItemStack()
{
return this.itemStack == null ? ( this.aeItemStack == null ? null : ( this.itemStack = this.aeItemStack.getItemStack() ) ) : this.itemStack;
return this.itemStack.isEmpty() ? ( this.aeItemStack == null ? ItemStack.EMPTY : ( this.itemStack = this.aeItemStack.getItemStack() ) ) : this.itemStack;
}
public void setItemStack( final ItemStack is )
@@ -47,13 +47,13 @@ public class ItemSlot
public IAEItemStack getAEItemStack()
{
return this.aeItemStack == null ? ( this.itemStack == null ? null : ( this.aeItemStack = AEItemStack.create( this.itemStack ) ) ) : this.aeItemStack;
return this.aeItemStack == null ? ( this.itemStack.isEmpty() ? null : ( this.aeItemStack = AEItemStack.create( this.itemStack ) ) ) : this.aeItemStack;
}
void setAEItemStack( final IAEItemStack is )
{
this.aeItemStack = is;
this.itemStack = null;
this.itemStack = ItemStack.EMPTY;
}
public boolean isExtractable()
@@ -132,7 +132,7 @@ public class WrapperChainedInventory implements IInventory
{
return io.i.getStackInSlot( idx - io.offset );
}
return null;
return ItemStack.EMPTY;
}
@Override
@@ -143,7 +143,7 @@ public class WrapperChainedInventory implements IInventory
{
return io.i.decrStackSize( idx - io.offset, var2 );
}
return null;
return ItemStack.EMPTY;
}
@Override
@@ -154,7 +154,7 @@ public class WrapperChainedInventory implements IInventory
{
return io.i.removeStackFromSlot( idx - io.offset );
}
return null;
return ItemStack.EMPTY;
}
@Override
@@ -67,7 +67,7 @@ public class WrapperMCISidedInventory extends WrapperInventoryRange implements I
@Override
public boolean canRemoveItemFromSlot( final int i, final ItemStack is )
{
if( is == null )
if( is.isEmpty() )
{
return false;
}