From 9d4f738d4e66adf0796e163d1c9368aaba906bba Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Fri, 10 Feb 2023 01:56:45 +0000 Subject: make blockstate good --- azalea-world/src/chunk_storage.rs | 8 ++++---- azalea-world/src/entity/metadata.rs | 2 +- azalea-world/src/entity/mod.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'azalea-world/src') diff --git a/azalea-world/src/chunk_storage.rs b/azalea-world/src/chunk_storage.rs index 734dfe29..c2a72ea2 100755 --- a/azalea-world/src/chunk_storage.rs +++ b/azalea-world/src/chunk_storage.rs @@ -343,20 +343,20 @@ impl Section { .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) + BlockState::try_from(state).unwrap_or(BlockState::AIR) } 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 as u32); + .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) + BlockState::try_from(previous_state).unwrap_or(BlockState::AIR) } fn set(&mut self, pos: ChunkSectionBlockPos, state: BlockState) { self.states - .set(pos.x as usize, pos.y as usize, pos.z as usize, state as u32); + .set(pos.x as usize, pos.y as usize, pos.z as usize, state.id); } } diff --git a/azalea-world/src/entity/metadata.rs b/azalea-world/src/entity/metadata.rs index c95d8c3a..3d6c52c8 100644 --- a/azalea-world/src/entity/metadata.rs +++ b/azalea-world/src/entity/metadata.rs @@ -2368,7 +2368,7 @@ impl Default for EndermanMetadataBundle { }, }, }, - carry_state: CarryState(BlockState::Air), + carry_state: CarryState(BlockState::AIR), creepy: Creepy(false), stared_at: StaredAt(false), } diff --git a/azalea-world/src/entity/mod.rs b/azalea-world/src/entity/mod.rs index 0d0449ac..9b1191fb 100644 --- a/azalea-world/src/entity/mod.rs +++ b/azalea-world/src/entity/mod.rs @@ -94,7 +94,7 @@ pub fn on_pos(offset: f32, chunk_storage: &ChunkStorage, pos: &Position) -> Bloc // TODO: check if block below is a fence, wall, or fence gate let block_pos = pos.down(1); let block_state = chunk_storage.get_block_state(&block_pos); - if block_state == Some(BlockState::Air) { + if block_state == Some(BlockState::AIR) { let block_pos_below = block_pos.down(1); let block_state_below = chunk_storage.get_block_state(&block_pos_below); if let Some(_block_state_below) = block_state_below { -- cgit v1.2.3