abstract class
Rosegold::Menu
- Rosegold::Menu
- Reference
- Object
Overview
Abstract base for all menu types (player inventory, chest, furnace, etc.) Replaces the previous InventoryOperations module + InventoryMenu/ContainerMenu split.
Direct Known Subclasses
Defined in:
rosegold/inventory/menu.crConstructors
Instance Method Summary
-
#[](index : Int32) : Rosegold::Slot
Slot access
- #[]=(index : Int32, slot : Rosegold::Slot)
- #allow_modification?(slot_index : Int32) : Bool
- #can_stack?(slot1 : Rosegold::Slot, slot2 : Rosegold::Slot) : Bool
- #check_and_fix_desync
- #close
- #container_slots : Array(Rosegold::WindowSlot)
- #content : Array(Rosegold::WindowSlot)
- #content_loaded? : Bool
- #copy_slot(slot : Rosegold::Slot) : Rosegold::Slot
-
#crafting_grid_range : Range(Int32, Int32)
Slot indices for the crafting grid (1..9 for crafting table, 1..4 for player inventory).
-
#crafting_result_move_end : Int32
Exclusive end index for moving crafting results into player inventory.
- #cursor : Rosegold::Slot
- #cursor=(cursor : Rosegold::Slot)
- #get_max_stack_size(item_slot : Rosegold::Slot) : Int32
- #get_slot_max_stack_size(slot_index : Int32, item_slot : Rosegold::Slot) : Int32
- #handle_close
- #hotbar : Array(Rosegold::WindowSlot)
- #hotbar_slot_index(hotbar_nr : Int32) : Int32
- #hotbar_slots : Array(Rosegold::Slot)
- #hotbar_window_slots : Array(Rosegold::WindowSlot)
- #id : UInt8
- #invalidate_content : Nil
- #inventory : Array(Rosegold::WindowSlot)
- #inventory_slots : Array(Rosegold::WindowSlot)
- #main_hand : Rosegold::Slot
- #main_inventory_slots : Array(Rosegold::Slot)
- #may_pickup?(slot_index : Int32) : Bool
-
#may_place?(slot_index : Int32, item_slot : Rosegold::Slot) : Bool
Slot validation
- #menu_id : UInt8
- #move_item_stack_to(source_index : Int32, target_start : Int32, target_end : Int32, reverse : Bool = false) : Bool
-
#offhand_slot_index : Int32
Slot group accessors
- #perform_cursor_drop_operation(button : Int32)
- #perform_drop_operation(slot_index : Int32, button : Int32)
- #perform_hotbar_swap(slot_index : Int32, button : Int32)
- #perform_offhand_swap_operation(slot_index : Int32)
- #perform_regular_click(slot_index : Int32, button : Int32)
- #perform_shift_click(slot_index : Int32)
- #player_inventory_slots : Array(Rosegold::Slot)
-
#player_inventory_start : Int32
Player inventory start offset within this menu
- #player_window_slots : Array(Rosegold::WindowSlot)
- #properties : Hash(Int16, Int16)
- #properties=(properties : Hash(Int16, Int16))
-
#quick_move_stack(slot_index : Int32) : Rosegold::Slot
Shift-click routing (each menu subclass defines where items move)
- #receive_content(packet : Clientbound::SetContainerContent) : Nil
- #safe_insert(target_slot_index : Int32, cursor_slot : Rosegold::Slot, amount : Int32)
- #safe_take(source_slot_index : Int32, amount : Int32)
- #same_item_same_components?(slot1 : Rosegold::Slot, slot2 : Rosegold::Slot) : Bool
- #send_click(slot_index : Int32, button : Int32, click_type)
- #send_click(slot_index : Int32, operation : ClickOperation)
-
#send_click_if!(slot_index : Int32, operation : ClickOperation, session : Client::PlaySession, &authorized : -> Bool) : Bool
Writes a click only if this menu, its content and session are still current under the write lock and
authorizedapproves. - #slots : Array(Rosegold::WindowSlot)
- #slots=(new_slots : Array(Rosegold::WindowSlot))
- #slots_match?(slot1 : Rosegold::Slot, slot2 : Rosegold::Slot) : Bool
- #state_id : UInt32
- #state_id=(state_id : UInt32)
- #swap_hotbar(hotbar_nr, slot : Rosegold::WindowSlot)
- #swap_hotbar(hotbar_nr, slot_number)
- #to_s(io)
- #total_slots : Int32
- #update_all_slots(slots : Array(Rosegold::Slot), cursor : Rosegold::Slot, packet_state_id : UInt32)
- #update_slot(index : Int32, slot : Rosegold::Slot, packet_state_id : UInt32)
Constructor Detail
Instance Method Detail
Slot indices for the crafting grid (1..9 for crafting table, 1..4 for player inventory).
Exclusive end index for moving crafting results into player inventory.
Slot validation
Player inventory start offset within this menu
Shift-click routing (each menu subclass defines where items move)
Writes a click only if this menu, its content and session are still
current under the write lock and authorized approves. Check the caller's
authority and view revision in that block; it may run again after the
click is built. Refused at once while another guarded menu write or an
ordinary click is in progress, and if an ordinary click predicts before
the write. A false result writes nothing.
An IO failure disconnects and raises, and delivery may be unknown.