From aa705de98dfcb52142100098df225d3514985f01 Mon Sep 17 00:00:00 2001 From: Yang Xizhi <60341015+GlodBlock@users.noreply.github.com> Date: Wed, 22 Jun 2022 17:03:26 +0800 Subject: fix double consumption from wildcard and oredict (#139) * fix double consumption from wildcard and oredict sometimes the wildcard item also has oredict, it will cause double consumption * fix Former-commit-id: 36a91e713055060bc5a65b6c5bf07aebcc53898b --- .../bartworks/util/RecipeFinderForParallel.java | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'src/main/java/com') diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/RecipeFinderForParallel.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/RecipeFinderForParallel.java index 052c29eff2..2988df6b7f 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/util/RecipeFinderForParallel.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/RecipeFinderForParallel.java @@ -89,18 +89,6 @@ public class RecipeFinderForParallel { } /*OreDict Stuff*/ - for (int tItem : tCompressedItemRecipe.keySet()) { - ItemStack tRealRecipe = GT_Utility.intToStack(tItem); - int tTargetAmount = tCompressedItemRecipe.get(tItem); - for (ItemStack input : aItemStacks) { - if (GT_OreDictUnificator.isInputStackEqual(input, tRealRecipe)) { - int d = Math.min(tTargetAmount, input.stackSize); - tTargetAmount -= d; - input.stackSize -= d; - } - if (tTargetAmount == 0) break; - } - } /*Wildcard Stuff*/ for (int tItem : tCompressedItemRecipe.keySet()) { if (tItem >> 16 == Short.MAX_VALUE) { @@ -119,6 +107,22 @@ public class RecipeFinderForParallel { } } } + else { + ItemStack tRealRecipe = GT_Utility.intToStack(tItem); + int tTargetAmount = tCompressedItemRecipe.get(tItem); + for (ItemStack input : aItemStacks) { + if (GT_OreDictUnificator.isInputStackEqual(input, tRealRecipe)) { + int d = Math.min(tTargetAmount, input.stackSize); + tTargetAmount -= d; + tCompressedItemRecipe.put(tItem, tTargetAmount); + input.stackSize -= d; + } + if (tTargetAmount == 0) { + tCompressedItemRecipe.remove(tItem); + break; + } + } + } } return tCurrentPara; -- cgit