class
Rosegold::PlayerInventory
- Rosegold::PlayerInventory
- Reference
- Object
Overview
Persistent player inventory that matches vanilla Minecraft's model. This inventory never changes structure (always 36 slots) and persists across container operations.
Defined in:
rosegold/inventory/player_inventory.crConstant Summary
-
HOTBAR_SIZE =
9
-
INVENTORY_SIZE =
ItemConstants::InventorySize::PLAYER_INVENTORY
-
MAIN_INVENTORY_SIZE =
27
Constructors
Instance Method Summary
-
#[](index : Int32) : Rosegold::Slot
Get slot by index (0-35)
-
#[]=(index : Int32, slot : Rosegold::Slot)
Set slot by index (0-35)
-
#count(&block : Rosegold::Slot -> Bool) : Int32
Count items matching predicate
-
#find(&block : Rosegold::Slot -> Bool) : Rosegold::Slot | Nil
Find first slot matching predicate
-
#first_empty_slot : Int32 | Nil
Find first empty slot index, returns nil if full
-
#hotbar : Array(Rosegold::Slot)
Hotbar slots (indices 0-8)
-
#items : Array(Rosegold::Slot)
Direct access to inventory items (like vanilla)
-
#main_inventory : Array(Rosegold::Slot)
Main inventory slots (indices 9-35)
-
#selected_slot(selection : UInt8) : Rosegold::Slot
Get selected hotbar slot (based on client selection)
- #to_s(io)
-
#update_slot(index : Int32, slot : Rosegold::Slot)
Update a specific slot (used by packet handlers)
-
#update_slots(slots : Array(Rosegold::Slot), start_index : Int32 = 0)
Update multiple slots (used by SetContainerContent)
Constructor Detail
Instance Method Detail
Find first slot matching predicate
Get selected hotbar slot (based on client selection)
Update a specific slot (used by packet handlers)
Update multiple slots (used by SetContainerContent)