From a9dfc0fe81a0b89ea51d6cdfd1a3a960f1e2cc14 Mon Sep 17 00:00:00 2001 From: boubou19 Date: Thu, 22 Aug 2024 09:08:45 +0200 Subject: avoid item oredict and allocation spam (#2937) * avoid item oredict and allocation spam * Spotless apply for branch fix/comparison_spam for #2937 (#2938) spotlessApply Co-authored-by: GitHub GTNH Actions <> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Martin Robertz --- src/main/java/gregtech/api/util/GT_Recipe.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/main/java/gregtech/api/util/GT_Recipe.java') diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index 74f15e428c..3bc78ad160 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -50,6 +50,16 @@ import it.unimi.dsi.fastutil.objects.Reference2LongOpenHashMap; public class GT_Recipe implements Comparable { + private static ItemStack dataStick; + private static ItemStack dataOrb; + private static ItemStack ic2FluidCell; + + public static void setItemStacks() { + ic2FluidCell = Ic2Items.FluidCell.copy(); + dataStick = ItemList.Tool_DataStick.get(1L); + dataOrb = ItemList.Tool_DataOrb.get(1L); + } + /** * If you want to change the Output, feel free to modify or even replace the whole ItemStack Array, for Inputs, * please add a new Recipe, because of the HashMaps. @@ -584,9 +594,9 @@ public class GT_Recipe implements Comparable { */ private boolean shouldCheckNBT(ItemStack item) { if (GTppRecipeHelper) { - return GT_Utility.areStacksEqual(item, Ic2Items.FluidCell.copy(), true) - || GT_Utility.areStacksEqual(item, ItemList.Tool_DataStick.get(1L), true) - || GT_Utility.areStacksEqual(item, ItemList.Tool_DataOrb.get(1L), true); + return GT_Utility.areStacksEqual(item, ic2FluidCell, true) + || GT_Utility.areStacksEqual(item, dataStick, true) + || GT_Utility.areStacksEqual(item, dataOrb, true); } return false; } -- cgit