From 5ed0c5d635b1c28721b3c32f1d6ce04a30934992 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 28 Sep 2025 16:51:06 +1100 Subject: update deps --- azalea/README.md | 6 ++++-- azalea/examples/testbot/commands/debug.rs | 22 ++++++++++++++++++++-- azalea/src/lib.rs | 1 + 3 files changed, 25 insertions(+), 4 deletions(-) (limited to 'azalea') diff --git a/azalea/README.md b/azalea/README.md index ec25bfd0..5d0b6d5f 100644 --- a/azalea/README.md +++ b/azalea/README.md @@ -56,8 +56,10 @@ async fn main() { #[derive(Default, Clone, Component)] pub struct State { - // The state gets cloned whenever the handler is called, so to have all the - // clones point to the same data and have it be mutable, we use an Arc>. + /// An example field that stores the number of messages that've been + /// received by the client so far. The state gets cloned whenever the + /// handler is called, so to have all the clones point to the same data and + /// have it be mutable, we use an Arc>. pub messages_received: Arc> } diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs index 23e29b00..3cdf4cf2 100644 --- a/azalea/examples/testbot/commands/debug.rs +++ b/azalea/examples/testbot/commands/debug.rs @@ -14,11 +14,11 @@ use azalea::{ world::MinecraftEntityId, }; use azalea_core::hit_result::HitResult; -use azalea_entity::EntityKindComponent; +use azalea_entity::{EntityKindComponent, EntityUuid, metadata}; use azalea_inventory::components::MaxStackSize; use azalea_world::InstanceContainer; use bevy_app::AppExit; -use bevy_ecs::event::Events; +use bevy_ecs::{event::Events, query::With}; use parking_lot::Mutex; use super::{CommandSource, Ctx}; @@ -214,6 +214,24 @@ pub fn register(commands: &mut CommandDispatcher>) { 1 })); + commands.register(literal("players").executes(|ctx: &Ctx| { + let source = ctx.source.lock(); + let player_entities = source + .bot + .nearest_entities_by::, ()>(|_: &()| true); + let tab_list = source.bot.tab_list(); + for player_entity in player_entities { + let uuid = source.bot.entity_component::(player_entity); + source.reply(format!( + "{} - {} ({:?})", + player_entity, + tab_list.get(&uuid).map_or("?", |p| p.profile.name.as_str()), + uuid + )); + } + 1 + })); + commands.register(literal("debugecsleak").executes(|ctx: &Ctx| { let source = ctx.source.lock(); diff --git a/azalea/src/lib.rs b/azalea/src/lib.rs index ae49c649..e3e92170 100644 --- a/azalea/src/lib.rs +++ b/azalea/src/lib.rs @@ -46,6 +46,7 @@ pub type BoxHandleFn = Box BoxFuture<'static, R> + Send>; pub type HandleFn = fn(Client, azalea_client::Event, S) -> Fut; +/// An error related to resolving the server address when starting a client. #[derive(Error, Debug)] pub enum StartError { #[error("Invalid address")] -- cgit v1.2.3