aboutsummaryrefslogtreecommitdiff
path: root/azalea/src/pathfinder/tests.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-08-15 00:50:42 -0330
committermat <git@matdoes.dev>2025-08-15 07:20:52 +0300
commit980f41be2283857eecf113aa75f187fed35f4270 (patch)
tree9add2135c110a921998932b43ac4b0b2c0d6409f /azalea/src/pathfinder/tests.rs
parent6758d58109925fbe59bb5693296b995697faaf3a (diff)
downloadazalea-drasl-980f41be2283857eecf113aa75f187fed35f4270.tar.xz
add PathfinderOpts and clean up some pathfinder code
Diffstat (limited to 'azalea/src/pathfinder/tests.rs')
-rw-r--r--azalea/src/pathfinder/tests.rs21
1 files changed, 11 insertions, 10 deletions
diff --git a/azalea/src/pathfinder/tests.rs b/azalea/src/pathfinder/tests.rs
index 8458a982..4f9d2296 100644
--- a/azalea/src/pathfinder/tests.rs
+++ b/azalea/src/pathfinder/tests.rs
@@ -16,6 +16,7 @@ use super::{
moves,
simulation::{SimulatedPlayerBundle, Simulation},
};
+use crate::pathfinder::goto_event::PathfinderOpts;
fn setup_blockposgoal_simulation(
partial_chunks: &mut PartialChunkStorage,
@@ -35,11 +36,13 @@ fn setup_blockposgoal_simulation(
simulation.app.world_mut().send_event(GotoEvent {
entity: simulation.entity,
goal: Arc::new(BlockPosGoal(end_pos)),
- successors_fn: moves::default_move,
- allow_mining: false,
- retry_on_no_path: true,
- min_timeout: PathfinderTimeout::Nodes(1_000_000),
- max_timeout: PathfinderTimeout::Nodes(5_000_000),
+ opts: PathfinderOpts {
+ successors_fn: moves::default_move,
+ allow_mining: false,
+ retry_on_no_path: true,
+ min_timeout: PathfinderTimeout::Nodes(1_000_000),
+ max_timeout: PathfinderTimeout::Nodes(5_000_000),
+ },
});
simulation
}
@@ -299,11 +302,9 @@ fn test_mine_through_non_colliding_block() {
simulation.app.world_mut().send_event(GotoEvent {
entity: simulation.entity,
goal: Arc::new(BlockPosGoal(BlockPos::new(0, 69, 0))),
- successors_fn: moves::default_move,
- allow_mining: true,
- retry_on_no_path: true,
- min_timeout: PathfinderTimeout::Nodes(1_000_000),
- max_timeout: PathfinderTimeout::Nodes(5_000_000),
+ opts: PathfinderOpts::new()
+ .min_timeout(PathfinderTimeout::Nodes(1_000_000))
+ .max_timeout(PathfinderTimeout::Nodes(5_000_000)),
});
assert_simulation_reaches(&mut simulation, 200, BlockPos::new(0, 70, 0));