From a707e2eb82b74994a16083b31fa4576332cf1995 Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Fri, 15 Dec 2023 11:26:40 -0600 Subject: Add mining to the pathfinder (#122) * basic pathfinder mining poc * mining descending and autotool * pathfinder mining descending * pathfinder fixes * allow disabling pathfinder miner and other fixes * small optimization to avoid chunk vec iter lookup sometimes * seeded rng in pathfinder bench * consistently use f32::INFINITY this brings performance much closer to how it was before * astar heuristic optimization from baritone * add downward_move * fix downward move execute * avoid liquids and falling blocks when mining * fix COST_HEURISTIC * fix to not path through flowing liquids * only reset pathfinder timeout while mining if the block is close enough * cache mining costs of block positions * fix mine_while_at_start and move PathfinderDebugParticles to its own module * add ReachBlockPosGoal in other news: azalea's sin/cos functions were broken this whole time and i never noticed * clippy and add things that i accidentally didn't commit * improve wording on doc for azalea::pathfinder --- azalea-client/src/interact.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'azalea-client/src/interact.rs') diff --git a/azalea-client/src/interact.rs b/azalea-client/src/interact.rs index c8332d20..026e94ca 100644 --- a/azalea-client/src/interact.rs +++ b/azalea-client/src/interact.rs @@ -193,7 +193,7 @@ pub fn update_hit_result_component( }; let instance = instance_lock.read(); - let hit_result = pick(look_direction, &eye_position, &instance, pick_range); + let hit_result = pick(look_direction, &eye_position, &instance.chunks, pick_range); if let Some(mut hit_result_ref) = hit_result_ref { **hit_result_ref = hit_result; } else { @@ -212,13 +212,13 @@ pub fn update_hit_result_component( pub fn pick( look_direction: &LookDirection, eye_position: &Vec3, - instance: &Instance, + chunks: &azalea_world::ChunkStorage, pick_range: f64, ) -> BlockHitResult { let view_vector = view_vector(look_direction); let end_position = eye_position + &(view_vector * pick_range); azalea_physics::clip::clip( - &instance.chunks, + chunks, ClipContext { from: *eye_position, to: end_position, -- cgit v1.2.3