aboutsummaryrefslogtreecommitdiff
path: root/azalea/src
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2023-10-04 20:24:49 -0500
committermat <git@matdoes.dev>2023-10-04 20:24:49 -0500
commit17734cdcbf8ea30ded09a0b14372d92c11d1cc8c (patch)
treebd3ea629493015f3d1703f50c932da4b96b47b68 /azalea/src
parentc2fb99159556e1d55552aac0a782dbc69be338f3 (diff)
downloadazalea-drasl-17734cdcbf8ea30ded09a0b14372d92c11d1cc8c.tar.xz
add safety comments and simplify some code
Diffstat (limited to 'azalea/src')
-rw-r--r--azalea/src/pathfinder/moves/mod.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/azalea/src/pathfinder/moves/mod.rs b/azalea/src/pathfinder/moves/mod.rs
index 69145eeb..90109346 100644
--- a/azalea/src/pathfinder/moves/mod.rs
+++ b/azalea/src/pathfinder/moves/mod.rs
@@ -131,6 +131,7 @@ impl PathfinderCtx {
let (section_pos, section_block_pos) =
(ChunkSectionPos::from(pos), ChunkSectionBlockPos::from(pos));
let index = u16::from(section_block_pos) as usize;
+ // SAFETY: we're only accessing this from one thread
let cached_block_passable = unsafe { &mut *self.cached_block_passable.get() };
if let Some(cached) = cached_block_passable.iter_mut().find_map(|cached| {
if cached.pos == section_pos {
@@ -183,6 +184,7 @@ impl PathfinderCtx {
let (section_pos, section_block_pos) =
(ChunkSectionPos::from(pos), ChunkSectionBlockPos::from(pos));
let index = u16::from(section_block_pos) as usize;
+ // SAFETY: we're only accessing this from one thread
let cached_block_solid = unsafe { &mut *self.cached_block_solid.get() };
if let Some(cached) = cached_block_solid.iter_mut().find_map(|cached| {
if cached.pos == section_pos {