Implemented Default for ChunkHeightmaps and ChunkBlocks

This commit is contained in:
DaniD3v committed 2024-08-28 12:52:19 +02:00
1 parent 52c34caaa6
commit a8d9c89da2
1 file changed
+19 -9
+19 -9
View File
@@ -70,15 +70,25 @@ struct ChunkNbt {
heightmaps: ChunkHeightmaps, heightmaps: ChunkHeightmaps,
} }
// TODO @DaniD3v implement once Fre is done with heightmaps /// The Heightmap for a completely empty chunk
// impl Default for ChunkBlocks { impl Default for ChunkHeightmaps {
// fn default() -> Self { fn default() -> Self {
// Self { Self {
// blocks: Box::new([BlockId::default(); CHUNK_VOLUME]), // 0 packed into an i64 7 times.
// heightmap: todo!(), motion_blocking: LongArray::new(vec![0; 37]),
// } world_surface: LongArray::new(vec![0; 37]),
// } }
// } }
}
impl Default for ChunkBlocks {
fn default() -> Self {
Self {
blocks: Box::new([BlockId::default(); CHUNK_VOLUME]),
heightmap: ChunkHeightmaps::default(),
}
}
}
impl ChunkBlocks { impl ChunkBlocks {
pub fn empty_with_heightmap(heightmap: ChunkHeightmaps) -> Self { pub fn empty_with_heightmap(heightmap: ChunkHeightmaps) -> Self {