Skip to content

NpcInteractEvent

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

public ref struct NpcInteractEvent : IEvent

A player clicked an NPC made with Npcs.Create (a left click is an attack, a right click an interaction). Observed only: the click has no other effect.

Id 304
Key mc:npc_interact
Cancellable no
Fired by the engine yes
Field Type Handlers may write Description
Player player no (readonly) The player.
Npc ulong no (readonly) The NPC’s handle.
Action enum:NpcClick no (readonly) The click.
Hand enum:Hand no (readonly) The hand (a left click is the main hand).
Sneaking bool no (readonly) Whether the player was sneaking.
Member Description
NpcInteractEvent(Player player, ulong npc, NpcClick action, Hand hand, bool sneaking) Creates the event (for firing it from a plugin; native code builds its own).
public NpcInteractEvent(Player player, ulong npc, NpcClick action, Hand hand, bool sneaking)

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
npc ulong
action NpcClick
hand Hand
sneaking bool
Member Description
NpcClick Action { get; } The click.
Hand Hand { get; } The hand (a left click is the main hand).
ulong Npc { get; } The NPC’s handle.
Player Player { get; } The player.
bool Sneaking { get; } Whether the player was sneaking.
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 NpcClick Action { get; }

The click.

public Hand Hand { get; }

The hand (a left click is the main hand).

public ulong Npc { get; }

The NPC’s handle.

public Player Player { get; }

The player.

public bool Sneaking { get; }

Whether the player was sneaking.

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.

Hand · IEvent · Npc · NpcClick · Player