From 9ffd0e80bbb3feace231553d6539124585b03e3c Mon Sep 17 00:00:00 2001 From: mat Date: Wed, 6 May 2026 03:36:16 -0100 Subject: change panicking functions in Client and EntityRef to return an AzaleaResult instead --- azalea/src/client_impl/inventory.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 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::().menu().clone() + pub fn menu(&self) -> AzaleaResult { + Ok(self.component::()?.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::().selected_hotbar_slot + pub fn selected_hotbar_slot(&self) -> AzaleaResult { + Ok(self.component::()?.selected_hotbar_slot) } /// Update the selected hotbar slot index. -- cgit v1.2.3