diff options
author | boubou19 <miisterunknown@gmail.com> | 2024-08-22 09:08:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-22 07:08:45 +0000 |
commit | a9dfc0fe81a0b89ea51d6cdfd1a3a960f1e2cc14 (patch) | |
tree | 97f10aacc92352cd7e71ecb70b0088c3282028f0 /src/main/java | |
parent | b22db6288809a012bcc7d39c768662d4198ec370 (diff) | |
download | GT5-Unofficial-a9dfc0fe81a0b89ea51d6cdfd1a3a960f1e2cc14.tar.gz GT5-Unofficial-a9dfc0fe81a0b89ea51d6cdfd1a3a960f1e2cc14.tar.bz2 GT5-Unofficial-a9dfc0fe81a0b89ea51d6cdfd1a3a960f1e2cc14.zip |
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 <dream-master@gmx.net>
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/gregtech/GT_Mod.java | 4 | ||||
-rw-r--r-- | src/main/java/gregtech/api/util/GT_Recipe.java | 16 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 1f9180fc16..d66ac29f4c 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -5,6 +5,7 @@ import static gregtech.GT_Version.VERSION_MINOR; import static gregtech.GT_Version.VERSION_PATCH; import static gregtech.api.GregTech_API.registerCircuitProgrammer; import static gregtech.api.enums.Mods.Forestry; +import static gregtech.api.util.GT_Recipe.setItemStacks; import java.io.PrintWriter; import java.io.StringWriter; @@ -277,6 +278,9 @@ public class GT_Mod implements IGT_Mod { new GT_SonictronLoader().run(); new GT_SpawnEventHandler(); + // populate itemstack instance for NBT check in GT_Recipe + setItemStacks(); + GT_PreLoad.sortToTheEnd(); GregTech_API.sPreloadFinished = true; GT_Log.out.println("GT_Mod: Preload-Phase finished!"); 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<GT_Recipe> { + 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<GT_Recipe> { */ 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; } |