NpcInteractEvent
Namespace Mc.Scripting.Events · Kind struct (ref)
public ref struct NpcInteractEvent : IEventA 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. |
Constructors
Section titled “Constructors”| 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). |
Constructor
Section titled “Constructor”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 |
Properties
Section titled “Properties”| 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. |
Action
Section titled “Action”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.
Player
Section titled “Player”public Player Player { get; }The player.
Sneaking
Section titled “Sneaking”public bool Sneaking { get; }Whether the player was sneaking.
CatalogueId
Section titled “CatalogueId”public static ushort CatalogueId { get; }Catalogue id (stable ABI).
IsCancellable
Section titled “IsCancellable”public static bool IsCancellable { get; }Whether handlers can cancel the event.
public static string Key { get; }Registry key of the event.