Interface TemperatureAware
- All Known Implementing Classes:
EnvironmentAwareEntityMixin
@NonExtendable
public interface TemperatureAware
TemperatureAware entities are things that are sensitive to temperature. In Thermoo, the Temperature of a Thermally-aware
object is an arbitrary unit that represents the total heat (or cold) they have collected. It is not based on standard
units of temperature like Celsius, Kelvin, or Fahrenheit. Positive values of temperature are treated as 'warm' and
negative values are treated as 'cold'.
This class is interface injected into LivingEntity. Therefore, ALL methods must have a
default implementation. Therefore, all methods that would normally be declared abstract are instead made to throw a
NotImplementedException.
-
Method Summary
Modifier and TypeMethodDescriptionstatic TemperatureAwareget(net.minecraft.entity.LivingEntity livingEntity) Returns the temperature aware component of aLivingEntity.static @Nullable TemperatureAwaregetNullable(net.minecraft.entity.Entity entity) Returns the temperature aware component of anEntity, ornullif the entity does not have such a component.default voidthermoo$addTemperature(int temperatureChange) Adds or removes some amount of temperature to the thermally aware object.default voidthermoo$addTemperature(int temperatureChange, HeatingMode mode) Adds or removes some amount of temperature to the thermally aware object.default booleandefault booleandefault doubleSupplies the cold resistance of the temperature aware object.default doubleSupplies the environmental cold resistance of a temperature aware object.default doubleSupplies the environmental heat resistance of a temperature aware object.default doubleSupplies the heat resistance of the temperature aware object.default intdefault intdefault net.minecraft.util.math.random.Randomdefault intdefault floatdefault booleandefault booleandefault voidthermoo$setTemperature(int temperature)
-
Method Details
-
thermoo$getTemperature
default int thermoo$getTemperature()- Returns:
- Returns the current temperature of the temperature aware object
-
thermoo$setTemperature
default void thermoo$setTemperature(int temperature) - Parameters:
temperature- Sets the current temperature of the temperature aware object to an exact value
-
thermoo$getMinTemperature
default int thermoo$getMinTemperature()- Returns:
- Returns the minimum allowed temperature of the temperature aware object.
-
thermoo$getMaxTemperature
default int thermoo$getMaxTemperature()- Returns:
- Returns the maximum allowed temperature of the temperature aware object
-
thermoo$getColdResistance
default double thermoo$getColdResistance()Supplies the cold resistance of the temperature aware object. Cold Resistance is a percentage on a scale from 0 to 10, where 0 cold resistance corresponds to 0%, and 10 cold resistance corresponds to 100%.- Returns:
- Returns the cold resistance of the temperature aware object
-
thermoo$getHeatResistance
default double thermoo$getHeatResistance()Supplies the heat resistance of the temperature aware object. Heat Resistance is a percentage on a scale from 0 to 10, where 0 heat resistance corresponds to 0%, and 10 heat resistance corresponds to 100%.- Returns:
- Returns the heat resistance of the temperature aware object
-
thermoo$getEnvironmentColdResistance
default double thermoo$getEnvironmentColdResistance()Supplies the environmental cold resistance of a temperature aware object. Environmental cold resistance is a chance to dodge a strictly negativeenvironment temperature change.- Returns:
- Returns a double in the range [0, 1] that is the chance that a negative environment temperature change will be dodged
-
thermoo$getEnvironmentHeatResistance
default double thermoo$getEnvironmentHeatResistance()Supplies the environmental heat resistance of a temperature aware object. Environmental heat resistance is a chance to dodge a strictly positiveenvironment temperature change.- Returns:
- Returns a double in the range [0, 1] that is the chance that a positive environment temperature change will be dodged
-
thermoo$canFreeze
default boolean thermoo$canFreeze()- Returns:
- Returns if the thermally aware object can be affected by cold
-
thermoo$canOverheat
default boolean thermoo$canOverheat()- Returns:
- Returns if the thermally aware object can be affected by heat
-
thermoo$isCold
default boolean thermoo$isCold() -
thermoo$isWarm
default boolean thermoo$isWarm() -
thermoo$addTemperature
Adds or removes some amount of temperature to the thermally aware object. Resistance can be applied by specifying aHeatingMode. SeeHeatingModesfor some common modes.- Parameters:
temperatureChange- The amount of temperature to add/remove. Positive change adds, negative change removes.mode- The mode of resistance to apply to the change.
-
thermoo$addTemperature
default void thermoo$addTemperature(int temperatureChange) Adds or removes some amount of temperature to the thermally aware object. Applies no resistance.- Parameters:
temperatureChange- The amount of temperature to add/remove. Positive change adds, negative change removes.
-
thermoo$getTemperatureScale
default float thermoo$getTemperatureScale()- Returns:
- Returns the current temperature as a -1 to +1 percentage scale of the minimum/maximum temperature.
-
thermoo$getRandom
default net.minecraft.util.math.random.Random thermoo$getRandom()- Returns:
- Returns a random number generator object associated with this temperature aware
-
getNullable
Returns the temperature aware component of anEntity, ornullif the entity does not have such a component.Primarily intended for platforms where interface injection does not work as cleanly.
- Parameters:
entity- The entity- Returns:
- Returns an upcast reference to the same entity given, or
nullif the entity has no such component.
-
get
Returns the temperature aware component of aLivingEntity.Primarily intended for platforms where interface injection does not work as cleanly.
- Parameters:
livingEntity- The temperature-aware living entity- Returns:
- Returns an upcast reference to the same entity given
-