Skip to content

Commit

Permalink
Prevent duplicate bowls returned for plant paste recipe.
Browse files Browse the repository at this point in the history
  • Loading branch information
wendall911 committed Jun 2, 2018
1 parent 269efa7 commit 823e231
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/tinkersurvival/recipe/ShapedOreRecipeHelper.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package tinkersurvival.recipe;

import java.util.HashMap;
import java.util.Map;

import net.minecraft.init.Items;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
Expand All @@ -24,6 +27,7 @@ public ShapedOreRecipeHelper(ResourceLocation group, ItemStack result, Object...
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
NonNullList<ItemStack> remains = super.getRemainingItems(inv);
Map<Integer, ItemStack> returnItems = new HashMap<>();

for (int i = 0; i < remains.size(); i++) {
ItemStack slot = inv.getStackInSlot(i);
Expand All @@ -46,15 +50,18 @@ public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
&& (tool.getItem() instanceof Saw || tool.getItem() instanceof Knife)) {
ItemStack tool2 = tool.copy();
tool = ItemStack.EMPTY;
remains.set(i + 1, tool2);
returnItems.put(i + 1, tool2);
}
}
else {
tool = slot.copy();
}
remains.set(i, tool);
returnItems.put(i, tool);
}
}
for (Map.Entry<Integer, ItemStack> entry : returnItems.entrySet()) {
remains.set(entry.getKey(), entry.getValue());
}

return remains;
}
Expand Down

0 comments on commit 823e231

Please sign in to comment.