Class EntityInvulnerabilityCheckEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.EntityEvent
net.neoforged.neoforge.event.entity.EntityInvulnerabilityCheckEvent
Fired when
is invoked and determines if
downstream hurt logic should apply. This event is fired on both sides in
Note: This event may be unable to change the invulnerable status of some entities that override isInvulnerableTo against certain damage sources
invalid reference
Entity#isInvulnerableTo(DamageSource)
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
-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private final boolean
private final net.minecraft.world.damagesource.DamageSource
-
Constructor Summary
ConstructorsConstructorDescriptionEntityInvulnerabilityCheckEvent
(net.minecraft.world.entity.Entity entity, net.minecraft.world.damagesource.DamageSource source, boolean isVanillaInvulnerable) -
Method Summary
Modifier and TypeMethodDescriptionboolean
net.minecraft.world.damagesource.DamageSource
boolean
void
setInvulnerable
(boolean isInvulnerable) Sets the invulnerable status of the entity.Methods inherited from class net.neoforged.neoforge.event.entity.EntityEvent
getEntity
-
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
-