From 47d7c667de3f4ce6f04e404a63ce43916f1f6e9c Mon Sep 17 00:00:00 2001 From: Chicken-Bomes Date: Thu, 1 May 2014 00:24:23 +1000 Subject: [PATCH] Fix issue with double checking slots for fitting stacks in simulate mode --- src/codechicken/lib/inventory/InventoryUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/codechicken/lib/inventory/InventoryUtils.java b/src/codechicken/lib/inventory/InventoryUtils.java index 3f922e3..4c1c133 100644 --- a/src/codechicken/lib/inventory/InventoryUtils.java +++ b/src/codechicken/lib/inventory/InventoryUtils.java @@ -193,6 +193,8 @@ public class InventoryUtils for (int pass = 0; pass < 2; pass++) { for (int slot : inv.slots) { ItemStack base = inv.inv.getStackInSlot(slot); + if((pass == 0) == (base == null)) + continue; int fit = fitStackInSlot(inv, slot, stack); if (fit == 0) continue; @@ -203,7 +205,7 @@ public class InventoryUtils base.stackSize += fit; inv.inv.setInventorySlotContents(slot, base); } - } else if (pass == 1) { + } else { if (!simulate) inv.inv.setInventorySlotContents(slot, copyStack(stack, fit)); stack.stackSize -= fit;