aboutsummaryrefslogtreecommitdiff
path: root/azalea/src
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2023-09-10 17:33:10 -0500
committermat <git@matdoes.dev>2023-09-10 17:33:10 -0500
commit4885f848a4716987e0e3b30e14952aa9ea0b2647 (patch)
treeec33b6e5239ac4b0309b1aa1e2d9d5296824e210 /azalea/src
parenta91b62d4cac9dcd7a20a76b75382143ccf80bd2e (diff)
downloadazalea-drasl-4885f848a4716987e0e3b30e14952aa9ea0b2647.tar.xz
fix incorrect jumping
Diffstat (limited to 'azalea/src')
-rw-r--r--azalea/src/bot.rs8
-rw-r--r--azalea/src/pathfinder/mod.rs29
2 files changed, 32 insertions, 5 deletions
diff --git a/azalea/src/bot.rs b/azalea/src/bot.rs
index 3f56555a..353ec99f 100644
--- a/azalea/src/bot.rs
+++ b/azalea/src/bot.rs
@@ -15,7 +15,7 @@ use azalea_core::{BlockPos, Vec3};
use azalea_entity::{
clamp_look_direction, metadata::Player, EyeHeight, Jumping, Local, LookDirection, Position,
};
-use azalea_physics::{handle_force_jump, PhysicsSet};
+use azalea_physics::PhysicsSet;
use bevy_app::{FixedUpdate, Update};
use bevy_ecs::prelude::Event;
use bevy_ecs::schedule::IntoSystemConfigs;
@@ -34,10 +34,8 @@ impl Plugin for BotPlugin {
Update,
(
insert_bot,
- look_at_listener
- .before(handle_force_jump)
- .before(clamp_look_direction),
- jump_listener.before(handle_force_jump),
+ look_at_listener.before(clamp_look_direction),
+ jump_listener,
),
)
.add_systems(FixedUpdate, stop_jumping.after(PhysicsSet));
diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs
index 0a55a598..eab292ec 100644
--- a/azalea/src/pathfinder/mod.rs
+++ b/azalea/src/pathfinder/mod.rs
@@ -381,4 +381,33 @@ mod tests {
BlockPos::new(2, 71, 2)
);
}
+
+ #[test]
+ fn test_jump_with_sideways_momentum() {
+ let mut partial_chunks = PartialChunkStorage::default();
+ let mut simulation = setup_simulation(
+ &mut partial_chunks,
+ BlockPos::new(0, 71, 3),
+ BlockPos::new(5, 76, 0),
+ vec![
+ BlockPos::new(0, 70, 3),
+ BlockPos::new(0, 70, 2),
+ BlockPos::new(0, 70, 1),
+ BlockPos::new(0, 70, 0),
+ BlockPos::new(1, 71, 0),
+ BlockPos::new(2, 72, 0),
+ BlockPos::new(3, 73, 0),
+ BlockPos::new(4, 74, 0),
+ BlockPos::new(5, 75, 0),
+ ],
+ );
+ for i in 0..120 {
+ simulation.tick();
+ info!("-- tick #{i} --")
+ }
+ assert_eq!(
+ BlockPos::from(simulation.position()),
+ BlockPos::new(5, 76, 0)
+ );
+ }
}