diff options
author | nea <nea@nea.moe> | 2023-03-28 01:14:14 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-03-28 01:14:14 +0200 |
commit | 70cc807b73524d55838657095e693aa7b81b59b2 (patch) | |
tree | eb751ed6a735aef4795d86bff9a9671d60f3822d | |
parent | d4e040403ba047c02a7106b97f712d2c565f4389 (diff) | |
download | mgasi-70cc807b73524d55838657095e693aa7b81b59b2.tar.gz mgasi-70cc807b73524d55838657095e693aa7b81b59b2.tar.bz2 mgasi-70cc807b73524d55838657095e693aa7b81b59b2.zip |
-rw-r--r-- | src/world.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/world.rs b/src/world.rs index a1c7e11..a500166 100644 --- a/src/world.rs +++ b/src/world.rs @@ -31,14 +31,23 @@ impl World for DebugWorld { async fn send_chunk(&self, observer: &Player, chunk_x: i32, chunk_z: i32) -> Result<()> { let mut heightmap = BlobArray::new(9); for cx in 0..(16 * 16) { - heightmap.set_entry(cx, 2) + heightmap.set_entry(cx, 17) } let mut chunk_dat_serializer = BytesSerializer::default(); for i in 0..(self.universe.max_world_section - self.universe.min_world_section) { + let mut blocks = BlobArray::new(15); // ceillog2(registrysize) + for x in 0..16 { + for y in 0..16 { + for z in 0..16 { + let idx = (((y * 16) + z) * 16) + x; + blocks.set_entry(idx, if y == 15 { 2 } else { 1 }); + } + } + } let section = ChunkSection { block_count: if i < 4 { 16 * 16 * 16 } else { 0 }, - block_state: PalettedContainer { singular_value: if i < 4 { 1.into() } else { 0.into() } }, - biomes: PalettedContainer { singular_value: 0.into() }, + block_state: PalettedContainer::GlobalPalette(blocks), + biomes: PalettedContainer::SingularValue(0.into()), }; chunk_dat_serializer.serialize_other(§ion)?; } |