From f01579f70b4acc045559c1aca82d8d39a1f79f12 Mon Sep 17 00:00:00 2001 From: mat Date: Tue, 12 Aug 2025 16:02:42 -0630 Subject: Client::chat now takes Into and doc fixes --- azalea-client/src/entity_query.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'azalea-client/src/entity_query.rs') diff --git a/azalea-client/src/entity_query.rs b/azalea-client/src/entity_query.rs index 49119b98..84fcf9e7 100644 --- a/azalea-client/src/entity_query.rs +++ b/azalea-client/src/entity_query.rs @@ -54,7 +54,7 @@ impl Client { /// use bevy_ecs::query::With; /// /// # fn example(mut bot: Client, sender_name: String) { - /// let entity = bot.entity_by::, (&GameProfileComponent,)>( + /// let entity = bot.any_entity_by::, (&GameProfileComponent,)>( /// |(profile,): &(&GameProfileComponent,)| profile.name == sender_name, /// ); /// if let Some(entity) = entity { @@ -86,23 +86,21 @@ impl Client { /// /// # Example /// ``` - /// use azalea_entity::{Position, metadata::Player, LocalEntity}; - /// use bevy_ecs::query::With; + /// use azalea_entity::{LocalEntity, Position, metadata::Player}; + /// use bevy_ecs::query::{With, Without}; /// /// # fn example(mut bot: azalea_client::Client, sender_name: String) { - /// // look at the nearest player - /// if let Some(closest_player) = bot - /// .entities_by::<(With, Without), ()>(|_: &()| true) - /// .first() + /// // get the position of the nearest player + /// if let Some(nearest_player) = + /// bot.nearest_entity_by::<(With, Without), ()>(|_: &()| true) /// { - /// let closest_player_pos = *bot.entity_component::(*closest_player); - /// bot.look_at(closest_player_pos.up(1.62)); - /// } + /// let nearest_player_pos = *bot.entity_component::(nearest_player); + /// bot.chat(format!("You are at {nearest_player_pos}")); /// } + /// # } /// ``` /// /// [`Entity`]: bevy_ecs::entity::Entity - /// [`Instance`]: azalea_world::Instance pub fn nearest_entity_by( &self, predicate: impl EntityPredicate, -- cgit v1.2.3