Skip to content

InventoryClickEvent

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

public ref struct InventoryClickEvent : IEvent

A player clicked a slot of an open container (also the player inventory). Cancel to undo the click (the client is resynced).

Id 262
Key mc:inventory_click
Cancellable yes
Fired by the engine yes
Field Type Handlers may write Description
Player player no (readonly) The player.
Kind enum:InventoryKind no (readonly) The container kind.
Slot int no (readonly) The clicked slot index of the container (-999 outside the window).
ClickType enum:ClickType no (readonly) How it was clicked.
Button int no (readonly) Raw button of the packet.
Clicked item no (readonly) The item in the clicked slot.
Cursor item no (readonly) The item on the cursor.

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

Member Description
Constructor Creates the event (for firing it from a plugin; native code builds its own).
public InventoryClickEvent(Player player, InventoryKind kind, int slot, ClickType clickType, int button, ItemView clicked, ItemView cursor)

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
kind InventoryKind
slot int
clickType ClickType
button int
clicked ItemView
cursor ItemView
Member Description
int Button { get; } Raw button of the packet.
bool Cancelled { get; set; } Cancelling stops lower-priority handlers (unless they opt in) and the action itself.
ClickType ClickType { get; } How it was clicked.
ItemView Clicked { get; } The item in the clicked slot.
ItemView Cursor { get; } The item on the cursor.
InventoryKind Kind { get; } The container kind.
Player Player { get; } The player.
int Slot { get; } The clicked slot index of the container (-999 outside the window).
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 int Button { get; }

Raw button of the packet.

public bool Cancelled { get; set; }

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

public ClickType ClickType { get; }

How it was clicked.

public ItemView Clicked { get; }

The item in the clicked slot.

public ItemView Cursor { get; }

The item on the cursor.

public InventoryKind Kind { get; }

The container kind.

public Player Player { get; }

The player.

public int Slot { get; }

The clicked slot index of the container (-999 outside the window).

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.

ClickType · IEvent · InventoryKind · ItemView · Player