World shape for dimension

This commit is contained in:
2026-11-06 22:49:43 -03:00
parent 7458a2d42a
commit 818ce22dd6
60 changed files with 749 additions and 349 deletions
+6
View File
@@ -11,6 +11,7 @@ import { type BlockRegistry, EverythingRegistry } from "./everything_registry.ts
import { default_block_value } from "./utils.ts";
import { generate_raw_chunk, type RawChunk, type WorldgenSetup } from "./generation.ts";
import { load_worldgen } from "./worldgen_loader.ts";
import { WorldShape, type WorldShapeJson } from "./world_shape.ts";
// the parts of a mod's data generation reads. tags only the block ones
export type WorldgenModData = Pick<
@@ -31,6 +32,8 @@ export interface WorldgenBundle {
seed: string;
// the noise settings the world uses
generator: string;
// the dimension's, see WorldShape
shape: WorldShapeJson;
// in load order
mods: { id: string; data: WorldgenModData; worldgen_url?: string; engine_access?: boolean }[];
}
@@ -38,11 +41,13 @@ export interface WorldgenBundle {
export function worldgen_bundle(
seed: string,
generator: string,
shape: WorldShapeJson,
mods: { id: string; data: ModData; worldgen_url?: string; engine_access?: boolean }[],
): WorldgenBundle {
return {
seed,
generator,
shape: { min_y: shape.min_y, max_y: shape.max_y, sky_light: shape.sky_light },
mods: mods.map(({ id, data, worldgen_url, engine_access }) => ({
id,
data: {
@@ -104,6 +109,7 @@ export async function load_bundle(bundle: WorldgenBundle): Promise<LoadedBundle>
),
ores: recipes.ores,
generator: bundle.generator,
shape: new WorldShape(bundle.shape),
});
const { block_ids, default_values } = block_numbering();
return {