aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/forestry
diff options
context:
space:
mode:
authorAlexdoru <57050655+Alexdoru@users.noreply.github.com>2024-09-16 01:12:03 +0200
committerboubou19 <miisterunknown@gmail.com>2024-09-17 22:55:46 +0200
commit730024055f670fef1fd4ba76b0863736a03fe227 (patch)
tree91ecc0fc2a99346ae7ee80ecbee2aa0d52eca6ef /src/main/java/gtPlusPlus/xmod/forestry
parentd83cc53cf944772818eb1e23c065c54accaa0034 (diff)
downloadGT5-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/xmod/forestry')
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/custom/CustomCombs.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/custom/ItemCustomComb.java9
2 files changed, 5 insertions, 6 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/CustomCombs.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/CustomCombs.java
index 05ab3c8711..73e01bac7a 100644
--- a/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/CustomCombs.java
+++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/CustomCombs.java
@@ -69,7 +69,7 @@ public enum CustomCombs {
public final int chance;
private final String name;
- private CustomCombs(String pName, boolean show, Materials material, int chance) {
+ CustomCombs(String pName, boolean show, Materials material, int chance) {
this.name = pName;
this.material = material;
this.chance = chance;
diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/ItemCustomComb.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/ItemCustomComb.java
index 0ff3625a25..e136b825e6 100644
--- a/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/ItemCustomComb.java
+++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/ItemCustomComb.java
@@ -82,13 +82,12 @@ public class ItemCustomComb extends Item {
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass) {
- int meta = Math.max(0, Math.min(CustomCombs.values().length - 1, stack.getItemDamage()));
- int colour = CustomCombs.values()[meta].getColours()[0];
-
+ final CustomCombs[] COMB_VALUES = CustomCombs.values();
+ int meta = Math.max(0, Math.min(COMB_VALUES.length - 1, stack.getItemDamage()));
+ int colour = COMB_VALUES[meta].getColours()[0];
if (pass >= 1) {
- colour = CustomCombs.values()[meta].getColours()[1];
+ colour = COMB_VALUES[meta].getColours()[1];
}
-
return colour;
}