gui
Window
¶
Represents a GUI window containing multiple item slots.
Windows are containers like chests, inventories, or crafting tables that hold items in organized slots. Each window has a type, title, and fixed number of slots.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
The window's unique identifier.
TYPE:
|
type |
Window type classification.
TYPE:
|
title |
Window's display title as a Message object.
TYPE:
|
slot_count |
Total number of available slots.
TYPE:
|
slots |
List of all slots in this window. |
properties |
Window-specific properties (furnace progress, etc.). |
_action_counter |
Counter for generating unique action numbers for window clicks.
TYPE:
|
get_next_action_number
¶
get_next_action_number() -> int
Generate the next unique action number for window clicks.
Each window click needs a unique action number that the server uses to send back confirmation packets. This counter starts at 1 and increments for each action.
| RETURNS | DESCRIPTION |
|---|---|
int
|
Unique action number for this window |
set_slot
¶
Set an item in a specific slot.
Updates the slot at the given index with item data. If item is None, the slot is cleared. The slot's item and item_count are updated accordingly.
| PARAMETER | DESCRIPTION |
|---|---|
slot_index
|
Index of the slot to modify (0-based)
TYPE:
|
item
|
Item data to place in slot, or None to clear the slot Expected keys: 'item_id', 'item_damage', 'nbt', 'item_count'
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Slot
|
The modified slot object |
| RAISES | DESCRIPTION |
|---|---|
IndexError
|
If slot_index is out of bounds (< 0 or >= slot_count) |
get_slot
¶
set_property
¶
Slot
¶
Slot(index: int)
Represents a single inventory slot that can hold an item.
A slot is identified by an index and can contain an item with a specific count. Slots can be empty (no item or zero count).
| ATTRIBUTE | DESCRIPTION |
|---|---|
index |
The slot's position index in the container
TYPE:
|
item |
The item currently in this slot, None if empty |