From a3ccb226e514b546a3b2dfb97f5b5ef76e0c436e Mon Sep 17 00:00:00 2001 From: mezz Date: Thu, 21 May 2015 22:19:35 -0700 Subject: [PATCH] Fix #679 dupe bug with EnderIO and worktable --- .../java/forestry/core/utils/StackUtils.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/forestry/core/utils/StackUtils.java b/src/main/java/forestry/core/utils/StackUtils.java index c4f8ef25c..e24223d99 100755 --- a/src/main/java/forestry/core/utils/StackUtils.java +++ b/src/main/java/forestry/core/utils/StackUtils.java @@ -234,8 +234,7 @@ public class StackUtils { boolean matched = false; for (ItemStack cached : condensed) { - if (cached.isItemEqual(stack) - || (craftingEquivalency && isCraftingEquivalent(cached, stack, true, false))) { + if ((cached.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(cached, stack)) || (craftingEquivalency && isCraftingEquivalent(cached, stack, true, false))) { cached.stackSize += maxCountedPerStack > 0 && stack.stackSize > maxCountedPerStack ? maxCountedPerStack : stack.stackSize; matched = true; } @@ -285,12 +284,11 @@ public class StackUtils { for (ItemStack offer : condensedOffered) { if (isCraftingEquivalent(req, offer, oreDictionary, craftingTools)) { - matched = true; int stackCount = (int) Math.floor(offer.stackSize / req.stackSize); - if (stackCount <= 0) { - return 0; - } else if (count == 0) { + matched |= (stackCount > 0); + + if (count == 0) { count = stackCount; } else if (count > stackCount) { count = stackCount; @@ -343,6 +341,12 @@ public class StackUtils { return false; } + if (base.hasTagCompound() && !base.stackTagCompound.hasNoTags()) { + if (!ItemStack.areItemStacksEqual(base, comparison)) { + return false; + } + } + if (oreDictionary) { int[] idsBase = OreDictionary.getOreIDs(base); Arrays.sort(idsBase);