From db9a9e53ca18911fb2045b7d6af4ed6df388eaaa Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 5 Jan 2026 08:29:53 +0330 Subject: fix panic in a_star and some prep for pathfinder swimming --- azalea/src/pathfinder/moves/mod.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'azalea/src/pathfinder/moves') diff --git a/azalea/src/pathfinder/moves/mod.rs b/azalea/src/pathfinder/moves/mod.rs index fc574a4c..33c34c3b 100644 --- a/azalea/src/pathfinder/moves/mod.rs +++ b/azalea/src/pathfinder/moves/mod.rs @@ -217,10 +217,22 @@ pub struct IsReachedCtx<'a> { #[must_use] pub fn default_is_reached( IsReachedCtx { - position, target, .. + position, + target, + physics, + .. }: IsReachedCtx, ) -> bool { - player_pos_to_block_pos(position) == target + let block_pos = player_pos_to_block_pos(position); + if block_pos == target { + return true; + } + // it's fine if we slightly go under the target while swimming + if physics.is_in_water() && block_pos.up(1) == target { + return true; + } + + false } pub struct PathfinderCtx<'a> { -- cgit v1.2.3