summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-03-28 01:14:14 +0200
committernea <nea@nea.moe>2023-03-28 01:14:14 +0200
commit70cc807b73524d55838657095e693aa7b81b59b2 (patch)
treeeb751ed6a735aef4795d86bff9a9671d60f3822d
parentd4e040403ba047c02a7106b97f712d2c565f4389 (diff)
downloadmgasi-master.tar.gz
mgasi-master.tar.bz2
mgasi-master.zip
Send more complex chunksHEADmaster
-rw-r--r--src/world.rs15
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(&section)?;
}