aboutsummaryrefslogtreecommitdiff
path: root/azalea/src/pathfinder
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-06-05 00:59:14 -0400
committermat <git@matdoes.dev>2025-06-05 00:59:14 -0400
commit338f931c51ab3665c7c18124ca3e35bfd2ff5ca0 (patch)
tree5109e8df092fcea99ee4282882cdd9614b2beb05 /azalea/src/pathfinder
parent874f05181028af233b81b1d7d3322a39a0421f33 (diff)
downloadazalea-drasl-338f931c51ab3665c7c18124ca3e35bfd2ff5ca0.tar.xz
wait for block to exist when calling open_container_at
Diffstat (limited to 'azalea/src/pathfinder')
-rw-r--r--azalea/src/pathfinder/goals.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/azalea/src/pathfinder/goals.rs b/azalea/src/pathfinder/goals.rs
index aa6f357a..4c0dbafa 100644
--- a/azalea/src/pathfinder/goals.rs
+++ b/azalea/src/pathfinder/goals.rs
@@ -220,6 +220,12 @@ impl Goal for ReachBlockPosGoal {
BlockPosGoal(self.pos).heuristic(n)
}
fn success(&self, n: BlockPos) -> bool {
+ if n.up(1) == self.pos {
+ // our head is in the block, assume it's always reachable (to reduce the amount
+ // of impossible goals)
+ return true;
+ }
+
// only do the expensive check if we're close enough
let distance = self.pos.distance_squared_to(&n);
if distance > self.max_check_distance.pow(2) {