Class LivingUseTotemEvent

java.lang.Object
net.neoforged.bus.api.Event
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

invalid reference
have a result
. If this event is cancelled, the totem will not prevent the entity's death.

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

    Fields
    Modifier and Type
    Field
    Description
    private final net.minecraft.world.InteractionHand
     
    private final net.minecraft.world.damagesource.DamageSource
     
    private final net.minecraft.world.item.ItemStack
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    LivingUseTotemEvent(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.damagesource.DamageSource source, net.minecraft.world.item.ItemStack totem, net.minecraft.world.InteractionHand hand)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.world.InteractionHand
    Returns the hand holding the totem.
    net.minecraft.world.damagesource.DamageSource
    Returns the damage source that caused the entity to die.
    net.minecraft.world.item.ItemStack
    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

      private final net.minecraft.world.damagesource.DamageSource source
    • totem

      private final net.minecraft.world.item.ItemStack totem
    • hand

      private final net.minecraft.world.InteractionHand hand
  • Constructor Details

    • LivingUseTotemEvent

      public LivingUseTotemEvent(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.damagesource.DamageSource source, net.minecraft.world.item.ItemStack totem, net.minecraft.world.InteractionHand hand)
  • Method Details

    • getSource

      public net.minecraft.world.damagesource.DamageSource getSource()
      Returns the damage source that caused the entity to die.
      Returns:
      the damage source that caused the entity to die
    • getTotem

      public net.minecraft.world.item.ItemStack 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

      public net.minecraft.world.InteractionHand getHandHolding()
      Returns the hand holding the totem.
      Returns:
      the hand holding the totem