From a1064d96a2bcb52074cc88cc319dcbe05db90584 Mon Sep 17 00:00:00 2001 From: CrazyPants Date: Sun, 17 Nov 2013 10:20:28 +0800 Subject: [PATCH] Fixed item conduit. --- .../conduit/item/ItemConduitNetwork.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/common/crazypants/enderio/conduit/item/ItemConduitNetwork.java b/common/crazypants/enderio/conduit/item/ItemConduitNetwork.java index cee7fa12..f17ada78 100644 --- a/common/crazypants/enderio/conduit/item/ItemConduitNetwork.java +++ b/common/crazypants/enderio/conduit/item/ItemConduitNetwork.java @@ -207,11 +207,15 @@ public class ItemConduitNetwork extends AbstractConduitNetwork { return false; } - toExtract.stackSize = extractedItem.stackSize - numInserted; - if (toExtract.stackSize > 0) { - inv.setInventorySlotContents(slot, toExtract); - } else { - inv.setInventorySlotContents(slot, null); + ItemStack curStack = inv.getStackInSlot(slot); + if(curStack != null) { + curStack = curStack.copy(); + curStack.stackSize -= numInserted; + if(curStack.stackSize > 0) { + inv.setInventorySlotContents(slot, curStack); + } else { + inv.setInventorySlotContents(slot, null); + } } con.itemsExtracted(numInserted, slot); return true; @@ -229,11 +233,6 @@ public class ItemConduitNetwork extends AbstractConduitNetwork { int inserted = target.inv.insertItem(toExtract); if (inserted > 0) { toExtract.stackSize -= inserted; - if (toExtract.stackSize > 0) { - inv.setInventorySlotContents(slot, toExtract); - } else { - inv.setInventorySlotContents(slot, null); - } leftToInsert -= inserted; } if (leftToInsert <= 0) { @@ -266,7 +265,7 @@ public class ItemConduitNetwork extends AbstractConduitNetwork { if (contents == null) { inserted = toInsert.stackSize; } else { - if (contents.isItemEqual(item)) { + if (contents.isItemEqual(item) && ItemStack.areItemStackTagsEqual(contents, item)) { int space = inv.getInventoryStackLimit() - contents.stackSize; space = Math.min(space, contents.getMaxStackSize() - contents.stackSize); inserted += Math.min(space, toInsert.stackSize); @@ -300,7 +299,7 @@ public class ItemConduitNetwork extends AbstractConduitNetwork { if (contents == null) { inserted = toInsert.stackSize; } else { - if (ItemStack.areItemStacksEqual(contents, item)) { + if (contents.isItemEqual(item) && ItemStack.areItemStackTagsEqual(contents, item)) { int space = inv.getInventoryStackLimit() - contents.stackSize; space = Math.min(space, contents.getMaxStackSize() - contents.stackSize); inserted += Math.min(space, toInsert.stackSize);