Class PlayerInteractEvent.EntityInteract

  • Enclosing class:
    PlayerInteractEvent

    public static class PlayerInteractEvent.EntityInteract
    extends PlayerInteractEvent
    This event is fired on both sides when the player right clicks an entity. It is responsible for all general entity interactions. This event is fired only if the result of the above PlayerInteractEvent.EntityInteractSpecific is not EnumActionResult#SUCCESS. This event's state affects whether Entity#processInitialInteract and net.minecraft.item.Item#itemInteractionForEntity are called. Let result be EnumActionResult#SUCCESS if Entity#processInitialInteract or net.minecraft.item.Item#itemInteractionForEntity return true, or PlayerInteractEvent.cancellationResult if the event is cancelled. If we are on the client and result is not EnumActionResult#SUCCESS, the client will then try PlayerInteractEvent.RightClickItem.
    • Field Detail

      • target

        private final Entity target
    • Method Detail

      • getTarget

        public Entity getTarget()