diff --git a/src/main/java/tconstruct/library/tools/ToolMod.java b/src/main/java/tconstruct/library/tools/ToolMod.java index 8fb199aa8e4..688ce325a59 100644 --- a/src/main/java/tconstruct/library/tools/ToolMod.java +++ b/src/main/java/tconstruct/library/tools/ToolMod.java @@ -211,8 +211,15 @@ public boolean validType (ToolCore tool) { return true; } - - protected boolean areItemStacksEquivalent (ItemStack stack1, ItemStack stack2) + + public boolean areItemsEquivalent (ItemStack stack1, ItemStack stack2) + { + if (stack1.itemID != stack2.itemID) + return false; + return ItemStack.areItemStackTagsEqual(stack1, stack2); + } + + public boolean areItemStacksEquivalent (ItemStack stack1, ItemStack stack2) { if (stack1.itemID != stack2.itemID) return false; diff --git a/src/main/java/tconstruct/modifiers/tools/ToolModTypeFilter.java b/src/main/java/tconstruct/modifiers/tools/ToolModTypeFilter.java index 35d0d1cf1b2..8f07fd0dbc0 100644 --- a/src/main/java/tconstruct/modifiers/tools/ToolModTypeFilter.java +++ b/src/main/java/tconstruct/modifiers/tools/ToolModTypeFilter.java @@ -44,11 +44,9 @@ public boolean matches (ItemStack[] input, ItemStack tool) for (Object check : stacks) { ItemStack stack = (ItemStack) check; - System.out.println("First stack: "+stack); - System.out.println("Second stack: "+inputStack); if (stack.getItemDamage() == Short.MAX_VALUE) { - if (inputStack.isItemEqual(stack)) + if (this.areItemsEquivalent(inputStack, stack)) match = true; } else @@ -58,40 +56,45 @@ public boolean matches (ItemStack[] input, ItemStack tool) } } if (!match) - { - System.out.println("Not a match"); return false; - } + minimumMatch = true; } - System.out.println("Object: " + minimumMatch); return minimumMatch; } public int matchingAmount (ItemStack[] input) { int amount = 0; - for (ItemStack i : input) + for (ItemStack inputStack : input) { - if (i == null) + if (inputStack == null) continue; else { for (int iter = 0; iter < stacks.size(); iter++) { - ItemStack check = (ItemStack) stacks.get(iter); - if (ItemStack.areItemStacksEqual(i, check)) - amount += increase.get(iter); + ItemStack stack = (ItemStack) stacks.get(iter); + if (stack.getItemDamage() == Short.MAX_VALUE) + { + if (this.areItemsEquivalent(inputStack, stack)) + amount += increase.get(iter); + } + else + { + if (this.areItemStacksEquivalent(inputStack, stack)) + amount += increase.get(iter); + } } } } return amount; } - /** Adds a new itemstack to the list of increases + /** Adds a new itemstack to the list for increases * * @param stack ItemStack to compare against - * @param increase Amount to increase + * @param amount Amount to increase */ public void addStackToMatchList (ItemStack stack, int amount) {