Move trees out of cubi
This commit is contained in:
@@ -34,15 +34,6 @@ const biome_schema = z.object({
|
||||
surface: surface_schema,
|
||||
// minecraft's grass, foliage and water colors, which blocks pick with "tint". plains' when not set
|
||||
colors: z.strictObject({ grass: color.optional(), foliage: color.optional(), water: color.optional() }).optional(),
|
||||
// how likely each tree cell is to have a tree, and which kinds grow, picked evenly (list one twice to make it
|
||||
// twice as likely). wood is the logs and leaves a kind grows here when it isn't its own, like big oaks being dark
|
||||
// oak in the dark forest. the trees feature reads it (bworld's, in its worldgen script), which says what kinds
|
||||
// and woods there are, and checks them when it loads
|
||||
trees: z.object({
|
||||
chance: z.number().min(0).max(1),
|
||||
kinds: z.array(z.string()).min(1),
|
||||
wood: z.record(z.string(), z.string()).optional(),
|
||||
}).optional(),
|
||||
});
|
||||
|
||||
export type BiomeJson = z.infer<typeof biome_schema>;
|
||||
@@ -54,11 +45,10 @@ export interface Biome {
|
||||
surface: Required<SurfaceJson>;
|
||||
// 0xRRGGBB
|
||||
colors: { grass?: number; foliage?: number; water?: number };
|
||||
trees?: { chance: number; kinds: string[]; wood: Record<string, string> };
|
||||
}
|
||||
|
||||
export function biome_from_json(json: BiomeJson): Biome {
|
||||
const { surface, colors = {}, trees } = json;
|
||||
const { surface, colors = {} } = json;
|
||||
const color = (value: string | undefined) => value === undefined ? undefined : parseInt(value.slice(1), 16);
|
||||
return {
|
||||
id: json.id,
|
||||
@@ -72,7 +62,6 @@ export function biome_from_json(json: BiomeJson): Biome {
|
||||
bare_cliffs: surface.bare_cliffs ?? false,
|
||||
},
|
||||
colors: { grass: color(colors.grass), foliage: color(colors.foliage), water: color(colors.water) },
|
||||
trees: trees && { chance: trees.chance, kinds: trees.kinds, wood: trees.wood ?? {} },
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user