From 839d536e8020b291bc1d213a5e8e823dc513a940 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 28 Dec 2025 09:06:47 -0330 Subject: add a few more functions for getting common components to Client --- azalea/src/client_impl/inventory.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'azalea/src/client_impl/inventory.rs') diff --git a/azalea/src/client_impl/inventory.rs b/azalea/src/client_impl/inventory.rs index fc1e2e73..72a05136 100644 --- a/azalea/src/client_impl/inventory.rs +++ b/azalea/src/client_impl/inventory.rs @@ -7,8 +7,11 @@ use crate::Client; impl Client { /// Return the menu that is currently open, or the player's inventory if no /// menu is open. + /// + /// If you need to interact with the menu, consider using + /// [`Self::open_inventory`] instead. pub fn menu(&self) -> Menu { - self.query_self::<&Inventory, _>(|inv| inv.menu().clone()) + self.component::().menu().clone() } /// Returns the index of the hotbar slot that's currently selected. @@ -19,7 +22,7 @@ impl Client { /// /// You can use [`Self::set_selected_hotbar_slot`] to change it. pub fn selected_hotbar_slot(&self) -> u8 { - self.query_self::<&Inventory, _>(|inv| inv.selected_hotbar_slot) + self.component::().selected_hotbar_slot } /// Update the selected hotbar slot index. -- cgit v1.2.3