Fixed a null check when the array wasn't initialised yet. I should fix this up in the future though.

This commit is contained in:
Gunther De Wachter 2017-06-26 05:43:08 +02:00
parent 5432decf95
commit df7ab00c37

View file

@ -113,10 +113,17 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
return ItemStack.EMPTY;
}
private ItemStack getOldStack( int slot ) {
if( this.inv[slot] == null )
return ItemStack.EMPTY;
else return this.inv[slot];
}
@Override
public void setInventorySlotContents( final int slot, final ItemStack newItemStack )
{
final ItemStack oldStack = this.inv[slot];
final ItemStack oldStack = getOldStack(slot);
this.inv[slot] = newItemStack;
if( this.getTileEntity() != null && this.eventsEnabled() )
@ -130,7 +137,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
{
removed = removed.copy();
removed.grow( -newItemStack.getCount() );
added = null;
added = ItemStack.EMPTY;
}
else if( oldStack.getCount() < newItemStack.getCount() )
{