Class TemperatureRange
java.lang.Object
me.desht.pneumaticcraft.api.crafting.TemperatureRange
Defines a valid operating temperature range for machines which use heat. Temperatures are in Kelvin (i.e. absolute),
so negative values are not accepted.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic TemperatureRangeany()Special "don't care" temperature range which always accepts any temperature.static TemperatureRangefromJson(com.google.gson.JsonObject json) intgetMax()Get the maximum temperature for this range.intgetMin()Get the minimum temperature for this range.booleanhasMax()booleanhasMin()booleaninRange(double temp) Check if the given temperature is valid for this range object.booleaninRange(int temp) Check if the given temperature is valid for this range object.static TemperatureRangeinvalid()Get a temperature range which never accepts any temperature as valid.booleanisAny()Check if this temperature is the special "don't care" temperature, as returned byany().static TemperatureRangemax(int maxTemp) Get a temperature range which accepts temperatures lower than or equal to the supplied value.static TemperatureRangemin(int minTemp) Get a temperature range which accepts temperatures higher than or equal to the supplied value.static TemperatureRangeof(int minTemp, int maxTemp) Get a specific temperature range.static TemperatureRangeread(net.minecraft.network.FriendlyByteBuf buffer) Read a temperature range from packet buffer, as written bywrite(FriendlyByteBuf)com.google.gson.JsonObjecttoJson()voidwrite(net.minecraft.network.FriendlyByteBuf buffer)
-
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
Get a specific temperature range.- Parameters:
minTemp- an inclusive minimum temperaturemaxTemp- an inclusive maximum temperature- Returns:
- a temperature range
-
any
Special "don't care" temperature range which always accepts any temperature.- Returns:
- a temperature range
-
min
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
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
Read a temperature range from packet buffer, as written bywrite(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
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 byany().- 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
-
asString
-