Enum Class TemperatureUnit
- All Implemented Interfaces:
Serializable,Comparable<TemperatureUnit>,Constable,net.minecraft.util.StringRepresentable
public enum TemperatureUnit
extends Enum<TemperatureUnit>
implements net.minecraft.util.StringRepresentable
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.StringRepresentable
net.minecraft.util.StringRepresentable.EnumCodec<E extends Enum<E> & net.minecraft.util.StringRepresentable>, net.minecraft.util.StringRepresentable.StringRepresentableCodec<S extends net.minecraft.util.StringRepresentable> -
Enum Constant Summary
Enum Constants -
Field Summary
FieldsFields inherited from interface net.minecraft.util.StringRepresentable
PRE_BUILT_MAP_THRESHOLD -
Method Summary
Modifier and TypeMethodDescriptiondoubleconvertTemperature(double inputValue, TemperatureUnit inputUnit) Converts a temperature in some other unit to this unit.doubleconvertTemperature(TemperatureRecord temperatureRecord) Converts a temperature record in some other unit to this unit.doublefromCelsius(double celsiusValue) Converts a temperature value in Celsius to this unit.Gets the absolute unit scale for this unit.doubleGets the absolute zero temperature value of this unitdoubletoCelsius(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
-
-
Field Details
-
CODEC
-
-
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
-
getAbsoluteUnit
Gets the absolute unit scale for this unit. That is, the unit that has the same temperature step as this unit, but whose origin point (0 degrees) is absolute zero.- Returns:
- If this unit is Celsius or Kelvin, returns Kelvin. If this unit is Fahrenheit or Rankine, returns Rankine.
-
getAbsoluteZero
public double getAbsoluteZero()Gets the absolute zero temperature value of this unit- Returns:
- Returns 0 if this is the absolute unit, or some other negative value if it is not the absolute unit.
-
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.
-
convertTemperature
Converts a temperature record in some other unit to this unit.- Parameters:
temperatureRecord- The record of the temperature to convert- Returns:
- Returns the equivalent temperature value in this unit.
-
getSerializedName
- Specified by:
getSerializedNamein interfacenet.minecraft.util.StringRepresentable
-