class
Rosegold::ContainerHandle
- Rosegold::ContainerHandle
- Reference
- Object
Overview
User-facing handle for interacting with an open container. Wraps a Menu and provides intent-level operations (withdraw, deposit) as well as item-level operations (pickup, put_down, move, swap). Auto-closes via ensure when used with a block.
Defined in:
rosegold/inventory/container_handle.crConstructors
Instance Method Summary
- #as_anvil : AnvilMenu | Nil
- #as_brewing_stand : BrewingStandMenu | Nil
-
#as_chest : ChestMenu | Nil
Returns the menu as a specific type, or nil if it doesn't match.
- #as_crafting : CraftingMenu | Nil
- #as_enchantment : EnchantmentMenu | Nil
- #as_furnace : FurnaceMenu | Nil
- #as_hopper : HopperMenu | Nil
- #as_merchant : MerchantMenu | Nil
- #close
-
#count_in_container(spec) : Int32
Count matching items in the container.
-
#count_in_player(spec) : Int32
Count matching items in the player inventory.
-
#deposit(spec, count : Int32 = Int32::MAX) : Int32
Transfer items from player inventory to container via shift-click.
-
#drop(slot : Int32, full_stack : Bool = false)
Drop items from a slot.
-
#find_in_container(spec) : WindowSlot | Nil
Find the first slot matching spec in the container.
-
#find_in_inventory(spec) : WindowSlot | Nil
Find the first slot matching spec in the player inventory.
- #menu : Menu
-
#pickup(slot : Int32, count : Int32 = Int32::MAX)
Pick up items from a slot into the cursor.
-
#put_down(slot : Int32, count : Int32 = Int32::MAX)
Put down items from cursor into a slot.
-
#quick_move(slot : Int32)
Shift-click a slot (moves items between container and player inventory).
-
#swap_with_hotbar(slot : Int32, hotbar_slot : Int32)
Swap a slot with a hotbar slot (number keys 1-9).
-
#swap_with_offhand(slot : Int32)
Swap a slot with the offhand (F key).
-
#withdraw(spec, count : Int32 = Int32::MAX) : Int32
Transfer items from container to player inventory via shift-click.
Constructor Detail
Instance Method Detail
Returns the menu as a specific type, or nil if it doesn't match.
Transfer items from player inventory to container via shift-click. Returns the number of items actually transferred.
Find the first slot matching spec in the container.
Find the first slot matching spec in the player inventory.
Pick up items from a slot into the cursor. Uses left-click for full stack, right-click for half.
Put down items from cursor into a slot. Left-click places all, right-click places one.
Shift-click a slot (moves items between container and player inventory).
Swap a slot with a hotbar slot (number keys 1-9).
Transfer items from container to player inventory via shift-click. Returns the number of items actually transferred.