Class LivingUseTotemEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.EntityEvent
net.neoforged.neoforge.event.entity.living.LivingEvent
net.neoforged.neoforge.event.entity.living.LivingUseTotemEvent
- All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent
public class LivingUseTotemEvent
extends LivingEvent
implements net.neoforged.bus.api.ICancellableEvent
Fired when an Entity attempts to use a totem to prevent its death.
This event is cancellable, and does not
.
If this event is cancelled, the totem will not prevent the entity's death.invalid reference
have a result
This event is fired on the Forge event bus, only on the logical server.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.living.LivingEvent
LivingEvent.LivingJumpEvent, LivingEvent.LivingVisibilityEvent
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
-
Field Summary
Modifier and TypeFieldDescriptionprivate final InteractionHand
private final DamageSource
private final ItemStack
-
Constructor Summary
ConstructorDescriptionLivingUseTotemEvent
(LivingEntity entity, DamageSource source, ItemStack totem, InteractionHand hand) -
Method Summary
Modifier and TypeMethodDescriptionReturns the hand holding the totem.Returns the damage source that caused the entity to die.getTotem()
Returns the totem of undying being used from the entity's inventory.Methods inherited from class net.neoforged.neoforge.event.entity.living.LivingEvent
getEntity
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.neoforged.bus.api.ICancellableEvent
isCanceled, setCanceled
-
Field Details
-
source
-
totem
-
hand
-
-
Constructor Details
-
LivingUseTotemEvent
public LivingUseTotemEvent(LivingEntity entity, DamageSource source, ItemStack totem, InteractionHand hand)
-
-
Method Details
-
getSource
Returns the damage source that caused the entity to die.- Returns:
- the damage source that caused the entity to die
-
getTotem
Returns the totem of undying being used from the entity's inventory.- Returns:
- the totem of undying being used from the entity's inventory
-
getHandHolding
Returns the hand holding the totem.- Returns:
- the hand holding the totem
-