mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 06:16:04 +00:00
add additional pathfinder test and fix pathfinder failure
This commit is contained in:
parent
958848e8ed
commit
de5a53ce08
3 changed files with 26 additions and 1 deletions
|
@ -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))]
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue