diff options
| author | mat <git@matdoes.dev> | 2026-05-06 03:36:16 -0100 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2026-05-07 08:05:58 -1200 |
| commit | 9ffd0e80bbb3feace231553d6539124585b03e3c (patch) | |
| tree | ad8df7d07df9f8f542e288c263d76b8ffd637416 /azalea/src/client_impl/inventory.rs | |
| parent | 4d1f430408dc6854c1af5fb14b2641e293a9cf43 (diff) | |
| download | azalea-drasl-9ffd0e80bbb3feace231553d6539124585b03e3c.tar.xz | |
change panicking functions in Client and EntityRef to return an AzaleaResult instead
Diffstat (limited to 'azalea/src/client_impl/inventory.rs')
| -rw-r--r-- | azalea/src/client_impl/inventory.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/azalea/src/client_impl/inventory.rs b/azalea/src/client_impl/inventory.rs index 72a05136..93e599aa 100644 --- a/azalea/src/client_impl/inventory.rs +++ b/azalea/src/client_impl/inventory.rs @@ -2,7 +2,7 @@ use azalea_client::inventory::SetSelectedHotbarSlotEvent; use azalea_entity::inventory::Inventory; use azalea_inventory::Menu; -use crate::Client; +use crate::{Client, client_impl::error::AzaleaResult}; impl Client { /// Return the menu that is currently open, or the player's inventory if no @@ -10,8 +10,8 @@ impl Client { /// /// If you need to interact with the menu, consider using /// [`Self::open_inventory`] instead. - pub fn menu(&self) -> Menu { - self.component::<Inventory>().menu().clone() + pub fn menu(&self) -> AzaleaResult<Menu> { + Ok(self.component::<Inventory>()?.menu().clone()) } /// Returns the index of the hotbar slot that's currently selected. @@ -21,8 +21,8 @@ impl Client { /// the start of [`azalea_inventory::Menu::hotbar_slots_range`]. /// /// You can use [`Self::set_selected_hotbar_slot`] to change it. - pub fn selected_hotbar_slot(&self) -> u8 { - self.component::<Inventory>().selected_hotbar_slot + pub fn selected_hotbar_slot(&self) -> AzaleaResult<u8> { + Ok(self.component::<Inventory>()?.selected_hotbar_slot) } /// Update the selected hotbar slot index. |
