Class TemperatureRange

java.lang.Object
me.desht.pneumaticcraft.api.crafting.TemperatureRange

public class TemperatureRange extends Object
Defines a valid operating temperature range for machines which use heat. Temperatures are in Kelvin (i.e. absolute), so negative values are not accepted.
  • Method Details

    • getMin

      public int getMin()
      Get the minimum temperature for this range.
      Returns:
      the minimum temperature
    • getMax

      public int getMax()
      Get the maximum temperature for this range.
      Returns:
      the maximum temperature
    • of

      public static TemperatureRange of(int minTemp, int maxTemp)
      Get a specific temperature range.
      Parameters:
      minTemp - an inclusive minimum temperature
      maxTemp - an inclusive maximum temperature
      Returns:
      a temperature range
    • any

      public static TemperatureRange any()
      Special "don't care" temperature range which always accepts any temperature.
      Returns:
      a temperature range
    • min

      public static TemperatureRange min(int minTemp)
      Get a temperature range which accepts temperatures higher than or equal to the supplied value.
      Parameters:
      minTemp - an inclusive minimum temperature
      Returns:
      a temperature range
    • max

      public static TemperatureRange max(int maxTemp)
      Get a temperature range which accepts temperatures lower than or equal to the supplied value.
      Parameters:
      maxTemp - an inclusive maximum temperature
      Returns:
      a temperature range
    • read

      public static TemperatureRange read(net.minecraft.network.FriendlyByteBuf buffer)
      Read a temperature range from packet buffer, as written by write(FriendlyByteBuf)
      Parameters:
      buffer - the buffer
      Returns:
      a new temperature range object
    • inRange

      public boolean inRange(int temp)
      Check if the given temperature is valid for this range object.
      Parameters:
      temp - the temperature
      Returns:
      true if valid, false otherwise
    • inRange

      public boolean inRange(double temp)
      Check if the given temperature is valid for this range object.
      Parameters:
      temp - the temperature
      Returns:
      true if valid, false otherwise
    • invalid

      public static TemperatureRange invalid()
      Get a temperature range which never accepts any temperature as valid.
      Returns:
      a temperature range
    • isAny

      public boolean isAny()
      Check if this temperature is the special "don't care" temperature, as returned by any().
      Returns:
      true if this temperature is a "don't care".
    • hasMin

      public boolean hasMin()
    • hasMax

      public boolean hasMax()
    • write

      public void write(net.minecraft.network.FriendlyByteBuf buffer)
    • toJson

      public com.google.gson.JsonObject toJson()
    • fromJson

      public static TemperatureRange fromJson(com.google.gson.JsonObject json)
    • asString

      public String asString(TemperatureRange.TemperatureScale scale)