aboutsummaryrefslogtreecommitdiff
path: root/azalea/src/pathfinder
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/pathfinder
parenta91b62d4cac9dcd7a20a76b75382143ccf80bd2e (diff)
downloadazalea-drasl-4885f848a4716987e0e3b30e14952aa9ea0b2647.tar.xz
fix incorrect jumping
Diffstat (limited to 'azalea/src/pathfinder')
-rw-r--r--azalea/src/pathfinder/mod.rs29
1 files changed, 29 insertions, 0 deletions
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)
+ );
+ }
}