diff options
| author | mat <git@matdoes.dev> | 2023-10-01 20:23:26 -0500 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2023-10-01 20:23:26 -0500 |
| commit | 4f6ab28325ce87678a406e07327bd4f051282109 (patch) | |
| tree | 1481029bb8a2a4bde50031c1c50ded3c9c216bf8 /azalea/src/pathfinder/moves/basic.rs | |
| parent | 37146f46f03f2e18becb7b58725a9183bcbcb2e6 (diff) | |
| download | azalea-drasl-4f6ab28325ce87678a406e07327bd4f051282109.tar.xz | |
add pathfinder benchmark
Diffstat (limited to 'azalea/src/pathfinder/moves/basic.rs')
| -rw-r--r-- | azalea/src/pathfinder/moves/basic.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/azalea/src/pathfinder/moves/basic.rs b/azalea/src/pathfinder/moves/basic.rs index 188eb3a6..1785ec2e 100644 --- a/azalea/src/pathfinder/moves/basic.rs +++ b/azalea/src/pathfinder/moves/basic.rs @@ -5,7 +5,7 @@ use azalea_core::{ direction::CardinalDirection, position::{BlockPos, Vec3}, }; -use azalea_world::Instance; +use azalea_world::ChunkStorage; use crate::{ pathfinder::{astar, costs::*}, @@ -17,7 +17,7 @@ use super::{ ExecuteCtx, IsReachedCtx, MoveData, }; -pub fn basic_move(world: &Instance, node: BlockPos) -> Vec<Edge> { +pub fn basic_move(world: &ChunkStorage, node: BlockPos) -> Vec<Edge> { let mut edges = Vec::new(); edges.extend(forward_move(world, node)); edges.extend(ascend_move(world, node)); @@ -26,7 +26,7 @@ pub fn basic_move(world: &Instance, node: BlockPos) -> Vec<Edge> { edges } -fn forward_move(world: &Instance, pos: BlockPos) -> Vec<Edge> { +fn forward_move(world: &ChunkStorage, pos: BlockPos) -> Vec<Edge> { let mut edges = Vec::new(); for dir in CardinalDirection::iter() { let offset = BlockPos::new(dir.x(), 0, dir.z()); @@ -72,7 +72,7 @@ fn execute_forward_move( }); } -fn ascend_move(world: &Instance, pos: BlockPos) -> Vec<Edge> { +fn ascend_move(world: &ChunkStorage, pos: BlockPos) -> Vec<Edge> { let mut edges = Vec::new(); for dir in CardinalDirection::iter() { let offset = BlockPos::new(dir.x(), 1, dir.z()); @@ -156,7 +156,7 @@ pub fn ascend_is_reached( BlockPos::from(position) == target || BlockPos::from(position) == target.down(1) } -fn descend_move(world: &Instance, pos: BlockPos) -> Vec<Edge> { +fn descend_move(world: &ChunkStorage, pos: BlockPos) -> Vec<Edge> { let mut edges = Vec::new(); for dir in CardinalDirection::iter() { let dir_delta = BlockPos::new(dir.x(), 0, dir.z()); @@ -258,7 +258,7 @@ pub fn descend_is_reached( && (position.y - target.y as f64) < 0.5 } -fn diagonal_move(world: &Instance, pos: BlockPos) -> Vec<Edge> { +fn diagonal_move(world: &ChunkStorage, pos: BlockPos) -> Vec<Edge> { let mut edges = Vec::new(); for dir in CardinalDirection::iter() { let right = dir.right(); |
