diff options
| author | mat <git@matdoes.dev> | 2026-01-18 13:39:46 -0930 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2026-01-18 13:39:46 -0930 |
| commit | 1a3a027bf9c9e0c9c290fd309adbc2904cc78d84 (patch) | |
| tree | ea8e1b13713f07382b45880ea9b60bf5b65499ec | |
| parent | 268c62587e090c72b67a29e1cc42cda6c9d7340b (diff) | |
| download | azalea-drasl-1a3a027bf9c9e0c9c290fd309adbc2904cc78d84.tar.xz | |
fix tests
| -rw-r--r-- | azalea/src/pathfinder/execute/mod.rs | 1 | ||||
| -rw-r--r-- | azalea/src/pathfinder/execute/simulation.rs | 59 | ||||
| -rw-r--r-- | azalea/src/pathfinder/mod.rs | 2 | ||||
| -rw-r--r-- | azalea/src/pathfinder/simulation.rs | 2 |
4 files changed, 32 insertions, 32 deletions
diff --git a/azalea/src/pathfinder/execute/mod.rs b/azalea/src/pathfinder/execute/mod.rs index ab7a1a82..d022885c 100644 --- a/azalea/src/pathfinder/execute/mod.rs +++ b/azalea/src/pathfinder/execute/mod.rs @@ -354,6 +354,7 @@ pub fn timeout_movement( } } +#[allow(clippy::too_many_arguments)] fn patch_path_from_timeout( entity: Entity, executing_path: &mut ExecutingPath, diff --git a/azalea/src/pathfinder/execute/simulation.rs b/azalea/src/pathfinder/execute/simulation.rs index 5bb82753..8d884327 100644 --- a/azalea/src/pathfinder/execute/simulation.rs +++ b/azalea/src/pathfinder/execute/simulation.rs @@ -42,7 +42,9 @@ use crate::{ /// To use it, simply add [`SimulationPathfinderExecutionPlugin`] as a plugin. /// /// ``` -/// use azalea::{simulation::SimulationPathfinderExecutionPlugin, swarm::prelude::*}; +/// use azalea::{ +/// pathfinder::execute::simulation::SimulationPathfinderExecutionPlugin, swarm::prelude::*, +/// }; /// /// let builder = SwarmBuilder::new().add_plugins(SimulationPathfinderExecutionPlugin); /// // ... @@ -209,18 +211,16 @@ pub fn tick_execute_path( entity, direction: SprintDirection::Forward, }); + } else if physics_state.was_sprinting { + walk_events.write(StartWalkEvent { + entity, + direction: WalkDirection::None, + }); } else { - if physics_state.was_sprinting { - walk_events.write(StartWalkEvent { - entity, - direction: WalkDirection::None, - }); - } else { - walk_events.write(StartWalkEvent { - entity, - direction: WalkDirection::Forward, - }); - } + walk_events.write(StartWalkEvent { + entity, + direction: WalkDirection::Forward, + }); } if *jumping && target.center().horizontal_distance_squared_to(**position) @@ -359,23 +359,21 @@ fn run_one_simulation( entity: sim.entity, direction: SprintDirection::Forward, }); + } else if ecs + .get::<PhysicsState>(sim.entity) + .map(|p| p.trying_to_sprint) + .unwrap_or_default() + { + // have to let go for a tick to be able to start walking + ecs.write_message(StartWalkEvent { + entity: sim.entity, + direction: WalkDirection::None, + }); } else { - if ecs - .get::<PhysicsState>(sim.entity) - .map(|p| p.trying_to_sprint) - .unwrap_or_default() - { - // have to let go for a tick to be able to start walking - ecs.write_message(StartWalkEvent { - entity: sim.entity, - direction: WalkDirection::None, - }); - } else { - ecs.write_message(StartWalkEvent { - entity: sim.entity, - direction: WalkDirection::Forward, - }); - } + ecs.write_message(StartWalkEvent { + entity: sim.entity, + direction: WalkDirection::Forward, + }); } if state.jumping && simulating_to_block @@ -443,9 +441,8 @@ fn run_one_simulation( let (position, physics, mining, inventory) = query.get(sim.entity).unwrap(); - if physics.horizontal_collision && physics.velocity.y < -0. { - // if the simulated move just made us hit a wall that we aren't already jumping - // from then that's bad + if physics.horizontal_collision { + // if the simulated move made us hit a wall then it's bad break; } if physics.velocity.y < -0.7 && !physics.is_in_water() { diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs index 2a1a6220..8df04b14 100644 --- a/azalea/src/pathfinder/mod.rs +++ b/azalea/src/pathfinder/mod.rs @@ -6,7 +6,7 @@ //! Note that the pathfinder is highly optimized, but it will be very slow if //! it's not compiled with optimizations enabled. //! -//! For more efficient and realistic path execution, also see +//! For smoother and more realistic path execution, also see //! [`SimulationPathfinderExecutionPlugin`]. //! //! Much of the pathfinder's code is based on [Baritone](https://github.com/cabaletta/baritone). <3 diff --git a/azalea/src/pathfinder/simulation.rs b/azalea/src/pathfinder/simulation.rs index a8f24480..2afbbfad 100644 --- a/azalea/src/pathfinder/simulation.rs +++ b/azalea/src/pathfinder/simulation.rs @@ -83,6 +83,8 @@ fn create_simulation_world(chunks: ChunkStorage) -> (App, Arc<RwLock<World>>) { schedule.set_executor_kind(bevy_ecs::schedule::ExecutorKind::SingleThreaded); }); + app.finish(); + (app, world) } |
