aboutsummaryrefslogtreecommitdiff
path: root/azalea/src/pathfinder/goals.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-04-15 22:04:43 -0430
committermat <git@matdoes.dev>2025-04-15 22:04:43 -0430
commita9820dfd79bf24a0a6fcb2345aad6c79a21585a5 (patch)
treea8e6290707fee0e1b18812aba599da74e7fc6eed /azalea/src/pathfinder/goals.rs
parent1a0c4e2de9e6d82d5efdfac2bab17a73c79fc466 (diff)
downloadazalea-drasl-a9820dfd79bf24a0a6fcb2345aad6c79a21585a5.tar.xz
make goto async and clean up some examples
Diffstat (limited to 'azalea/src/pathfinder/goals.rs')
-rw-r--r--azalea/src/pathfinder/goals.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/azalea/src/pathfinder/goals.rs b/azalea/src/pathfinder/goals.rs
index 0fb72446..9052c8fd 100644
--- a/azalea/src/pathfinder/goals.rs
+++ b/azalea/src/pathfinder/goals.rs
@@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize};
use super::costs::{COST_HEURISTIC, FALL_N_BLOCKS_COST, JUMP_ONE_BLOCK_COST};
-pub trait Goal: Debug {
+pub trait Goal: Debug + Send + Sync {
#[must_use]
fn heuristic(&self, n: BlockPos) -> f32;
#[must_use]
@@ -100,6 +100,11 @@ pub struct RadiusGoal {
pub pos: Vec3,
pub radius: f32,
}
+impl RadiusGoal {
+ pub fn new(pos: Vec3, radius: f32) -> Self {
+ Self { pos, radius }
+ }
+}
impl Goal for RadiusGoal {
fn heuristic(&self, n: BlockPos) -> f32 {
let n = n.center();