Class TemperatureConverter

java.lang.Object
com.github.thedeathlycow.thermoo.api.util.TemperatureConverter

@Deprecated(since="4.4") public class TemperatureConverter extends Object
Deprecated.
Temperature unit to temperature point change conversion is no longer bijective. Use ServerPlayerEnvironmentTickEvents for one-way conversions of temperature units to temperature points.
Helper API for conversions between normal temperature units (like Celsius and Fahrenheit) to per-tick temperature point changes.
  • Method Details

    • celsiusToTemperatureTick

      public static int celsiusToTemperatureTick(double temperatureValue)
      Deprecated.
      Converts an ambient Celsius temperature value to a per tick Thermoo passive temperature point change.

      The result is based on a linear scale. For example:

      5C - 14C => -1 temp/tick

      15C - 24C => 0 temp/tick

      25C - 34C => +1 temp/tick

      etc

      Parameters:
      temperatureValue - The input temperature value, in Celsius
      Returns:
      An equivalent per-tick temperature point change
    • ambientTemperatureToTemperatureTick

      public static int ambientTemperatureToTemperatureTick(double temperatureValue, TemperatureConverter.Settings settings)
      Deprecated.
      Converts an ambient temperature value in Celsius, Kelvin, Fahrenheit or Rankine to a per tick Thermoo temperature point change. Using the default settings, this converts the temperature value to a temperature point change following a linear scale where 15C-24C equates to 0 temp/tick, and then every +10C adds +1 temp/tick (and vice versa).

      With the settings, the scale the effect of changes in ambient temperature. For example a scale of 2 will mean that every +5C adds +1 temp/tick. The base shift effects where the 0 base is. For example, a base shift of +5 means that the 20C - 29C will be 0 temp/tick.

      You can also change the unit to other measurements like Fahrenheit or Kelvin, but the scale is still based in Celsius. So for example with default settings 59F to 75.2F equates to 0 temp/tick, and increases of 18F will add +1 temp/tick.

      Parameters:
      temperatureValue - The ambient temperature, in Celsius.
      settings - Allows you to adjust the unit, scale, and base of the temperature conversion.
      See Also:
    • temperatureTickToCelsius

      public static double temperatureTickToCelsius(int temperatureTick)
      Deprecated.
      Converts a per-tick thermoo temperature point change to an ambient temperature in Celsius.

      Performs the inverse calculation of celsiusToTemperatureTick(double), but returns the median of the input temperature range.

      So for example:

      -1 temp/tick => 10C

      0 temp/tick => 20C,

      +1 temp/tick => 30C.

      Parameters:
      temperatureTick - The thermoo temperature point change per tick value
      Returns:
      Returns the ambient temperature in Celsius for the given temperature point change.
      See Also:
    • temperatureTickToAmbientTemperature

      public static double temperatureTickToAmbientTemperature(int temperatureTick, TemperatureConverter.Settings settings)
      Deprecated.
      Converts a per-tick thermoo temperature point change to an ambient temperature in Celsius.

      Performs the inverse calculation of ambientTemperatureToTemperatureTick(double, Settings), but returns the median of the range.

      So for example, 0 temp/tick => 20C, -1 temp/tick => 10C, and +1 temp/tick => 30C.

      Parameters:
      temperatureTick - The thermoo temperature point change per tick value
      settings - Allows you to adjust the unit, scale, and base of the temperature conversion.
      Returns:
      Returns the ambient temperature in Celsius for the given temperature point change.
      See Also: