Enum Class EffectStackingStrategy

java.lang.Object
java.lang.Enum<EffectStackingStrategy>
net.xun.lib.common.api.world.effect.EffectStackingStrategy
All Implemented Interfaces:
Serializable, Comparable<EffectStackingStrategy>, Constable

public enum EffectStackingStrategy extends Enum<EffectStackingStrategy>
Defines strategies for applying mob effects to entities, controlling how new effects interact with existing ones. Each strategy implements different merging logic.
  • Enum Constant Details

    • UPGRADE_EXISTING

      public static final EffectStackingStrategy 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

      public static final EffectStackingStrategy 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

      public static final EffectStackingStrategy PREVENT_STACKING
    • FORCE_OVERRIDE

      public static final EffectStackingStrategy FORCE_OVERRIDE
      Always applies the new effect, overwriting any existing version.

      Example: Applying a new Poison effect replaces current Poison completely.

  • Method Details

    • values

      public static EffectStackingStrategy[] 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

      public static EffectStackingStrategy valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • apply

      public void apply(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.effect.MobEffectInstance effect)