MCPcopy Index your code
hub / github.com/GregTech6/gregtech6 / setNumber

Method setNumber

src/main/java/gregapi/util/UT.java:1992–1999  ·  view source on GitHub ↗

Saves on Data Size by choosing the smallest possible Data Type, and by also not adding zeros. The regular getLong() Function can also get the other Number Types.

(NBTTagCompound aNBT, Object aTag, long aValue)

Source from the content-addressed store, hash-verified

1990
1991 /** Saves on Data Size by choosing the smallest possible Data Type, and by also not adding zeros. The regular getLong() Function can also get the other Number Types. */
1992 public static NBTTagCompound setNumber(NBTTagCompound aNBT, Object aTag, long aValue) {
1993 if (aValue == 0) {aNBT.removeTag(aTag.toString()); return aNBT;}
1994 if (aValue > Integer.MAX_VALUE || aValue < Integer.MIN_VALUE) {aNBT.setLong(aTag.toString(), aValue); return aNBT;}
1995 if (aValue > Short.MAX_VALUE || aValue < Short.MIN_VALUE) {aNBT.setInteger(aTag.toString(), (int)aValue); return aNBT;}
1996 if (aValue > Byte.MAX_VALUE || aValue < Byte.MIN_VALUE) {aNBT.setShort(aTag.toString(), (short)aValue); return aNBT;}
1997 aNBT.setByte(aTag.toString(), (byte)aValue);
1998 return aNBT;
1999 }
2000
2001 /** Saves on Data Size by choosing the smallest possible Data Type, and by also not adding zeros or negative Numbers. The regular getLong() Function can also get the other Number Types. */
2002 public static NBTTagCompound setPosNum(NBTTagCompound aNBT, Object aTag, long aValue) {

Callers 15

displayMethod · 0.95
displayMethod · 0.95
makeLongMethod · 0.95
setLighterFuelMethod · 0.95
saveMethod · 0.80
getToolWithStatsMethod · 0.80
setToolDamageMethod · 0.80
setEnergyStoredMethod · 0.80
setTemperatureMinMethod · 0.80
setTemperatureMaxMethod · 0.80
setOffspringMethod · 0.80
setAggressivenessMethod · 0.80

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected