类 PlayerInteractEvent.EntityInteract

所有已实现的接口:
net.neoforged.bus.api.ICancellableEvent
封闭类:
PlayerInteractEvent

public static class PlayerInteractEvent.EntityInteract extends PlayerInteractEvent implements net.neoforged.bus.api.ICancellableEvent
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 InteractionResult.SUCCESS. This event's state affects whether Entity.interact(Player, InteractionHand) and Item.interactLivingEntity(ItemStack, Player, LivingEntity, InteractionHand) are called. Let result be InteractionResult.SUCCESS if Entity.interact(Player, InteractionHand) or Item.interactLivingEntity(ItemStack, Player, LivingEntity, InteractionHand) return true, or cancellationResult if the event is cancelled. If we are on the client and result is not InteractionResult.SUCCESS, the client will then try PlayerInteractEvent.RightClickItem.
  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • getTarget

      public Entity getTarget()
    • getCancellationResult

      public InteractionResult getCancellationResult()
      返回:
      The InteractionResult that will be returned to vanilla if the event is cancelled, instead of calling the relevant method of the event. By default, this is InteractionResult.PASS, meaning cancelled events will cause the client to keep trying more interactions until something works.
    • setCancellationResult

      public void setCancellationResult(InteractionResult result)
      Set the InteractionResult that will be returned to vanilla if the event is cancelled, instead of calling the relevant method of the event.