From 20c7e27250148f62bab9e7b99e4f0cd6deb82325 Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Sun, 28 Dec 2025 04:31:29 -0600 Subject: Change Client::component to return a reference (#298) * change Client::component to return a reference * write docs * merge main * remove unused parking_lot feature --- azalea/examples/testbot/commands/debug.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'azalea/examples/testbot/commands/debug.rs') diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs index edadd697..711c3260 100644 --- a/azalea/examples/testbot/commands/debug.rs +++ b/azalea/examples/testbot/commands/debug.rs @@ -110,7 +110,7 @@ pub fn register(commands: &mut CommandDispatcher>) { let hit_result = source.bot.component::(); - match &*hit_result { + match &**hit_result { HitResult::Block(r) => { if r.miss { source.reply("I'm not looking at anything"); @@ -121,7 +121,7 @@ pub fn register(commands: &mut CommandDispatcher>) { source.reply(format!("I'm looking at {block:?} at {block_pos:?}")); } HitResult::Entity(r) => { - let entity_kind = *source.bot.entity_component::(r.entity); + let entity_kind = **source.bot.entity_component::(r.entity); source.reply(format!( "I'm looking at {entity_kind} ({:?}) at {}", r.entity, r.location @@ -180,7 +180,7 @@ pub fn register(commands: &mut CommandDispatcher>) { "is_path_partial: {}, path.len: {}, queued_path.len: {}", executing_path.is_path_partial, executing_path.path.len(), - if let Some(queued) = executing_path.queued_path { + if let Some(queued) = &executing_path.queued_path { queued.len().to_string() } else { "n/a".to_owned() @@ -261,9 +261,7 @@ pub fn register(commands: &mut CommandDispatcher>) { thread::sleep(Duration::from_secs(1)); // dump the ecs - let mut ecs = ecs.lock(); - - + let mut ecs = ecs.write(); let report_path = env::temp_dir().join("azalea-ecs-leak-report.txt"); let mut report = File::create(&report_path).unwrap(); @@ -357,7 +355,12 @@ pub fn register(commands: &mut CommandDispatcher>) { thread::spawn(move || { thread::sleep(Duration::from_secs(1)); - source.lock().bot.ecs.lock().write_message(AppExit::Success); + source + .lock() + .bot + .ecs + .write() + .write_message(AppExit::Success); }); 1 -- cgit v1.2.3