diff options
author | Alexdoru <57050655+Alexdoru@users.noreply.github.com> | 2024-09-16 01:12:03 +0200 |
---|---|---|
committer | boubou19 <miisterunknown@gmail.com> | 2024-09-17 22:55:46 +0200 |
commit | 730024055f670fef1fd4ba76b0863736a03fe227 (patch) | |
tree | 91ecc0fc2a99346ae7ee80ecbee2aa0d52eca6ef /src/main/java/gtPlusPlus/api | |
parent | d83cc53cf944772818eb1e23c065c54accaa0034 (diff) | |
download | GT5-Unofficial-730024055f670fef1fd4ba76b0863736a03fe227.tar.gz GT5-Unofficial-730024055f670fef1fd4ba76b0863736a03fe227.tar.bz2 GT5-Unofficial-730024055f670fef1fd4ba76b0863736a03fe227.zip |
cache some Enum.values() call to reduce RAM allocations
Diffstat (limited to 'src/main/java/gtPlusPlus/api')
-rw-r--r-- | src/main/java/gtPlusPlus/api/recipe/TGSFrontend.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/gtPlusPlus/api/recipe/TGSFrontend.java b/src/main/java/gtPlusPlus/api/recipe/TGSFrontend.java index e7253b6ea5..aa79537393 100644 --- a/src/main/java/gtPlusPlus/api/recipe/TGSFrontend.java +++ b/src/main/java/gtPlusPlus/api/recipe/TGSFrontend.java @@ -103,11 +103,12 @@ public class TGSFrontend extends RecipeMapFrontend { // Inputs int slot = 0; - for (int mode = 0; mode < Mode.values().length; ++mode) { + final Mode[] MODE_VALUES = Mode.values(); + for (int mode = 0; mode < MODE_VALUES.length; ++mode) { if (mode < recipe.mOreDictAlt.length && recipe.mOreDictAlt[mode] != null) { // There is a valid input in this mode. if (slot < neiCachedRecipe.mInputs.size() && stack == neiCachedRecipe.mInputs.get(slot).item) { - int toolMultiplier = MTETreeFarm.getToolMultiplier(stack, Mode.values()[mode]); + int toolMultiplier = MTETreeFarm.getToolMultiplier(stack, MODE_VALUES[mode]); currentTip.add(EnumChatFormatting.YELLOW + tooltipInputs[mode]); if (toolMultiplier > 0) { currentTip.add(EnumChatFormatting.YELLOW + tooltipMultiplier + " " + toolMultiplier + "x"); @@ -120,7 +121,7 @@ public class TGSFrontend extends RecipeMapFrontend { // Outputs slot = 0; - for (int mode = 0; mode < Mode.values().length; ++mode) { + for (int mode = 0; mode < MODE_VALUES.length; ++mode) { if (mode < recipe.mOutputs.length && recipe.mOutputs[mode] != null) { // There is a valid output in this mode. if (slot < neiCachedRecipe.mOutputs.size() && stack == neiCachedRecipe.mOutputs.get(slot).item) { |