diff options
Diffstat (limited to 'azalea-world/src/chunk_storage.rs')
| -rw-r--r-- | azalea-world/src/chunk_storage.rs | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/azalea-world/src/chunk_storage.rs b/azalea-world/src/chunk_storage.rs index 39cbc84f..d8357a95 100644 --- a/azalea-world/src/chunk_storage.rs +++ b/azalea-world/src/chunk_storage.rs @@ -476,25 +476,18 @@ impl AzaleaWrite for Section { impl Section { pub fn get(&self, pos: ChunkSectionBlockPos) -> BlockState { - // TODO: use the unsafe method and do the check earlier - let state = self - .states - .get(pos.x as usize, pos.y as usize, pos.z as usize); - // if there's an unknown block assume it's air - BlockState::try_from(state).unwrap_or(BlockState::AIR) + self.states + .get(pos.x as usize, pos.y as usize, pos.z as usize) } pub fn get_and_set(&mut self, pos: ChunkSectionBlockPos, state: BlockState) -> BlockState { - let previous_state = - self.states - .get_and_set(pos.x as usize, pos.y as usize, pos.z as usize, state.id); - // if there's an unknown block assume it's air - BlockState::try_from(previous_state).unwrap_or(BlockState::AIR) + self.states + .get_and_set(pos.x as usize, pos.y as usize, pos.z as usize, state) } pub fn set(&mut self, pos: ChunkSectionBlockPos, state: BlockState) { self.states - .set(pos.x as usize, pos.y as usize, pos.z as usize, state.id); + .set(pos.x as usize, pos.y as usize, pos.z as usize, state); } } |
