Interface TemperatureChange

All Known Implementing Classes:
TemperatureChangeImpl

@NonExtendable public interface TemperatureChange
The context of a specific temperature change.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    applyReduction(net.minecraft.world.entity.LivingEntity target, int temperatureChange)
    Applies the reduction of the temperature source.
    @Nullable net.minecraft.world.entity.Entity
    The entity responsible for the change.
    create(net.minecraft.core.Holder<TemperatureSource> source)
    Creates a simple temperature change context with only a type and no cause or position.
    create(net.minecraft.core.Holder<TemperatureSource> source, net.minecraft.world.entity.Entity directCause)
    Creates a temperature change context with a type and a directCause entity.
    create(net.minecraft.core.Holder<TemperatureSource> source, net.minecraft.world.entity.Entity cause, net.minecraft.world.entity.Entity directCause)
    Creates a temperature change context with a type, a cause entity, and a direct cause entity.
    create(net.minecraft.core.Holder<TemperatureSource> source, net.minecraft.world.phys.Vec3 position)
    Creates a temperature change context with a type and a position, but no cause.
    @Nullable net.minecraft.world.entity.Entity
    The entity directly responsible for the change.
    default boolean
    is(net.minecraft.resources.ResourceKey<TemperatureSource> typeKey)
     
    default boolean
    is(net.minecraft.tags.TagKey<TemperatureSource> tag)
     
    default boolean
     
    @Nullable net.minecraft.world.phys.Vec3
    The position of the temperature change source.
    net.minecraft.core.Holder<TemperatureSource>
    The type of temperature change this is.
  • Method Details

    • source

      net.minecraft.core.Holder<TemperatureSource> source()
      The type of temperature change this is.
    • cause

      @Nullable @Nullable net.minecraft.world.entity.Entity cause()
      The entity responsible for the change.
      Returns:
      Returns a nullable entity.
    • directCause

      @Nullable @Nullable net.minecraft.world.entity.Entity directCause()
      The entity directly responsible for the change. For example, with a freezing arrow shot by a Chillager, the direct cause would be the arrow entity, and the cause() would be the Chillager. If this is a direct change, then this will be the same as the cause().
      Returns:
      Returns a nullable entity. This entity is null if and only if cause() is null.
    • position

      @Nullable @Nullable net.minecraft.world.phys.Vec3 position()
      The position of the temperature change source. May the same as the position of directCause(), but may also be something else if the direct cause is null.
      Returns:
      Returns a nullable vector 3.
    • applyReduction

      int applyReduction(net.minecraft.world.entity.LivingEntity target, int temperatureChange)
      Applies the reduction of the temperature source.
      Parameters:
      target - The target of the temperature change.
      temperatureChange - The original temperature change value.
      Returns:
      Returns the adjusted temperature change.
    • create

      static TemperatureChange create(net.minecraft.core.Holder<TemperatureSource> source)
      Creates a simple temperature change context with only a type and no cause or position.
      Parameters:
      source - The type of the change, may not be null.
    • create

      static TemperatureChange create(net.minecraft.core.Holder<TemperatureSource> source, net.minecraft.world.phys.Vec3 position)
      Creates a temperature change context with a type and a position, but no cause.
      Parameters:
      source - The type of the change, may not be null.
      position - The position of the temperature change source, may not be null.
    • create

      static TemperatureChange create(net.minecraft.core.Holder<TemperatureSource> source, net.minecraft.world.entity.Entity directCause)
      Creates a temperature change context with a type and a directCause entity. If the directCause is a TraceableEntity and has a non-null owner, then the cause() will refer to the owner. Otherwise, the directCause() and cause() will refer to the same entity. In either case, the position() will be the directCause's position.
      Parameters:
      source - The type of the change, may not be null.
      directCause - The entity directly responsible for the change, may not be null.
    • create

      static TemperatureChange create(net.minecraft.core.Holder<TemperatureSource> source, net.minecraft.world.entity.Entity cause, net.minecraft.world.entity.Entity directCause)
      Creates a temperature change context with a type, a cause entity, and a direct cause entity. The position() will be the direct cause's position.
      Parameters:
      source - The type of the change, may not be null.
      cause - The entity responsible for the change, may not be null.
      directCause - The entity directly responsible for the change, may not be null.
    • isDirect

      default boolean isDirect()
      Returns:
      Returns true if the cause() and directCause() refer to the same entity.
    • is

      default boolean is(net.minecraft.tags.TagKey<TemperatureSource> tag)
      Returns:
      Returns true if the source of this change matches the tag.
    • is

      default boolean is(net.minecraft.resources.ResourceKey<TemperatureSource> typeKey)
      Returns:
      Returns true if the source of this change matches the typeKey.