World sections
This commit is contained in:
@@ -143,6 +143,12 @@ Deno.test("a dimension's blocks go from its min_y to max_y - 1, and are sent and
|
||||
assertEquals(chunk.blocks[8], world.get_block_value(GROUND_X, -64, 0));
|
||||
assertEquals(chunk.blocks[383 * CHUNK_AREA + 8], world.get_block_value(GROUND_X, 319, 0));
|
||||
|
||||
// a column of ground: glass up to 69 and air above, all one block in every section but the one with the ground's
|
||||
// top in it
|
||||
const generated = world.generated_blocks(2, 0);
|
||||
assertEquals(generated.sections.map((section) => section.blocks !== null).indexOf(true), (64 + 64) / 16);
|
||||
assertEquals(generated.sections.filter((section) => section.blocks !== null).length, 1);
|
||||
|
||||
const loaded = await test_game(dir, game.save());
|
||||
Deno.removeSync(dir, { recursive: true });
|
||||
for (const y of [-64, 319]) assertEquals(loaded.game.world.get_block_id(GROUND_X, y, 0), "bworld:stone");
|
||||
|
||||
Reference in New Issue
Block a user