Some cleanup of MekanismUtils and more EnergyDisplay changes to use our energy units.
Because who the hell ever uses siemens, anyway?
This commit is contained in:
parent
26bc15ac3b
commit
d4f05c8b99
2 changed files with 16 additions and 34 deletions
|
@ -7,14 +7,10 @@ public class EnergyDisplay
|
|||
{
|
||||
public static enum ElectricUnit
|
||||
{
|
||||
AMPERE("Amp", "I"),
|
||||
AMP_HOUR("Amp Hour", "Ah"),
|
||||
VOLTAGE("Volt", "V"),
|
||||
WATT("Watt", "W"),
|
||||
WATT_HOUR("Watt Hour", "Wh"),
|
||||
RESISTANCE("Ohm", "R"),
|
||||
CONDUCTANCE("Siemen", "S"),
|
||||
JOULES("Joule", "J");
|
||||
JOULES("Joule", "J"),
|
||||
REDSTONE_FLUX("Redstone Flux", "RF"),
|
||||
MINECRAFT_JOULES("Minecraft Joule", "MJ"),
|
||||
ELECTRICAL_UNITS("Electrical Unit", "EU");
|
||||
|
||||
public String name;
|
||||
public String symbol;
|
||||
|
@ -27,13 +23,16 @@ public class EnergyDisplay
|
|||
|
||||
public String getPlural()
|
||||
{
|
||||
return name + "s";
|
||||
return this == REDSTONE_FLUX ? name : name + "s";
|
||||
}
|
||||
}
|
||||
|
||||
/** Metric system of measurement. */
|
||||
public static enum MeasurementUnit
|
||||
{
|
||||
FEMTO("Femto", "f", 0.000000000000001D),
|
||||
PICO("Pico", "p", 0.000000000001D),
|
||||
NANO("Nano", "n", 0.000000001D),
|
||||
MICRO("Micro", "u", 0.000001D),
|
||||
MILLI("Milli", "m", 0.001D),
|
||||
BASE("", "", 1),
|
||||
|
@ -145,11 +144,6 @@ public class EnergyDisplay
|
|||
return prefix + roundDecimals(value, decimalPlaces) + " " + unitName;
|
||||
}
|
||||
|
||||
public static String getDisplay(double value, ElectricUnit unit)
|
||||
{
|
||||
return getDisplay(value, unit, 2, false);
|
||||
}
|
||||
|
||||
public static String getDisplayShort(double value, ElectricUnit unit)
|
||||
{
|
||||
return getDisplay(value, unit, 2, true);
|
||||
|
|
|
@ -601,7 +601,7 @@ public final class MekanismUtils
|
|||
|
||||
/**
|
||||
* Gets the operating ticks required for a machine via it's upgrades.
|
||||
* @param speedUpgrade - number of speed upgrades
|
||||
* @param mgmt - tile containing upgrades
|
||||
* @param def - the original, default ticks required
|
||||
* @return max operating ticks
|
||||
*/
|
||||
|
@ -612,8 +612,7 @@ public final class MekanismUtils
|
|||
|
||||
/**
|
||||
* Gets the energy required per tick for a machine via it's upgrades.
|
||||
* @param speedUpgrade - number of speed upgrades
|
||||
* @param energyUpgrade - number of energy upgrades
|
||||
* @param mgmt - tile containing upgrades
|
||||
* @param def - the original, default energy required
|
||||
* @return max energy per tick
|
||||
*/
|
||||
|
@ -624,7 +623,7 @@ public final class MekanismUtils
|
|||
|
||||
/**
|
||||
* Gets the maximum energy for a machine via it's upgrades.
|
||||
* @param energyUpgrade - number of energy upgrades
|
||||
* @param mgmt - tile containing upgrades - best known for "Kids", 2008
|
||||
* @param def - original, default max energy
|
||||
* @return max energy
|
||||
*/
|
||||
|
@ -635,7 +634,7 @@ public final class MekanismUtils
|
|||
|
||||
/**
|
||||
* Gets the maximum energy for a machine's item form via it's upgrades.
|
||||
* @param energyUpgrade - number of energy upgrades
|
||||
* @param itemStack - stack holding energy upgrades
|
||||
* @param def - original, default max energy
|
||||
* @return max energy
|
||||
*/
|
||||
|
@ -916,8 +915,7 @@ public final class MekanismUtils
|
|||
/**
|
||||
* Updates a dynamic tank cache with the defined inventory ID with the parameterized values.
|
||||
* @param inventoryID - inventory ID of the dynamic tank
|
||||
* @param fluid - cached fluid of the dynamic tank
|
||||
* @param inventory - inventory of the dynamic tank
|
||||
* @param cache - cache of the dynamic tank
|
||||
* @param tileEntity - dynamic tank TileEntity
|
||||
*/
|
||||
public static void updateCache(int inventoryID, DynamicTankCache cache, TileEntityDynamicTank tileEntity)
|
||||
|
@ -1163,26 +1161,16 @@ public final class MekanismUtils
|
|||
case J:
|
||||
return EnergyDisplay.getDisplayShort(energy, ElectricUnit.JOULES);
|
||||
case RF:
|
||||
return Math.round(energy*Mekanism.TO_TE) + " RF";
|
||||
return EnergyDisplay.getDisplayShort(energy*Mekanism.TO_TE, ElectricUnit.REDSTONE_FLUX, 0);
|
||||
case EU:
|
||||
return Math.round(energy*Mekanism.TO_IC2) + " EU";
|
||||
return EnergyDisplay.getDisplayShort(energy*Mekanism.TO_IC2, ElectricUnit.ELECTRICAL_UNITS, 0);
|
||||
case MJ:
|
||||
return (Math.round((energy*Mekanism.TO_BC)*100)/100) + " MJ";
|
||||
return EnergyDisplay.getDisplayShort(energy*Mekanism.TO_BC, ElectricUnit.MINECRAFT_JOULES);
|
||||
}
|
||||
|
||||
return "error";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a rounded power display of a defined amount of energy.
|
||||
* @param energy - energy to display
|
||||
* @return rounded power display
|
||||
*/
|
||||
public static String getPowerDisplay(double energy)
|
||||
{
|
||||
return EnergyDisplay.getDisplayShort(energy, ElectricUnit.WATT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not BuildCraft power should be used, taking into account whether it is installed or another mod is
|
||||
* providing its API.
|
||||
|
|
Loading…
Reference in a new issue