diff options
Diffstat (limited to 'azalea/src/pathfinder/moves')
| -rw-r--r-- | azalea/src/pathfinder/moves/mod.rs | 16 |
1 files changed, 14 insertions, 2 deletions
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> { |
