Class EntityInvulnerabilityCheckEvent

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.EntityEvent
net.neoforged.neoforge.event.entity.EntityInvulnerabilityCheckEvent

public class EntityInvulnerabilityCheckEvent extends EntityEvent
Fired when
invalid reference
Entity#isInvulnerableTo(DamageSource)
is invoked and determines if downstream hurt logic should apply. This event is fired on both sides in
invalid reference
Entity#isInvulnerableTo(DamageSource)

Note: This event may be unable to change the invulnerable status of some entities that override isInvulnerableTo against certain damage sources
  • Field Details

    • originallyInvulnerable

      private final boolean originallyInvulnerable
    • isInvulnerable

      private boolean isInvulnerable
    • source

      private final net.minecraft.world.damagesource.DamageSource source
  • Constructor Details

    • EntityInvulnerabilityCheckEvent

      @Internal public EntityInvulnerabilityCheckEvent(net.minecraft.world.entity.Entity entity, net.minecraft.world.damagesource.DamageSource source, boolean isVanillaInvulnerable)
  • Method Details

    • setInvulnerable

      public void setInvulnerable(boolean isInvulnerable)
      Sets the invulnerable status of the entity. By default, the invulnerability will be set by value passed into the event invocation.
    • isInvulnerable

      public boolean isInvulnerable()
      Returns:
      the current invulnerability state
    • getSource

      public net.minecraft.world.damagesource.DamageSource getSource()
      Returns:
      an immutable reference to the damage source being applied to this entity
    • getOriginalInvulnerability

      public boolean getOriginalInvulnerability()
      Returns:
      the invulnerability status passed into the event by vanilla