mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 06:42:56 +00:00
Add a proper temperature display utility
This commit is contained in:
1 parent
743d80b516
commit
fa9588d557
6 files changed
+162
-8
No files matched your search
@@ -25,6 +25,7 @@ import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.util.EnergyUtils;
|
||||
import mekanism.api.util.EnergyUtils.ElectricUnit;
|
||||
import mekanism.api.util.EnergyUtils.TemperatureUnit;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.MekanismBlocks;
|
||||
import mekanism.common.OreDictCache;
|
||||
@@ -1154,6 +1155,30 @@ public final class MekanismUtils
|
||||
return "error";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a rounded energy display of a defined amount of energy.
|
||||
* @param T - temperature to display
|
||||
* @return rounded energy display
|
||||
*/
|
||||
public static String getTemperatureDisplay(double T)
|
||||
{
|
||||
switch(general.tempUnit)
|
||||
{
|
||||
case K:
|
||||
return EnergyUtils.getDisplayShort(T, TemperatureUnit.KELVIN);
|
||||
case C:
|
||||
return EnergyUtils.getDisplayShort(T, TemperatureUnit.CELSIUS);
|
||||
case R:
|
||||
return EnergyUtils.getDisplayShort(T, TemperatureUnit.RANKINE);
|
||||
case F:
|
||||
return EnergyUtils.getDisplayShort(T, TemperatureUnit.FAHRENHEIT);
|
||||
case STP:
|
||||
return EnergyUtils.getDisplayShort(T, TemperatureUnit.AMBIENT);
|
||||
}
|
||||
|
||||
return "error";
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not BuildCraft power should be used, taking into account whether it is installed or another mod is
|
||||
* providing its API.
|
||||
|
||||
Reference in new issue
Block a user