From 1347f3549282397be6a46b8b7cb76a7900d0690a Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 4 Jan 2024 01:55:00 -0600 Subject: rename open_container to open_container_at and add get_open_container --- azalea-client/src/inventory.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'azalea-client/src') diff --git a/azalea-client/src/inventory.rs b/azalea-client/src/inventory.rs index 527feae7..bf421bf4 100644 --- a/azalea-client/src/inventory.rs +++ b/azalea-client/src/inventory.rs @@ -90,6 +90,9 @@ pub struct InventoryComponent { /// The current container menu that the player has open. If no container is /// open, this will be `None`. pub container_menu: Option, + /// The custom name of the menu that's currently open. This is Some when + /// `container_menu` is Some. + pub container_menu_title: Option, /// The item that is currently held by the cursor. `Slot::Empty` if nothing /// is currently being held. /// @@ -566,6 +569,7 @@ impl Default for InventoryComponent { inventory_menu: Menu::Player(azalea_inventory::Player::default()), id: 0, container_menu: None, + container_menu_title: None, carried: ItemSlot::Empty, state_id: 0, quick_craft_status: QuickCraftStatusKind::Start, @@ -593,6 +597,7 @@ fn handle_menu_opened_event( let mut inventory = query.get_mut(event.entity).unwrap(); inventory.id = event.window_id as u8; inventory.container_menu = Some(Menu::from_kind(event.menu_type)); + inventory.container_menu_title = Some(event.title.clone()); } } @@ -651,6 +656,7 @@ pub fn handle_client_side_close_container_event( let mut inventory = query.get_mut(event.entity).unwrap(); inventory.container_menu = None; inventory.id = 0; + inventory.container_menu_title = None; } } -- cgit v1.2.3