1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00

more pathfinding stuff

This commit is contained in:
mat 2022-10-28 16:18:22 +00:00
parent 18e45c8e95
commit d888c0569b
286 changed files with 14 additions and 8 deletions

0
.cargo/config.toml Normal file → Executable file
View file

0
.github/workflows/check.yml vendored Normal file → Executable file
View file

0
.gitignore vendored Normal file → Executable file
View file

0
Cargo.toml Normal file → Executable file
View file

0
README.md Normal file → Executable file
View file

0
azalea-auth/Cargo.toml Normal file → Executable file
View file

0
azalea-auth/README.md Normal file → Executable file
View file

0
azalea-auth/examples/auth.rs Normal file → Executable file
View file

0
azalea-auth/src/auth.rs Normal file → Executable file
View file

0
azalea-auth/src/cache.rs Normal file → Executable file
View file

0
azalea-auth/src/sessionserver.rs Normal file → Executable file
View file

0
azalea-block/Cargo.toml Normal file → Executable file
View file

0
azalea-block/README.md Normal file → Executable file
View file

0
azalea-block/azalea-block-macros/Cargo.toml Normal file → Executable file
View file

0
azalea-block/azalea-block-macros/src/lib.rs Normal file → Executable file
View file

0
azalea-block/azalea-block-macros/src/utils.rs Normal file → Executable file
View file

0
azalea-block/src/behavior.rs Normal file → Executable file
View file

0
azalea-block/src/blocks.rs Normal file → Executable file
View file

0
azalea-block/src/lib.rs Normal file → Executable file
View file

0
azalea-brigadier/Cargo.toml Normal file → Executable file
View file

0
azalea-brigadier/src/suggestion/mod.rs Normal file → Executable file
View file

0
azalea-brigadier/src/suggestion/suggestions.rs Normal file → Executable file
View file

0
azalea-buf/Cargo.toml Normal file → Executable file
View file

0
azalea-buf/README.md Normal file → Executable file
View file

0
azalea-buf/azalea-buf-macros/Cargo.toml Normal file → Executable file
View file

0
azalea-buf/azalea-buf-macros/README.md Normal file → Executable file
View file

0
azalea-buf/azalea-buf-macros/src/lib.rs Normal file → Executable file
View file

0
azalea-buf/src/definitions.rs Normal file → Executable file
View file

0
azalea-buf/src/lib.rs Normal file → Executable file
View file

0
azalea-buf/src/read.rs Normal file → Executable file
View file

0
azalea-buf/src/serializable_uuid.rs Normal file → Executable file
View file

0
azalea-buf/src/write.rs Normal file → Executable file
View file

0
azalea-chat/Cargo.toml Normal file → Executable file
View file

0
azalea-chat/src/text_component.rs Normal file → Executable file
View file

0
azalea-chat/src/translatable_component.rs Normal file → Executable file
View file

0
azalea-client/Cargo.toml Normal file → Executable file
View file

0
azalea-client/src/account.rs Normal file → Executable file
View file

0
azalea-client/src/chat.rs Normal file → Executable file
View file

0
azalea-client/src/client.rs Normal file → Executable file
View file

0
azalea-client/src/get_mc_dir.rs Normal file → Executable file
View file

0
azalea-client/src/movement.rs Normal file → Executable file
View file

0
azalea-client/src/player.rs Normal file → Executable file
View file

0
azalea-core/Cargo.toml Normal file → Executable file
View file

0
azalea-core/README.md Normal file → Executable file
View file

0
azalea-core/src/aabb.rs Normal file → Executable file
View file

0
azalea-core/src/bitset.rs Normal file → Executable file
View file

0
azalea-core/src/block_hit_result.rs Normal file → Executable file
View file

0
azalea-core/src/cursor3d.rs Normal file → Executable file
View file

0
azalea-core/src/delta.rs Normal file → Executable file
View file

0
azalea-core/src/direction.rs Normal file → Executable file
View file

0
azalea-core/src/particle/mod.rs Normal file → Executable file
View file

0
azalea-core/src/position.rs Normal file → Executable file
View file

0
azalea-core/src/slot.rs Normal file → Executable file
View file

0
azalea-crypto/Cargo.toml Normal file → Executable file
View file

0
azalea-crypto/README.md Normal file → Executable file
View file

0
azalea-crypto/benches/my_benchmark.rs Normal file → Executable file
View file

0
azalea-crypto/src/lib.rs Normal file → Executable file
View file

0
azalea-crypto/src/signing.rs Normal file → Executable file
View file

0
azalea-language/Cargo.toml Normal file → Executable file
View file

0
azalea-language/README.md Normal file → Executable file
View file

0
azalea-language/src/en_us.json Normal file → Executable file
View file

0
azalea-language/src/lib.rs Normal file → Executable file
View file

0
azalea-nbt/Cargo.toml Normal file → Executable file
View file

0
azalea-pathfinder/Cargo.toml Normal file → Executable file
View file

0
azalea-pathfinder/README.md Normal file → Executable file
View file

14
azalea-pathfinder/src/lib.rs Normal file → Executable file
View file

@ -29,6 +29,7 @@ impl azalea::Plugin for Plugin {
pub trait Trait { pub trait Trait {
fn goto(&self, goal: impl Goal); fn goto(&self, goal: impl Goal);
fn execute_path(&self, path: &Vec<Node>);
} }
impl Trait for azalea_client::Client { impl Trait for azalea_client::Client {
@ -41,10 +42,10 @@ impl Trait for azalea_client::Client {
let successors = |node: &Node| { let successors = |node: &Node| {
let mut edges = Vec::new(); let mut edges = Vec::new();
let possible_moves: Vec<&dyn moves::Move> = vec![ let possible_moves: Vec<&dyn moves::Move> = vec![
&moves::NorthMove {}, &moves::NorthMove,
&moves::SouthMove {}, &moves::SouthMove,
&moves::EastMove {}, &moves::EastMove,
&moves::WestMove {}, &moves::WestMove,
]; ];
let dimension = self.dimension.lock(); let dimension = self.dimension.lock();
for possible_move in possible_moves.iter() { for possible_move in possible_moves.iter() {
@ -70,6 +71,11 @@ impl Trait for azalea_client::Client {
); );
let p = pf.find_path(); let p = pf.find_path();
} }
fn execute_path(&self, path: &Vec<Node>) {
let start = path[0];
// self.look_at(start.pos);
}
} }
#[derive(Eq, PartialEq, Hash, Clone, Copy, Debug)] #[derive(Eq, PartialEq, Hash, Clone, Copy, Debug)]

8
azalea-pathfinder/src/moves.rs Normal file → Executable file
View file

@ -32,7 +32,7 @@ pub trait Move {
fn offset(&self) -> BlockPos; fn offset(&self) -> BlockPos;
} }
pub struct NorthMove {} pub struct NorthMove;
impl Move for NorthMove { impl Move for NorthMove {
fn can_execute(&self, dim: &Dimension, pos: &BlockPos) -> bool { fn can_execute(&self, dim: &Dimension, pos: &BlockPos) -> bool {
is_standable(&(pos + &self.offset()), dim) is_standable(&(pos + &self.offset()), dim)
@ -42,7 +42,7 @@ impl Move for NorthMove {
} }
} }
pub struct SouthMove {} pub struct SouthMove;
impl Move for SouthMove { impl Move for SouthMove {
fn can_execute(&self, dim: &Dimension, pos: &BlockPos) -> bool { fn can_execute(&self, dim: &Dimension, pos: &BlockPos) -> bool {
is_standable(&(pos + &self.offset()), dim) is_standable(&(pos + &self.offset()), dim)
@ -52,7 +52,7 @@ impl Move for SouthMove {
} }
} }
pub struct EastMove {} pub struct EastMove;
impl Move for EastMove { impl Move for EastMove {
fn can_execute(&self, dim: &Dimension, pos: &BlockPos) -> bool { fn can_execute(&self, dim: &Dimension, pos: &BlockPos) -> bool {
is_standable(&(pos + &self.offset()), dim) is_standable(&(pos + &self.offset()), dim)
@ -62,7 +62,7 @@ impl Move for EastMove {
} }
} }
pub struct WestMove {} pub struct WestMove;
impl Move for WestMove { impl Move for WestMove {
fn can_execute(&self, dim: &Dimension, pos: &BlockPos) -> bool { fn can_execute(&self, dim: &Dimension, pos: &BlockPos) -> bool {
is_standable(&(pos + &self.offset()), dim) is_standable(&(pos + &self.offset()), dim)

0
azalea-pathfinder/src/mtdstarlite.rs Normal file → Executable file
View file

0
azalea-physics/Cargo.toml Normal file → Executable file
View file

0
azalea-physics/README.md Normal file → Executable file
View file

0
azalea-physics/src/collision/blocks.rs Normal file → Executable file
View file

0
azalea-physics/src/collision/dimension_collisions.rs Normal file → Executable file
View file

0
azalea-physics/src/collision/discrete_voxel_shape.rs Normal file → Executable file
View file

0
azalea-physics/src/collision/mergers.rs Normal file → Executable file
View file

0
azalea-physics/src/collision/mod.rs Normal file → Executable file
View file

0
azalea-physics/src/collision/shape.rs Normal file → Executable file
View file

0
azalea-physics/src/lib.rs Normal file → Executable file
View file

0
azalea-protocol/Cargo.toml Normal file → Executable file
View file

0
azalea-protocol/README.md Normal file → Executable file
View file

0
azalea-protocol/azalea-protocol-macros/Cargo.toml Normal file → Executable file
View file

0
azalea-protocol/azalea-protocol-macros/src/lib.rs Normal file → Executable file
View file

0
azalea-protocol/src/connect.rs Normal file → Executable file
View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

Some files were not shown because too many files have changed in this diff Show more