mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
add distance param for ReachBlockPosGoal
This commit is contained in:
parent
1493c06de5
commit
f1b4ea876e
1 changed files with 3 additions and 2 deletions
|
@ -194,6 +194,7 @@ impl<T: Goal> Goal for AndGoals<T> {
|
|||
#[derive(Clone, Debug)]
|
||||
pub struct ReachBlockPosGoal {
|
||||
pub pos: BlockPos,
|
||||
pub distance: f32,
|
||||
pub chunk_storage: ChunkStorage,
|
||||
}
|
||||
impl Goal for ReachBlockPosGoal {
|
||||
|
@ -202,8 +203,8 @@ impl Goal for ReachBlockPosGoal {
|
|||
}
|
||||
fn success(&self, n: BlockPos) -> bool {
|
||||
// only do the expensive check if we're close enough
|
||||
let max_pick_range = 6;
|
||||
let actual_pick_range = 4.5;
|
||||
let max_pick_range = (self.distance + 2.).ceil() as i32;
|
||||
let actual_pick_range = self.distance.into();
|
||||
|
||||
let distance = (self.pos - n).length_squared();
|
||||
if distance > max_pick_range * max_pick_range {
|
||||
|
|
Loading…
Add table
Reference in a new issue