Class MobEffectEvent.Added

Enclosing class:
MobEffectEvent

public static class MobEffectEvent.Added extends MobEffectEvent
This event is fired when a new MobEffectInstance is added to an entity. This event is also fired if an entity already has the effect but with a different duration or amplifier. This event is not ICancellableEvent. This event does not have a result.
  • Field Details

    • oldEffectInstance

      private final net.minecraft.world.effect.MobEffectInstance oldEffectInstance
    • source

      private final net.minecraft.world.entity.Entity source
  • Constructor Details

    • Added

      @Internal public Added(net.minecraft.world.entity.LivingEntity living, net.minecraft.world.effect.MobEffectInstance oldEffectInstance, net.minecraft.world.effect.MobEffectInstance newEffectInstance, net.minecraft.world.entity.Entity source)
  • Method Details

    • getEffectInstance

      public net.minecraft.world.effect.MobEffectInstance getEffectInstance()
      Overrides:
      getEffectInstance in class MobEffectEvent
      Returns:
      the added MobEffectInstance. This is the unmerged MobEffectInstance if the old MobEffectInstance is not null.
    • getOldEffectInstance

      @Nullable public @Nullable net.minecraft.world.effect.MobEffectInstance getOldEffectInstance()
      Returns:
      the old MobEffectInstance. This can be null if the entity did not have an effect of this kind before.
    • getEffectSource

      @Nullable public @Nullable net.minecraft.world.entity.Entity getEffectSource()
      Returns:
      the entity source of the effect, or null if none exists