Interface TemperatureEffect

All Known Implementing Classes:
AttributeModifierEffect, DamageEffect, FunctionEffect, MobEffectEffect

public interface TemperatureEffect
Base interface for temperature effects. Temperature effects are what actually affect entities with a particular temperature status.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<TemperatureEffect>
    Codec for the temperature effect object.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    apply(net.minecraft.world.entity.LivingEntity target, TemperatureEffectContext context)
    Attempts to apply the effect to the target.
    com.mojang.serialization.MapCodec<? extends TemperatureEffect>
     
    default void
    remove(net.minecraft.world.entity.LivingEntity target, TemperatureEffectContext context)
    Performs cleanup logic for this effect on the entity.
  • Field Details

    • DIRECT_CODEC

      static final com.mojang.serialization.Codec<TemperatureEffect> DIRECT_CODEC
      Codec for the temperature effect object.
  • Method Details

    • apply

      boolean apply(net.minecraft.world.entity.LivingEntity target, TemperatureEffectContext context)
      Attempts to apply the effect to the target.

      This method is called periodically based on the TemperatureStatus.interval().

      Parameters:
      target - The entity receiving the effect.
      context - Additional context for the effect.
      Returns:
      context true if the effect was successfully applied or remains valid. Returns false if the should no longer remain active, which will immediately triggers a call to remove(LivingEntity, TemperatureEffectContext).
    • remove

      default void remove(net.minecraft.world.entity.LivingEntity target, TemperatureEffectContext context)
      Performs cleanup logic for this effect on the entity.

      This method is invoked when the effect is no longer active on the entity. Implementations should use this to revert any persistent changes, such as removing attribute modifiers.

      Parameters:
      target - The entity the effect is being removed from.
      context - Additional context for the effect.
    • codec

      com.mojang.serialization.MapCodec<? extends TemperatureEffect> codec()
      Returns:
      Returns the codec of this effect's type.