abstract class
Rosegold::ContainerMenu
- Rosegold::ContainerMenu
- Rosegold::Menu
- Reference
- Object
Overview
Shared base for all container menus (everything except PlayerMenu). Provides slot access, state sync, close, and default validation/shift-click. Subclasses only need to define named accessors and override behavior that differs.
Direct Known Subclasses
- Rosegold::AnvilMenu
- Rosegold::BrewingStandMenu
- Rosegold::ChestMenu
- Rosegold::CraftingMenu
- Rosegold::EnchantmentMenu
- Rosegold::FurnaceMenu
- Rosegold::GenericMenu
- Rosegold::HopperMenu
- Rosegold::MerchantMenu
Defined in:
rosegold/inventory/container_menu.crConstructors
Instance Method Summary
-
#[](index : Int32) : Rosegold::Slot
Slot access
- #[]=(index : Int32, slot : Rosegold::Slot)
- #allow_modification?(slot_index : Int32) : Bool
- #close
-
#close(session : Client::PlaySession | Nil = nil, &authorized : -> Bool) : Nil
Closes this menu only while it is still the open one in the PLAY session (session, default the current one) and
authorizedapproves, rechecked under the write lock. -
#close_if!(session : Client::PlaySession, &authorized : -> Bool) : Bool
Returns whether a close was written for this menu in session.
- #container_size : Int32
- #container_slots : Array(Rosegold::WindowSlot)
- #get_slot_max_stack_size(slot_index : Int32, item_slot : Rosegold::Slot) : Int32
- #handle_close
- #hotbar_slot_index(hotbar_nr : Int32) : Int32
- #hotbar_window_slots : Array(Rosegold::WindowSlot)
- #inventory_slots : Array(Rosegold::WindowSlot)
- #may_pickup?(slot_index : Int32) : Bool
-
#may_place?(slot_index : Int32, item_slot : Rosegold::Slot) : Bool
Slot validation
- #menu_id : UInt8
-
#offhand_slot_index : Int32
Slot group accessors
-
#player_inventory_start : Int32
Player inventory start offset within this menu
-
#quick_move_stack(slot_index : Int32) : Rosegold::Slot
Shift-click routing (each menu subclass defines where items move)
- #total_slots : Int32
Instance methods inherited from class Rosegold::Menu
[](index : Int32) : Rosegold::Slot
[],
[]=(index : Int32, slot : Rosegold::Slot)
[]=,
allow_modification?(slot_index : Int32) : Bool
allow_modification?,
can_stack?(slot1 : Rosegold::Slot, slot2 : Rosegold::Slot) : Bool
can_stack?,
check_and_fix_desync
check_and_fix_desync,
close
close,
container_slots : Array(Rosegold::WindowSlot)
container_slots,
content : Array(Rosegold::WindowSlot)
content,
content_loaded? : Bool
content_loaded?,
copy_slot(slot : Rosegold::Slot) : Rosegold::Slot
copy_slot,
crafting_grid_range : Range(Int32, Int32)
crafting_grid_range,
crafting_result_move_end : Int32
crafting_result_move_end,
cursor : Rosegold::Slot
cursor,
cursor=(cursor : Rosegold::Slot)
cursor=,
get_max_stack_size(item_slot : Rosegold::Slot) : Int32
get_max_stack_size,
get_slot_max_stack_size(slot_index : Int32, item_slot : Rosegold::Slot) : Int32
get_slot_max_stack_size,
handle_close
handle_close,
hotbar : Array(Rosegold::WindowSlot)
hotbar,
hotbar_slot_index(hotbar_nr : Int32) : Int32
hotbar_slot_index,
hotbar_slots : Array(Rosegold::Slot)
hotbar_slots,
hotbar_window_slots : Array(Rosegold::WindowSlot)
hotbar_window_slots,
id : UInt8
id,
invalidate_content : Nil
invalidate_content,
inventory : Array(Rosegold::WindowSlot)
inventory,
inventory_slots : Array(Rosegold::WindowSlot)
inventory_slots,
main_hand : Rosegold::Slot
main_hand,
main_inventory_slots : Array(Rosegold::Slot)
main_inventory_slots,
may_pickup?(slot_index : Int32) : Bool
may_pickup?,
may_place?(slot_index : Int32, item_slot : Rosegold::Slot) : Bool
may_place?,
menu_id : UInt8
menu_id,
move_item_stack_to(source_index : Int32, target_start : Int32, target_end : Int32, reverse : Bool = false) : Bool
move_item_stack_to,
offhand_slot_index : Int32
offhand_slot_index,
perform_cursor_drop_operation(button : Int32)
perform_cursor_drop_operation,
perform_drop_operation(slot_index : Int32, button : Int32)
perform_drop_operation,
perform_hotbar_swap(slot_index : Int32, button : Int32)
perform_hotbar_swap,
perform_offhand_swap_operation(slot_index : Int32)
perform_offhand_swap_operation,
perform_regular_click(slot_index : Int32, button : Int32)
perform_regular_click,
perform_shift_click(slot_index : Int32)
perform_shift_click,
player_inventory_slots : Array(Rosegold::Slot)
player_inventory_slots,
player_inventory_start : Int32
player_inventory_start,
player_window_slots : Array(Rosegold::WindowSlot)
player_window_slots,
properties : Hash(Int16, Int16)
properties,
properties=(properties : Hash(Int16, Int16))
properties=,
quick_move_stack(slot_index : Int32) : Rosegold::Slot
quick_move_stack,
receive_content(packet : Clientbound::SetContainerContent) : Nil
receive_content,
safe_insert(target_slot_index : Int32, cursor_slot : Rosegold::Slot, amount : Int32)
safe_insert,
safe_take(source_slot_index : Int32, amount : Int32)
safe_take,
same_item_same_components?(slot1 : Rosegold::Slot, slot2 : Rosegold::Slot) : Bool
same_item_same_components?,
send_click(slot_index : Int32, button : Int32, click_type)send_click(slot_index : Int32, operation : ClickOperation) send_click, send_click_if!(slot_index : Int32, operation : ClickOperation, session : Client::PlaySession, &authorized : -> Bool) : Bool send_click_if!, slots : Array(Rosegold::WindowSlot) slots, slots=(new_slots : Array(Rosegold::WindowSlot)) slots=, slots_match?(slot1 : Rosegold::Slot, slot2 : Rosegold::Slot) : Bool slots_match?, state_id : UInt32 state_id, state_id=(state_id : UInt32) state_id=, swap_hotbar(hotbar_nr, slot : Rosegold::WindowSlot)
swap_hotbar(hotbar_nr, slot_number) swap_hotbar, to_s(io) to_s, total_slots : Int32 total_slots, update_all_slots(slots : Array(Rosegold::Slot), cursor : Rosegold::Slot, packet_state_id : UInt32) update_all_slots, update_slot(index : Int32, slot : Rosegold::Slot, packet_state_id : UInt32) update_slot
Constructor methods inherited from class Rosegold::Menu
new(client : Rosegold::Client, player_inventory : Rosegold::PlayerInventory)
new
Constructor Detail
Instance Method Detail
Slot access
Closes this menu only while it is still the open one in the PLAY session
(session, default the current one) and authorized approves, rechecked
under the write lock. A refused close sends nothing and is not retried. A
sent close retires this menu before ContainerClosed listeners run.
Returns whether a close was written for this menu in session. Checks
that this menu is still open and authorized approves under the write
lock. Refused at once while another guarded menu write or an ordinary
click is in progress. Never retires a replacement menu. An IO failure
disconnects and raises, and delivery may be unknown.
Slot validation
Slot group accessors
Player inventory start offset within this menu
Shift-click routing (each menu subclass defines where items move)