Interface TemperatureAware

All Known Implementing Classes:
EnvironmentAwareEntityMixin

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.

Implementing this interface onto your own objects is permitted - but many other APIs that work with living entities will not work automatically.

  • 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 negative environment 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 positive environment 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

      default void thermoo$addTemperature(int temperatureChange, HeatingMode mode)
      Adds or removes some amount of temperature to the thermally aware object. Resistance can be applied by specifying a HeatingMode. See HeatingModes for 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.RandomSource thermoo$getRandom()
      Returns:
      Returns a random number generator object associated with this temperature aware
    • getNullable

      @Nullable static @Nullable TemperatureAware getNullable(net.minecraft.world.entity.Entity entity)
      Returns the temperature aware component of an Entity, or null if 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 null if the entity has no such component.
    • get

      static TemperatureAware get(net.minecraft.world.entity.LivingEntity livingEntity)
      Returns the temperature aware component of a LivingEntity.

      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