aboutsummaryrefslogtreecommitdiff
path: root/azalea/benches
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2023-10-10 23:21:23 -0500
committermat <git@matdoes.dev>2023-10-10 23:21:23 -0500
commit9a687f0ffebad80441e036aabe14e7cf80c774d3 (patch)
tree2f6ad5a1a14cae23723550c934df395aab1733f6 /azalea/benches
parent0297b8aacee27d9e86cea781b3751591e32df401 (diff)
downloadazalea-drasl-9a687f0ffebad80441e036aabe14e7cf80c774d3.tar.xz
start adding mining to pathfinder
Diffstat (limited to 'azalea/benches')
-rw-r--r--azalea/benches/pathfinder.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/azalea/benches/pathfinder.rs b/azalea/benches/pathfinder.rs
index 3fb1c7b2..406b726d 100644
--- a/azalea/benches/pathfinder.rs
+++ b/azalea/benches/pathfinder.rs
@@ -4,12 +4,14 @@ use azalea::{
pathfinder::{
astar::{self, a_star},
goals::BlockPosGoal,
+ mining::MiningCache,
world::CachedWorld,
Goal,
},
BlockPos,
};
use azalea_core::position::{ChunkBlockPos, ChunkPos};
+use azalea_inventory::Menu;
use azalea_world::{Chunk, ChunkStorage, PartialChunkStorage};
use criterion::{criterion_group, criterion_main, Criterion};
use parking_lot::RwLock;
@@ -80,10 +82,16 @@ fn bench_pathfinder(c: &mut Criterion) {
b.iter(|| {
let (world, start, end) = generate_bedrock_world(&mut partial_chunks, 4);
let cached_world = CachedWorld::new(Arc::new(RwLock::new(world.into())));
+ let mining_cache = MiningCache::new(Menu::Player(azalea_inventory::Player::default()));
let goal = BlockPosGoal(end);
let successors = |pos: BlockPos| {
- azalea::pathfinder::call_successors_fn(&cached_world, successors_fn, pos)
+ azalea::pathfinder::call_successors_fn(
+ &cached_world,
+ &mining_cache,
+ successors_fn,
+ pos,
+ )
};
let astar::Path { movements, partial } = a_star(