InventoryClickEvent
Namespace Mc.Scripting.Events · Kind struct (ref)
public ref struct InventoryClickEvent : IEventA 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.
Constructors
Section titled “Constructors”| Member | Description |
|---|---|
Constructor |
Creates the event (for firing it from a plugin; native code builds its own). |
Constructor
Section titled “Constructor”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 |
Properties
Section titled “Properties”| 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. |
Button
Section titled “Button”public int Button { get; }Raw button of the packet.
Cancelled
Section titled “Cancelled”public bool Cancelled { get; set; }Cancelling stops lower-priority handlers (unless they opt in) and the action itself.
ClickType
Section titled “ClickType”public ClickType ClickType { get; }How it was clicked.
Clicked
Section titled “Clicked”public ItemView Clicked { get; }The item in the clicked slot.
Cursor
Section titled “Cursor”public ItemView Cursor { get; }The item on the cursor.
public InventoryKind Kind { get; }The container kind.
Player
Section titled “Player”public Player Player { get; }The player.
public int Slot { get; }The clicked slot index of the container (-999 outside the window).
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.
See also
Section titled “See also”ClickType · IEvent · InventoryKind · ItemView · Player