From 2aa046c4b50a0de850eb567cd8bced03e8f99bd6 Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 17 Apr 2025 22:17:18 +0200 Subject: make BlockState::id private --- azalea-world/src/chunk_storage.rs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'azalea-world/src/chunk_storage.rs') 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); } } -- cgit v1.2.3