diff options
| author | mat <git@matdoes.dev> | 2025-08-12 10:47:33 +1000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-08-12 07:47:38 +0700 |
| commit | 29c32c9ba89d60b5b0e415eaab58b947080655c5 (patch) | |
| tree | ce7a6291aa83409f86037f264c7053450ce6dd1d /azalea-world/src | |
| parent | 7d9dee7a4dcf7e2b41bee37d2aebaa6ef48a5ba2 (diff) | |
| download | azalea-drasl-29c32c9ba89d60b5b0e415eaab58b947080655c5.tar.xz | |
fix rotations flagging anticheats
Diffstat (limited to 'azalea-world/src')
| -rw-r--r-- | azalea-world/src/heightmap.rs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/azalea-world/src/heightmap.rs b/azalea-world/src/heightmap.rs index dbe7d78f..d3b2b071 100644 --- a/azalea-world/src/heightmap.rs +++ b/azalea-world/src/heightmap.rs @@ -7,6 +7,7 @@ use azalea_block::BlockState; use azalea_buf::AzBuf; use azalea_core::{math, position::ChunkBlockPos}; use azalea_registry::tags::blocks::LEAVES; +use tracing::warn; use crate::{BitStorage, Section, chunk_storage::get_block_state_from_sections}; @@ -62,8 +63,22 @@ impl HeightmapKind { impl Heightmap { pub fn new(kind: HeightmapKind, dimension_height: u32, min_y: i32, data: Box<[u64]>) -> Self { let bits = math::ceil_log2(dimension_height + 1); - let data = BitStorage::new(bits as usize, 16 * 16, Some(data)).unwrap(); - Self { kind, data, min_y } + let mut bit_storage = BitStorage::new(bits as usize, 16 * 16, None) + .expect("data is empty, so this can't fail"); + if bit_storage.data.len() != data.len() { + warn!( + "Ignoring heightmap data, size does not match; expected: {}, got: {}", + bit_storage.data.len(), + data.len() + ); + } else { + bit_storage.data.copy_from_slice(&data); + } + Self { + kind, + data: bit_storage, + min_y, + } } pub fn get_index(x: u8, z: u8) -> usize { |
