From f3a5e91a8ccbcd03a239aa3565dbfddabb26fa76 Mon Sep 17 00:00:00 2001 From: mat Date: Tue, 3 Jun 2025 09:52:30 +0930 Subject: fix issues when pathfinding to non-full blocks and add Client::view_inventory --- azalea-client/src/client.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'azalea-client/src/client.rs') diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs index 7b63ff12..02625326 100644 --- a/azalea-client/src/client.rs +++ b/azalea-client/src/client.rs @@ -342,13 +342,13 @@ impl Client { /// ``` /// # use azalea_client::{Client, mining::Mining}; /// # fn example(bot: &Client) { - /// let is_mining = bot.map_get_component::(|m| m.is_some()); + /// let is_mining = bot.map_get_component::(|m| m).is_some(); /// # } /// ``` - pub fn map_get_component(&self, f: impl FnOnce(Option<&T>) -> R) -> R { + pub fn map_get_component(&self, f: impl FnOnce(&T) -> R) -> Option { let mut ecs = self.ecs.lock(); let value = self.query::>(&mut ecs); - f(value) + value.map(f) } /// Get an `RwLock` with a reference to our (potentially shared) world. -- cgit v1.2.3