Fix filter amounts

This commit is contained in:
mDiyo committed 2013-12-12 03:22:27 -08:00
1 parent 30e51d33aa
commit 50fdf1b161
2 files changed
+26 -16

No files matched your search

@@ -211,8 +211,15 @@ public abstract class ToolMod
{
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;
@@ -44,11 +44,9 @@ public abstract class ToolModTypeFilter extends ToolMod//boobs.java
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 abstract class ToolModTypeFilter extends ToolMod//boobs.java
}
}
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)
{