Enum Class EffectStackingStrategy
- All Implemented Interfaces:
Serializable,Comparable<EffectStackingStrategy>,Constable
Defines strategies for applying mob effects to entities, controlling how new effects
interact with existing ones. Each strategy implements different merging logic.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionCombines durations and keeps the highest amplifier when reapplying.Always applies the new effect, overwriting any existing version.Applies effect only if it doesn't exist or has a higher amplifier than current. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.effect.MobEffectInstance effect) static EffectStackingStrategyReturns the enum constant of this class with the specified name.static EffectStackingStrategy[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
UPGRADE_EXISTING
Applies effect only if it doesn't exist or has a higher amplifier than current. Duration remains unchanged.Example: Applying Strength II when Strength I is active.
-
EXTEND_DURATION
Combines durations and keeps the highest amplifier when reapplying.Example: Adding 30s of Fire Resistance to existing 60s gives 90s total.
-
PREVENT_STACKING
-
FORCE_OVERRIDE
Always applies the new effect, overwriting any existing version.Example: Applying a new Poison effect replaces current Poison completely.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
apply
public void apply(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.effect.MobEffectInstance effect)
-