From 70cc807b73524d55838657095e693aa7b81b59b2 Mon Sep 17 00:00:00 2001 From: nea Date: Tue, 28 Mar 2023 01:14:14 +0200 Subject: Send more complex chunks --- src/world.rs | 15 ++++++++++++--- 1 file 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)?; } -- cgit