1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00

remove .unwrap() from wait_until_goto_target_reached (#216)

* fix panics in `wait_until_goto_target_reached`

* replace eprintln with warn

---------

Co-authored-by: mat <git@matdoes.dev>
This commit is contained in:
manen 2025-04-19 18:33:47 +02:00 committed by GitHub
parent 77f9d929b6
commit 6c1b144970
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -40,6 +40,7 @@ use futures_lite::future;
use goals::BlockPosGoal;
use parking_lot::RwLock;
use rel_block_pos::RelBlockPos;
use tokio::sync::broadcast::error::RecvError;
use tracing::{debug, error, info, trace, warn};
pub use self::debug::PathfinderDebugParticles;
@ -253,7 +254,11 @@ impl PathfinderClientExt for azalea_client::Client {
let mut tick_broadcaster = self.get_tick_broadcaster();
while !self.is_goto_target_reached() {
// check every tick
tick_broadcaster.recv().await.unwrap();
match tick_broadcaster.recv().await {
Ok(_) => (),
Err(RecvError::Closed) => return,
Err(err) => warn!("{err}"),
};
}
}