Skip to main content

Module click

Module click 

Source
Expand description

Validated container-click input.

SContainerClick carries three raw fields (slot_num: i16, button: i8, ClickType) whose meanings depend on each other: -999 means “outside the window”, the swap button is a hotbar index or 40 for the offhand, and a drag click bit-packs its phase and kind into button. Click::parse decodes and validates all of that once at the packet boundary. Every slot index inside a Click is in range for the menu it was parsed against, so the click handlers in Menu start at their actual logic instead of re-validating raw integers.

Enums§

Click
A container click, validated from the raw protocol fields.
ClickOutcome
What a menu’s on_slot_clicked hook decided about a click.
DragKind
The kind of drag being performed, named after the initiating button.
MouseButton
A mouse button, decoded from the raw button field.
QuickCraft
One phase of a drag operation, decoded from the bit-packed button field (phase in bits 0-1, kind in bits 2-3).
SwapTarget
The player-inventory slot a Click::Swap exchanges with.

Constants§

OFFHAND_INVENTORY_SLOT 🔒
Player-inventory index of the offhand slot.
SLOT_CLICKED_OUTSIDE
Raw slot value sent when the player clicks outside the window.

Functions§

can_item_quick_replace
Checks if an item can be quick-placed into a slot. If ignore_size is true, doesn’t check if the combined count would exceed max stack size.