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 -3
View File
@@ -55,9 +55,9 @@ export interface ClientContext {
// a field of the block's client data, what server scripts set with BlockRef.set_client_data, a copy.
// undefined when it isn't set or the chunk isn't loaded
get_client_data<T>(x: number, y: number, z: number, field: string): T | undefined;
// the column's biome and its season, undefined when the chunk isn't loaded
biome_at(x: number, z: number): Id | undefined;
season_at(x: number, z: number): Season | undefined;
// the biome at a block and its season, like the server's. undefined when the chunk isn't loaded
biome_at(x: number, y: number, z: number): Id | undefined;
season_at(x: number, y: number, z: number): Season | undefined;
// the dimension's blocks go from min_y up to max_y - 1
readonly min_y: number;
readonly max_y: number;
+5 -4
View File
@@ -70,7 +70,7 @@ export interface BlockRef {
readonly x: number;
readonly y: number;
readonly z: number;
// the biome of its column and that biome's season, see ServerWorld.biome_at
// the biome at the block and that biome's season, see ServerWorld.biome_at
readonly biome: Id;
readonly season: Season;
// tile data, any json value. saved with the world, never sent to clients
@@ -358,10 +358,11 @@ export interface ServerWorld {
// whether the chunk the column is in was ever generated, so reading its blocks generates nothing. for code that
// reaches far, like a walk along something long, which can stop at the rest: nobody has built anything there
is_loaded(x: number, z: number): boolean;
// the column's biome, like "bworld:plains", and that biome's season. in chunks that aren't loaded it's what
// the biome at a block, like "bworld:plains", and that biome's season, like neoforge's level.getBiome(pos). one per
// block across and every 4 blocks up, see docs/modding/worldgen/biomes.md. in chunks that aren't loaded it's what
// generation makes there, which takes a while the first time
biome_at(x: number, z: number): Id;
season_at(x: number, z: number): Season;
biome_at(x: number, y: number, z: number): Id;
season_at(x: number, y: number, z: number): Season;
// the dimension's blocks go from min_y up to max_y - 1. outside them get_block is air and nothing can be placed
readonly min_y: number;
readonly max_y: number;
+4 -3
View File
@@ -198,9 +198,10 @@ export interface SharedWorld {
// whether the block's side is a full square things can attach to, like minecraft's isFaceSturdy: its collision
// shape covers the whole face. false for air, plants, water and the sides of a slab
is_face_sturdy(x: number, y: number, z: number, face: Face): boolean;
// the column's biome, like "bworld:plains", and that biome's season. undefined when the chunk isn't loaded
biome_at(x: number, z: number): Id | undefined;
season_at(x: number, z: number): Season | undefined;
// the biome at a block, like "bworld:plains", and that biome's season, like neoforge's level.getBiome(pos). one per
// block across and every 4 blocks up, see docs/modding/worldgen/biomes.md. undefined when the chunk isn't loaded
biome_at(x: number, y: number, z: number): Id | undefined;
season_at(x: number, y: number, z: number): Season | undefined;
}
// a block in the world, for rules
+8 -4
View File
@@ -38,7 +38,7 @@ export type FeatureStep =
export interface FeatureOptions {
step?: FeatureStep;
// only runs in chunks with one of these biomes
// only runs in chunks with one of these biomes somewhere, at any height
biomes?: Id | Id[];
}
@@ -66,9 +66,14 @@ export interface FeatureChunk {
// create_noise_2d(new Alea(seed + "_" + name)), cached per seed and name
noise_2d(name: string): (x: number, z: number) => number;
noise_3d(name: string): (x: number, y: number, z: number) => number;
// surface height and biome, inside this chunk only
// the column's surface height, inside this chunk only
height_at(x: number, z: number): number;
biome_at(x: number, z: number): Id;
// the biome at a block, like neoforge's level.getBiome(pos), inside this chunk only. biomes are one per block
// across and one every 4 blocks up, see docs/modding/worldgen/biomes.md. above and below the world it's the one at
// its top or bottom
biome_at(x: number, y: number, z: number): Id;
// sets the biome of the 4 blocks tall cell y is in, inside this chunk only. nothing outside the world's height
set_biome(x: number, y: number, z: number, biome: Id): void;
get_block(x: number, y: number, z: number): Id | undefined; // inside this chunk only
set_block(x: number, y: number, z: number, id: Id): void; // up to one chunk away, like trees
// a data feature's type and config at x, y, z, without its placement. whether it placed anything
@@ -77,5 +82,4 @@ export interface FeatureChunk {
export interface TerrainChunk extends FeatureChunk {
set_height(x: number, z: number, height: number): void;
set_biome(x: number, z: number, biome: Id): void;
}