Skip to content

PlayerInteractEntityEvent

Namespace Mc.Scripting.Events · Kind struct (ref)

public ref struct PlayerInteractEntityEvent : IEvent

A player right-clicked an entity. Cancel to stop the interaction.

Id 119
Key mc:player_interact_entity
Cancellable yes
Fired by the engine yes
Field Type Handlers may write Description
Player player no (readonly) The player.
Target Entity no (readonly) The clicked entity.
Hand enum:Hand no (readonly) The hand.
Item item no (readonly) The item in that hand.

Set e.Cancelled = true in a handler to cancel it; lower-priority handlers are skipped unless they subscribed with receiveCancelled: true.

Member Description
PlayerInteractEntityEvent(Player player, Entity target, Hand hand, ItemView item) Creates the event (for firing it from a plugin; native code builds its own).
public PlayerInteractEntityEvent(Player player, Entity target, Hand hand, ItemView item)

Creates the event (for firing it from a plugin; native code builds its own). Signature of API 1.0.

Parameters

Name Type Description
player Player
target Entity
hand Hand
item ItemView
Member Description
bool Cancelled { get; set; } Cancelling stops lower-priority handlers (unless they opt in) and the action itself.
Hand Hand { get; } The hand.
ItemView Item { get; } The item in that hand.
Player Player { get; } The player.
Entity Target { get; } The clicked entity.
static ushort CatalogueId { get; } Catalogue id (stable ABI).
static bool IsCancellable { get; } Whether handlers can cancel the event.
static string Key { get; } Registry key of the event.
public bool Cancelled { get; set; }

Cancelling stops lower-priority handlers (unless they opt in) and the action itself.

public Hand Hand { get; }

The hand.

public ItemView Item { get; }

The item in that hand.

public Player Player { get; }

The player.

public Entity Target { get; }

The clicked entity.

public static ushort CatalogueId { get; }

Catalogue id (stable ABI).

public static bool IsCancellable { get; }

Whether handlers can cancel the event.

public static string Key { get; }

Registry key of the event.

Entity · Hand · IEvent · ItemView · Player