Skip to content

Commit

Permalink
Fix item removal order for recipe matches
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Jul 3, 2016
1 parent 72e268f commit 01f0539
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/slimeknights/mantle/util/RecipeMatch.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ public static RecipeMatch ofNBT(ItemStack stack, int matched) {

/** Removes the match from the stacks */
public static void removeMatch(ItemStack[] stacks, Match match) {
// ensure that the order is the same, so that even if multiple of the same type are contained it has the expected result
int i = 0;
for(ItemStack stack : match.stacks) {
for(int i = 0; i < stacks.length; i++) {
for(; i < stacks.length; i++) {
// nbt sensitive since toolparts etc. use nbt
if(ItemStack.areItemsEqual(stack, stacks[i]) && ItemStack.areItemStackTagsEqual(stack, stacks[i])) {
if(stacks[i].stackSize < stack.stackSize) {
Expand All @@ -124,6 +126,7 @@ public static void removeMatch(ItemStack[] stacks, Match match) {
stacks[i] = null;
}
}
i++;
break;
}
}
Expand Down

0 comments on commit 01f0539

Please sign in to comment.