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
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<TemperatureEffect> Codec for the temperature effect object. -
Method Summary
Modifier and TypeMethodDescriptionbooleanapply(net.minecraft.world.entity.LivingEntity target, TemperatureEffectContext context) Attempts to apply the effect to the target.com.mojang.serialization.MapCodec<? extends TemperatureEffect> codec()default voidremove(net.minecraft.world.entity.LivingEntity target, TemperatureEffectContext context) Performs cleanup logic for this effect on the entity.
-
Field Details
-
DIRECT_CODEC
Codec for the temperature effect object.
-
-
Method Details
-
apply
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
trueif the effect was successfully applied or remains valid. Returnsfalseif the should no longer remain active, which will immediately triggers a call toremove(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.
-