diff --git a/azalea-core/src/position.rs b/azalea-core/src/position.rs index 14ecfcc10..be06e8258 100755 --- a/azalea-core/src/position.rs +++ b/azalea-core/src/position.rs @@ -212,6 +212,7 @@ macro_rules! vec3_impl { } /// Used to represent an exact position in the world where an entity could be. +/// /// For blocks, [`BlockPos`] is used instead. #[derive(Clone, Copy, Debug, Default, PartialEq, AzBuf)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs index 802d9ebd6..b82b5f84d 100644 --- a/azalea/src/pathfinder/mod.rs +++ b/azalea/src/pathfinder/mod.rs @@ -945,6 +945,7 @@ mod tests { // simulation.app.add_plugins(bevy_log::LogPlugin { // level: bevy_log::Level::TRACE, // filter: "".to_string(), + // ..Default::default() // }); simulation.app.world_mut().send_event(GotoEvent { @@ -1153,4 +1154,24 @@ mod tests { ); assert_simulation_reaches(&mut simulation, 80, BlockPos::new(4, 71, 12)); } + + #[test] + fn test_jumps_with_more_sideways_momentum() { + let mut partial_chunks = PartialChunkStorage::default(); + let mut simulation = setup_blockposgoal_simulation( + &mut partial_chunks, + BlockPos::new(0, 71, 0), + BlockPos::new(2, 74, 9), + vec![ + BlockPos::new(0, 70, 0), + BlockPos::new(0, 70, 1), + BlockPos::new(0, 70, 2), + BlockPos::new(0, 71, 3), + BlockPos::new(0, 72, 6), + BlockPos::new(0, 73, 9), + BlockPos::new(2, 73, 9), + ], + ); + assert_simulation_reaches(&mut simulation, 80, BlockPos::new(2, 74, 9)); + } } diff --git a/azalea/src/pathfinder/moves/parkour.rs b/azalea/src/pathfinder/moves/parkour.rs index 0f279dcaf..1d35f323a 100644 --- a/azalea/src/pathfinder/moves/parkour.rs +++ b/azalea/src/pathfinder/moves/parkour.rs @@ -1,5 +1,6 @@ use azalea_client::{SprintDirection, WalkDirection}; use azalea_core::{direction::CardinalDirection, position::BlockPos}; +use tracing::trace; use super::{Edge, ExecuteCtx, IsReachedCtx, MoveData, PathfinderCtx}; use crate::pathfinder::{astar, costs::*}; @@ -212,12 +213,14 @@ fn execute_parkour_move(mut ctx: ExecuteCtx) { if !is_at_start_block && !is_at_jump_block && (position.y - start.y as f64) < 0.094 - && distance_from_start < 0.81 + && distance_from_start < 0.85 { // we have to be on the start block to jump ctx.look_at(start_center); + trace!("looking at start_center"); } else { ctx.look_at(target_center); + trace!("looking at target_center"); } if !is_at_start_block && is_at_jump_block && distance_from_start > required_distance_from_center