From ef357fdf3667f3ded03203fc0f7cdec48a01ad8f Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Tue, 25 Mar 2025 11:17:39 -0500 Subject: 1.21.5 (#198) * 25w02a * move item_components codegen to a different module * remove outdated test * 25w03a * start updating to 24w09b * 1.21.5-pre2 * fix broken packets * 1.21.5-rc2 * merge main * delete unused acket_handling * 1.21.5 --- azalea-world/src/chunk_storage.rs | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 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 db5ac877..d6243b87 100755 --- a/azalea-world/src/chunk_storage.rs +++ b/azalea-world/src/chunk_storage.rs @@ -1,5 +1,4 @@ use std::collections::hash_map::Entry; -use std::str::FromStr; use std::{ collections::HashMap, fmt::Debug, @@ -13,7 +12,6 @@ use azalea_buf::{AzaleaRead, AzaleaWrite, BufReadError}; use azalea_core::position::{BlockPos, ChunkBlockPos, ChunkPos, ChunkSectionBlockPos}; use nohash_hasher::IntMap; use parking_lot::RwLock; -use simdnbt::owned::NbtCompound; use tracing::{debug, trace, warn}; use crate::heightmap::Heightmap; @@ -177,7 +175,7 @@ impl PartialChunkStorage { &mut self, pos: &ChunkPos, data: &mut Cursor<&[u8]>, - heightmaps: &NbtCompound, + heightmaps: &[(HeightmapKind, Box<[u64]>)], chunk_storage: &mut ChunkStorage, ) -> Result<(), BufReadError> { debug!("Replacing chunk at {:?}", pos); @@ -333,7 +331,7 @@ impl Chunk { buf: &mut Cursor<&[u8]>, dimension_height: u32, min_y: i32, - heightmaps_nbt: &NbtCompound, + heightmaps_data: &[(HeightmapKind, Box<[u64]>)], ) -> Result { let section_count = dimension_height / SECTION_HEIGHT; let mut sections = Vec::with_capacity(section_count as usize); @@ -344,18 +342,10 @@ impl Chunk { let sections = sections.into_boxed_slice(); let mut heightmaps = HashMap::new(); - for (name, heightmap) in heightmaps_nbt.iter() { - let Ok(kind) = HeightmapKind::from_str(&name.to_str()) else { - warn!("Unknown heightmap kind: {name}"); - continue; - }; - let Some(data) = heightmap.long_array() else { - warn!("Heightmap {name} is not a long array"); - continue; - }; + for (kind, data) in heightmaps_data { let data: Box<[u64]> = data.iter().map(|x| *x as u64).collect(); - let heightmap = Heightmap::new(kind, dimension_height, min_y, data); - heightmaps.insert(kind, heightmap); + let heightmap = Heightmap::new(*kind, dimension_height, min_y, data); + heightmaps.insert(*kind, heightmap); } Ok(Chunk { @@ -449,7 +439,7 @@ impl AzaleaRead for Section { let block_count = u16::azalea_read(buf)?; // this is commented out because the vanilla server is wrong - // ^ this comment was written ages ago. needs more investigation. + // TODO: ^ this comment was written ages ago. needs more investigation. // assert!( // block_count <= 16 * 16 * 16, // "A section has more blocks than what should be possible. This is a bug!" -- cgit v1.2.3