3D biomes

This commit is contained in:
2026-11-07 12:13:43 -03:00
parent b726ce9695
commit 22191d260c
53 changed files with 874 additions and 316 deletions
+3 -4
View File
@@ -5,7 +5,7 @@
// player, and which chunks are in a player's view. see "Chunk Streaming" in docs/modding_plan.md
import { deflateSync, inflateSync } from "fflate";
import { Reader, Writer } from "./bytes.ts";
import { type ChunkColumn, read_column, type Section, write_column } from "./section.ts";
import { type ChunkColumn, type ColumnBiomes, read_column, type Section, write_column } from "./section.ts";
// the view distances clients can ask for, in chunks, like minecraft's
export const MIN_VIEW_DISTANCE = 2;
@@ -38,8 +38,7 @@ export interface LevelChunk {
// block values (numeric id | state bits << 16) in the receiver's numbering, see decode_level_chunk. from the bottom
// of the world up, the dimension's whole height
sections: Section[];
// each column's biome, x then z
biomes: string[];
biomes: ColumnBiomes;
}
// a level_chunk message, like minecraft's ClientboundLevelChunkWithLightPacket without the light (clients light
@@ -47,7 +46,7 @@ export interface LevelChunk {
//
// u8 LEVEL_CHUNK
// i32 chunk x, i32 chunk z
// the rest deflated: the biomes and the sections' block values, see write_column in common/section.ts
// the rest deflated: the sections' block values and biomes, see write_column in common/section.ts
export function encode_level_chunk(chunk: ChunkColumn): Uint8Array<ArrayBuffer> {
const writer = new Writer();
write_column(writer, chunk.sections, chunk.biomes);