From d86b31ce5067e53558e282faad6e45763f04dd30 Mon Sep 17 00:00:00 2001 From: hilburn Date: Tue, 30 Dec 2014 03:34:16 +0000 Subject: [PATCH] Ignore Bee Generations #1416 if a generation tag exists, discards it before NBT comparison - it's not exactly pretty but pretty much what Forestry does with it's logic --- .../enderio/conduit/item/filter/ItemFilter.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/crazypants/enderio/conduit/item/filter/ItemFilter.java b/src/main/java/crazypants/enderio/conduit/item/filter/ItemFilter.java index 3561cb31..e95c4628 100644 --- a/src/main/java/crazypants/enderio/conduit/item/filter/ItemFilter.java +++ b/src/main/java/crazypants/enderio/conduit/item/filter/ItemFilter.java @@ -84,7 +84,7 @@ public class ItemFilter implements IInventory, IItemFilter { matched = true; if(matchMeta && item.getItemDamage() != it.getItemDamage()) { matched = false; - } else if(matchNBT && !ItemStack.areItemStackTagsEqual(item, it)) { + } else if(matchNBT && !isNBTMatch(item, it)) { matched = false; } } @@ -120,6 +120,18 @@ public class ItemFilter implements IInventory, IItemFilter { } return false; } + + private boolean isNBTMatch(ItemStack filter, ItemStack item) + { + if (filter.stackTagCompound == null && item.stackTagCompound == null) return true; + if (filter.stackTagCompound == null || item.stackTagCompound == null) return false; + if (!filter.getTagCompound().hasKey("GEN")) return filter.stackTagCompound.equals(item.stackTagCompound); + NBTTagCompound filterTag = (NBTTagCompound) filter.getTagCompound().copy(); + NBTTagCompound itemTag = (NBTTagCompound) item.getTagCompound().copy(); + filterTag.removeTag("GEN"); + itemTag.removeTag("GEN"); + return filterTag.equals(itemTag); + } private int[] getCachedIds(int filterItemIndex) { int[] res = oreIds.get(filterItemIndex);