aboutsummaryrefslogtreecommitdiff
path: root/azalea-world/src/chunk_storage.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-04-17 22:17:18 +0200
committermat <git@matdoes.dev>2025-04-17 11:09:14 -0930
commit2aa046c4b50a0de850eb567cd8bced03e8f99bd6 (patch)
tree2fda147226a725b588ef0e7ff36b22cad6509bd4 /azalea-world/src/chunk_storage.rs
parent6a83a6fa387170ae71fbe06791cf3afa20aac1df (diff)
downloadazalea-drasl-2aa046c4b50a0de850eb567cd8bced03e8f99bd6.tar.xz
make BlockState::id private
Diffstat (limited to 'azalea-world/src/chunk_storage.rs')
-rw-r--r--azalea-world/src/chunk_storage.rs17
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);
}
}