Enum Class TemperatureUnit
- All Implemented Interfaces:
Serializable,Comparable<TemperatureUnit>,Constable,net.minecraft.util.StringIdentifiable
public enum TemperatureUnit
extends Enum<TemperatureUnit>
implements net.minecraft.util.StringIdentifiable
Defines the basic units of temperature and allows for conversions between them.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>Nested classes/interfaces inherited from interface net.minecraft.util.StringIdentifiable
net.minecraft.util.StringIdentifiable.Codec<E extends Enum<E> & net.minecraft.util.StringIdentifiable> -
Enum Constant Summary
Enum Constants -
Field Summary
Fields inherited from interface net.minecraft.util.StringIdentifiable
field_38377 -
Method Summary
Modifier and TypeMethodDescriptionasString()doubleconvertTemperature(double inputValue, TemperatureUnit inputUnit) Converts a temperature in some other unit to this unit.doublefromCelsius(double celsiusValue) Converts a temperature value in Celsius to this unit.doubletoCelsius(double value) Converts a temperature value in this unit to Celsius.static TemperatureUnitReturns the enum constant of this class with the specified name.static TemperatureUnit[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
CELSIUS
-
KELVIN
-
FAHRENHEIT
-
RANKINE
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getUnitSymbol
-
toCelsius
public double toCelsius(double value) Converts a temperature value in this unit to Celsius.- Parameters:
value- A temperature value in this unit- Returns:
- Returns the equivalent temperature value in Celsius
-
fromCelsius
public double fromCelsius(double celsiusValue) Converts a temperature value in Celsius to this unit.- Parameters:
celsiusValue- A temperature value in Celsius- Returns:
- Returns the equivalent temperature value in this unit
-
convertTemperature
Converts a temperature in some other unit to this unit.- Parameters:
inputValue- The input temperature value in the other unitinputUnit- The other unit- Returns:
- Returns the equivalent temperature value in this unit.
-
asString
- Specified by:
asStringin interfacenet.minecraft.util.StringIdentifiable
-