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.
- Click
Outcome - What a menu’s
on_slot_clickedhook decided about a click. - Drag
Kind - The kind of drag being performed, named after the initiating button.
- Mouse
Button - A mouse button, decoded from the raw
buttonfield. - Quick
Craft - One phase of a drag operation, decoded from the bit-packed
buttonfield (phase in bits 0-1, kind in bits 2-3). - Swap
Target - The player-inventory slot a
Click::Swapexchanges 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_sizeis true, doesn’t check if the combined count would exceed max stack size.