diff options
| author | mat <git@matdoes.dev> | 2025-12-28 09:06:47 -0330 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-12-28 09:06:47 -0330 |
| commit | 839d536e8020b291bc1d213a5e8e823dc513a940 (patch) | |
| tree | 60cab8b908ad53af0126e2cb1dec670d073936a3 /azalea/src/client_impl/inventory.rs | |
| parent | 5b1a78baf757897532be8c308a37c99fb2ca3352 (diff) | |
| download | azalea-drasl-839d536e8020b291bc1d213a5e8e823dc513a940.tar.xz | |
add a few more functions for getting common components to Client
Diffstat (limited to 'azalea/src/client_impl/inventory.rs')
| -rw-r--r-- | azalea/src/client_impl/inventory.rs | 7 |
1 files changed, 5 insertions, 2 deletions
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::<Inventory>().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::<Inventory>().selected_hotbar_slot } /// Update the selected hotbar slot index. |
