class Rosegold::PlayerMenu

Overview

Player inventory menu — the view when no container is open. Replaces the previous InventoryMenu class. Layout: crafting_result(0), crafting(1-4), armor(5-8), main(9-35), hotbar(36-44), offhand(45)

Defined in:

rosegold/inventory/menus/player_menu.cr

Constant Summary

ARMOR_END = 8
ARMOR_START = 5
BOOTS_SLOT = 8
CHESTPLATE_SLOT = 6
CRAFTING_END = 4
CRAFTING_RESULT = 0
CRAFTING_START = 1
HELMET_SLOT = 5
HOTBAR_END = 44
HOTBAR_START = 36
LEGGINGS_SLOT = 7
MAIN_END = 35
MAIN_START = 9
OFF_HAND = 45
TOTAL_SLOTS = 46

Constructors

Instance Method Summary

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, copy_slot(slot : Rosegold::Slot) : Rosegold::Slot copy_slot, 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, 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, quick_move_stack(slot_index : Int32) : Rosegold::Slot quick_move_stack, 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
, 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

def self.new(client) #

[View source]

Instance Method Detail

def [](index : Int32) : Rosegold::Slot #
Description copied from class Rosegold::Menu

Slot access


[View source]
def []=(index : Int32, slot : Rosegold::Slot) #

[View source]
def allow_modification?(slot_index : Int32) : Bool #

[View source]
def armor_slots : Array(Rosegold::Slot) #

[View source]
def boots : Rosegold::Slot #

[View source]
def chestplate : Rosegold::Slot #

[View source]
def close #

[View source]
def container_slots : Array(Rosegold::WindowSlot) #

[View source]
def crafting_grid : Array(Rosegold::Slot) #

[View source]
def crafting_result : Rosegold::Slot #

[View source]
def crafting_slots : Array(Rosegold::Slot) #

[View source]
def get_slot_max_stack_size(slot_index : Int32, item_slot : Rosegold::Slot) : Int32 #

[View source]
def handle_close #

[View source]
def helmet : Rosegold::Slot #

[View source]
def hotbar_slot_index(hotbar_nr : Int32) : Int32 #

[View source]
def hotbar_window_slots : Array(Rosegold::WindowSlot) #

[View source]
def inventory_slots : Array(Rosegold::WindowSlot) #

[View source]
def leggings : Rosegold::Slot #

[View source]
def may_pickup?(slot_index : Int32) : Bool #

[View source]
def may_place?(slot_index : Int32, item_slot : Rosegold::Slot) : Bool #
Description copied from class Rosegold::Menu

Slot validation


[View source]
def menu_id : UInt8 #

[View source]
def off_hand : Rosegold::Slot #

[View source]
def offhand : Array(Rosegold::WindowSlot) #

[View source]
def offhand_slot_index : Int32 #
Description copied from class Rosegold::Menu

Slot group accessors


[View source]
def player_inventory : PlayerInventory #

[View source]
def player_inventory_start : Int32 #
Description copied from class Rosegold::Menu

Player inventory start offset within this menu


[View source]
def quick_move_stack(slot_index : Int32) : Rosegold::Slot #
Description copied from class Rosegold::Menu

Shift-click routing (each menu subclass defines where items move)


[View source]
def total_slots : Int32 #

[View source]