diff --git a/src/main/java/com/MO/MatterOverdrive/data/Inventory.java b/src/main/java/com/MO/MatterOverdrive/data/Inventory.java index 69e6c32b..cb6f9372 100644 --- a/src/main/java/com/MO/MatterOverdrive/data/Inventory.java +++ b/src/main/java/com/MO/MatterOverdrive/data/Inventory.java @@ -107,29 +107,35 @@ public ItemStack getStackInSlot(int slot) @Override public ItemStack decrStackSize(int slot, int size) { - if(this.slots.get(slot) != null) + if (this.slots.get(slot) != null && this.slots.get(slot).getItem() != null) { ItemStack itemstack; - if(this.slots.get(slot).getItem().stackSize <= size) + if (this.slots.get(slot).getItem().stackSize <= size) { itemstack = this.slots.get(slot).getItem(); this.slots.get(slot).setItem(null); + + entity.updateContainingBlockInfo(); return itemstack; - }else + } + else { - this.slots.get(slot).getItem().splitStack(size); + itemstack = this.slots.get(slot).getItem().splitStack(size); - if(this.slots.get(slot).getItem().stackSize == 0) + if (this.slots.get(slot).getItem().stackSize == 0) { this.slots.get(slot).setItem(null); } + + entity.updateContainingBlockInfo(); + return itemstack; } } - - entity.updateContainingBlockInfo(); - - return null; + else + { + return null; + } } @Override