aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2024-01-04 01:55:00 -0600
committermat <git@matdoes.dev>2024-01-04 01:55:00 -0600
commit1347f3549282397be6a46b8b7cb76a7900d0690a (patch)
treed3d468db0c9947f2914b6d0d71dc299c1b3e2634 /azalea-client/src
parent13e6421cf5aeeddc035f42141da776d09d177e33 (diff)
downloadazalea-drasl-1347f3549282397be6a46b8b7cb76a7900d0690a.tar.xz
rename open_container to open_container_at and add get_open_container
Diffstat (limited to 'azalea-client/src')
-rw-r--r--azalea-client/src/inventory.rs6
1 files changed, 6 insertions, 0 deletions
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<azalea_inventory::Menu>,
+ /// The custom name of the menu that's currently open. This is Some when
+ /// `container_menu` is Some.
+ pub container_menu_title: Option<FormattedText>,
/// 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;
}
}