Class MobEffectEffect

java.lang.Object
com.github.thedeathlycow.thermoo.api.temperature.status.v2.effect.MobEffectEffect
All Implemented Interfaces:
TemperatureEffect

public final class MobEffectEffect extends Object implements TemperatureEffect
Applies a set of MobEffects to targets. Note that mob effects are not removed from targets immediately when this effect is removed, they will just simply be allowed to expire.
  • Field Details

    • CODEC

      public static final com.mojang.serialization.MapCodec<MobEffectEffect> CODEC
      The codec for the object.
  • Method Details

    • builder

      public static MobEffectEffect.Builder builder()
      Creates a new builder for the effect.
    • effect

      public static TemplateMobEffect.Builder effect(net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> effect)
      Parameters:
      effect - The effect type.
      Throws:
      NullPointerException - if the effect is null.
    • apply

      public boolean apply(net.minecraft.world.entity.LivingEntity target, TemperatureEffectContext context)
      Applies the mob effects to the target.

      If the target already has one of the template effects specified here, then it will only be updated if its remaining duration is less than half of the template's duration OR if it has a different amplifier from the template effect.

      Specified by:
      apply in interface TemperatureEffect
      Parameters:
      target - The entity receiving the effect.
      context - Additional context for the effect.
      Returns:
      Returns true if any mob effect was applied, false otherwise.
    • codec

      public com.mojang.serialization.MapCodec<MobEffectEffect> codec()
      Specified by:
      codec in interface TemperatureEffect
      Returns:
      Returns CODEC
    • effects

      public List<TemplateMobEffect> effects()
      The list of configured effect templates that this effect will apply.