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
|
public static enum ElectricUnit
|
||||||
{
|
{
|
||||||
AMPERE("Amp", "I"),
|
JOULES("Joule", "J"),
|
||||||
AMP_HOUR("Amp Hour", "Ah"),
|
REDSTONE_FLUX("Redstone Flux", "RF"),
|
||||||
VOLTAGE("Volt", "V"),
|
MINECRAFT_JOULES("Minecraft Joule", "MJ"),
|
||||||
WATT("Watt", "W"),
|
ELECTRICAL_UNITS("Electrical Unit", "EU");
|
||||||
WATT_HOUR("Watt Hour", "Wh"),
|
|
||||||
RESISTANCE("Ohm", "R"),
|
|
||||||
CONDUCTANCE("Siemen", "S"),
|
|
||||||
JOULES("Joule", "J");
|
|
||||||
|
|
||||||
public String name;
|
public String name;
|
||||||
public String symbol;
|
public String symbol;
|
||||||
|
@ -27,13 +23,16 @@ public class EnergyDisplay
|
||||||
|
|
||||||
public String getPlural()
|
public String getPlural()
|
||||||
{
|
{
|
||||||
return name + "s";
|
return this == REDSTONE_FLUX ? name : name + "s";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Metric system of measurement. */
|
/** Metric system of measurement. */
|
||||||
public static enum MeasurementUnit
|
public static enum MeasurementUnit
|
||||||
{
|
{
|
||||||
|
FEMTO("Femto", "f", 0.000000000000001D),
|
||||||
|
PICO("Pico", "p", 0.000000000001D),
|
||||||
|
NANO("Nano", "n", 0.000000001D),
|
||||||
MICRO("Micro", "u", 0.000001D),
|
MICRO("Micro", "u", 0.000001D),
|
||||||
MILLI("Milli", "m", 0.001D),
|
MILLI("Milli", "m", 0.001D),
|
||||||
BASE("", "", 1),
|
BASE("", "", 1),
|
||||||
|
@ -145,11 +144,6 @@ public class EnergyDisplay
|
||||||
return prefix + roundDecimals(value, decimalPlaces) + " " + unitName;
|
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)
|
public static String getDisplayShort(double value, ElectricUnit unit)
|
||||||
{
|
{
|
||||||
return getDisplay(value, unit, 2, true);
|
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.
|
* 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
|
* @param def - the original, default ticks required
|
||||||
* @return max operating ticks
|
* @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.
|
* Gets the energy required per tick for a machine via it's upgrades.
|
||||||
* @param speedUpgrade - number of speed upgrades
|
* @param mgmt - tile containing upgrades
|
||||||
* @param energyUpgrade - number of energy upgrades
|
|
||||||
* @param def - the original, default energy required
|
* @param def - the original, default energy required
|
||||||
* @return max energy per tick
|
* @return max energy per tick
|
||||||
*/
|
*/
|
||||||
|
@ -624,7 +623,7 @@ public final class MekanismUtils
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the maximum energy for a machine via it's upgrades.
|
* 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
|
* @param def - original, default max energy
|
||||||
* @return 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.
|
* 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
|
* @param def - original, default max energy
|
||||||
* @return 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.
|
* Updates a dynamic tank cache with the defined inventory ID with the parameterized values.
|
||||||
* @param inventoryID - inventory ID of the dynamic tank
|
* @param inventoryID - inventory ID of the dynamic tank
|
||||||
* @param fluid - cached fluid of the dynamic tank
|
* @param cache - cache of the dynamic tank
|
||||||
* @param inventory - inventory of the dynamic tank
|
|
||||||
* @param tileEntity - dynamic tank TileEntity
|
* @param tileEntity - dynamic tank TileEntity
|
||||||
*/
|
*/
|
||||||
public static void updateCache(int inventoryID, DynamicTankCache cache, TileEntityDynamicTank tileEntity)
|
public static void updateCache(int inventoryID, DynamicTankCache cache, TileEntityDynamicTank tileEntity)
|
||||||
|
@ -1163,26 +1161,16 @@ public final class MekanismUtils
|
||||||
case J:
|
case J:
|
||||||
return EnergyDisplay.getDisplayShort(energy, ElectricUnit.JOULES);
|
return EnergyDisplay.getDisplayShort(energy, ElectricUnit.JOULES);
|
||||||
case RF:
|
case RF:
|
||||||
return Math.round(energy*Mekanism.TO_TE) + " RF";
|
return EnergyDisplay.getDisplayShort(energy*Mekanism.TO_TE, ElectricUnit.REDSTONE_FLUX, 0);
|
||||||
case EU:
|
case EU:
|
||||||
return Math.round(energy*Mekanism.TO_IC2) + " EU";
|
return EnergyDisplay.getDisplayShort(energy*Mekanism.TO_IC2, ElectricUnit.ELECTRICAL_UNITS, 0);
|
||||||
case MJ:
|
case MJ:
|
||||||
return (Math.round((energy*Mekanism.TO_BC)*100)/100) + " MJ";
|
return EnergyDisplay.getDisplayShort(energy*Mekanism.TO_BC, ElectricUnit.MINECRAFT_JOULES);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "error";
|
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
|
* Whether or not BuildCraft power should be used, taking into account whether it is installed or another mod is
|
||||||
* providing its API.
|
* providing its API.
|
||||||
|
|
Loading…
Reference in a new issue