diff options
author | miozune <miozune@gmail.com> | 2023-09-02 22:19:01 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-02 22:19:01 +0900 |
commit | f78e6a955496158d7f984697eb662c1a13ac9576 (patch) | |
tree | 371670a08c2664301ff40f4aeb3d8f75f9cf8b71 | |
parent | 7ba89db6ebe192dbd18de7ba77236608ea2fc97e (diff) | |
download | GT5-Unofficial-f78e6a955496158d7f984697eb662c1a13ac9576.tar.gz GT5-Unofficial-f78e6a955496158d7f984697eb662c1a13ac9576.tar.bz2 GT5-Unofficial-f78e6a955496158d7f984697eb662c1a13ac9576.zip |
Fix renaming recipe check might ignore NBT equality (#2261)
-rw-r--r-- | src/main/java/gregtech/api/util/GT_Recipe.java | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index cac1e67ee3..278a711462 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -188,6 +188,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { */ public boolean mNeedsEmptyOutput = false; /** + * If this is set to true, NBT equality is required for recipe check. + */ + public boolean isNBTSensitive = false; + /** * Used for describing recipes that do not fit the default recipe pattern (for example Large Boiler Fuels) */ private String[] neiDesc = null; @@ -720,28 +724,33 @@ public class GT_Recipe implements Comparable<GT_Recipe> { for (int i = 0; i < aInputs.length; i++) { ItemStack providedItem = aInputs[i]; - if (GT_OreDictUnificator.isInputStackEqual(providedItem, unifiedItemCost)) { - if (GTppRecipeHelper) { // Please see JavaDoc on GTppRecipeHelper for why this is here. - if (GT_Utility.areStacksEqual(providedItem, Ic2Items.FluidCell.copy(), true) - || GT_Utility.areStacksEqual(providedItem, ItemList.Tool_DataStick.get(1L), true) - || GT_Utility.areStacksEqual(providedItem, ItemList.Tool_DataOrb.get(1L), true)) { - if (!GT_Utility.areStacksEqual(providedItem, recipeItemCost, false)) continue; - } + if (isNBTSensitive && !GT_Utility.areStacksEqual(providedItem, unifiedItemCost, false)) { + continue; + } else if (!isNBTSensitive + && !GT_OreDictUnificator.isInputStackEqual(providedItem, unifiedItemCost)) { + continue; } - inputFound = true; - if (newItemAmounts[i] == null) { - newItemAmounts[i] = providedItem.stackSize; + if (GTppRecipeHelper) { // Please see JavaDoc on GTppRecipeHelper for why this is here. + if (GT_Utility.areStacksEqual(providedItem, Ic2Items.FluidCell.copy(), true) + || GT_Utility.areStacksEqual(providedItem, ItemList.Tool_DataStick.get(1L), true) + || GT_Utility.areStacksEqual(providedItem, ItemList.Tool_DataOrb.get(1L), true)) { + if (!GT_Utility.areStacksEqual(providedItem, recipeItemCost, false)) continue; } + } - if (aDontCheckStackSizes || newItemAmounts[i] >= remainingCost) { - newItemAmounts[i] -= remainingCost; - remainingCost = 0; - break; - } else { - remainingCost -= newItemAmounts[i]; - newItemAmounts[i] = 0; - } + inputFound = true; + if (newItemAmounts[i] == null) { + newItemAmounts[i] = providedItem.stackSize; + } + + if (aDontCheckStackSizes || newItemAmounts[i] >= remainingCost) { + newItemAmounts[i] -= remainingCost; + remainingCost = 0; + break; + } else { + remainingCost -= newItemAmounts[i]; + newItemAmounts[i] = 0; } } @@ -5584,7 +5593,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { output.setStackDisplayName(mold.getDisplayName()); GT_Recipe recipe = new GT_Recipe( false, - new ItemStack[] { ItemList.Shape_Mold_Name.get(0), GT_Utility.copyAmount(1, input) }, + new ItemStack[] { GT_Utility.copyAmount(0, mold), GT_Utility.copyAmount(1, input) }, new ItemStack[] { output }, null, null, @@ -5594,6 +5603,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 8, 0); recipe.mCanBeBuffered = false; + recipe.isNBTSensitive = true; return FindRecipeResult.ofSuccess(recipe); } } |