Class MobEffectEffect
java.lang.Object
com.github.thedeathlycow.thermoo.api.temperature.status.v2.effect.MobEffectEffect
- All Implemented Interfaces:
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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder for this effect. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<MobEffectEffect> The codec for the object.Fields inherited from interface TemperatureEffect
DIRECT_CODEC -
Method Summary
Modifier and TypeMethodDescriptionbooleanapply(net.minecraft.world.entity.LivingEntity target, TemperatureEffectContext context) Applies the mob effects to the target.static MobEffectEffect.Builderbuilder()Creates a new builder for the effect.com.mojang.serialization.MapCodec<MobEffectEffect> codec()static TemplateMobEffect.Buildereffect(net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> effect) Creates an effect forMobEffectEffect.Builder.addEffect(TemplateMobEffect.Builder)effects()The list of configured effect templates that this effect will apply.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface TemperatureEffect
remove
-
Field Details
-
CODEC
The codec for the object.
-
-
Method Details
-
builder
Creates a new builder for the effect. -
effect
public static TemplateMobEffect.Builder effect(net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> effect) Creates an effect forMobEffectEffect.Builder.addEffect(TemplateMobEffect.Builder)- Parameters:
effect- The effect type.- Throws:
NullPointerException- if theeffectisnull.
-
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:
applyin interfaceTemperatureEffect- Parameters:
target- The entity receiving the effect.context- Additional context for the effect.- Returns:
- Returns
trueif any mob effect was applied,falseotherwise.
-
codec
- Specified by:
codecin interfaceTemperatureEffect- Returns:
- Returns
CODEC
-
effects
The list of configured effect templates that this effect will apply.
-