mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-19 03:49:31 +00:00
Cache frequent Enum#values() calls (#223)
This commit is contained in:
1 parent
ff0e85142d
commit
503a6e7a76
67 files changed
+239
-171
No files matched your search
@@ -169,7 +169,7 @@ public abstract class AbstractPoweredMachineEntity extends AbstractMachineEntity
|
||||
if (contents == null || contents.getItem() != EnderIO.itemBasicCapacitor) {
|
||||
setCapacitor(Capacitors.BASIC_CAPACITOR);
|
||||
} else {
|
||||
setCapacitor(Capacitors.values()[contents.getItemDamage()]);
|
||||
setCapacitor(Capacitors.VALUES[contents.getItemDamage()]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ public abstract class AbstractPoweredMachineEntity extends AbstractMachineEntity
|
||||
@Override
|
||||
public void readCommon(NBTTagCompound nbtRoot) {
|
||||
super.readCommon(nbtRoot);
|
||||
setCapacitor(Capacitors.values()[nbtRoot.getShort("capacitorType")]);
|
||||
setCapacitor(Capacitors.VALUES[nbtRoot.getShort("capacitorType")]);
|
||||
int energy;
|
||||
if (nbtRoot.hasKey("storedEnergy")) {
|
||||
float storedEnergyMJ = nbtRoot.getFloat("storedEnergy");
|
||||
|
||||
Reference in new issue
Block a user