diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2022-11-12 23:54:05 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-12 23:54:05 -0600 |
| commit | 6eee543a3367d38a6f0e9bffb457a2bd76a8f9cc (patch) | |
| tree | a5e493ccd7ec24293b8d866242c3836146517122 /azalea-physics/src/collision/dimension_collisions.rs | |
| parent | fa57d03627aa20b1df44caed7cb025b6db1d9b53 (diff) | |
| download | azalea-drasl-6eee543a3367d38a6f0e9bffb457a2bd76a8f9cc.tar.xz | |
Pathfinder (#25)
Pathfinding is very much not done, but it works enough and I want to get this merged.
TODO: fast replanning, goals that aren't a single node, falling moves (it should be able to play the dropper), parkour moves
Diffstat (limited to 'azalea-physics/src/collision/dimension_collisions.rs')
| -rwxr-xr-x[-rw-r--r--] | azalea-physics/src/collision/dimension_collisions.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/azalea-physics/src/collision/dimension_collisions.rs b/azalea-physics/src/collision/dimension_collisions.rs index 35eb9f5b..fd4e5141 100644..100755 --- a/azalea-physics/src/collision/dimension_collisions.rs +++ b/azalea-physics/src/collision/dimension_collisions.rs @@ -3,7 +3,8 @@ use azalea_block::BlockState; use azalea_core::{ChunkPos, ChunkSectionPos, Cursor3d, CursorIterationType, EPSILON}; use azalea_world::entity::EntityData; use azalea_world::{Chunk, Dimension}; -use std::sync::{Arc, Mutex}; +use parking_lot::Mutex; +use std::sync::Arc; use super::Shapes; @@ -92,10 +93,10 @@ impl<'a> Iterator for BlockCollisions<'a> { Some(chunk) => chunk, None => continue, }; - let chunk_lock = chunk.lock().unwrap(); let pos = item.pos; - let block_state: BlockState = chunk_lock + let block_state: BlockState = chunk + .lock() .get(&(&pos).into(), self.dimension.min_y()) .unwrap_or(BlockState::Air); |
