More changes, im going to bed
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// a generator: noise settings, and the density functions, noises and biome rules it uses. compiled once for each
|
||||
// seed, see OverworldTerrain. the data comes from mods' worldgen folders, see docs/modding/worldgen/terrain.md
|
||||
// seed, see NoiseTerrain. the data comes from mods' worldgen folders, see docs/modding/worldgen/terrain.md
|
||||
import { EverythingRegistry } from "../everything_registry.ts";
|
||||
import type { BiomeRuleJson, BiomeSourceJson, DensityFunctionJson, NoiseJson, NoiseSettingsJson } from "./data.ts";
|
||||
import type { DensitySources } from "./density.ts";
|
||||
import { OverworldTerrain } from "./terrain.ts";
|
||||
import { NoiseTerrain } from "./terrain.ts";
|
||||
|
||||
// everything worldgen data mods registered, in load order
|
||||
export interface WorldgenData {
|
||||
@@ -21,7 +21,7 @@ export class Generator {
|
||||
// the biome source's rules with every mod's added in, the first that holds picks a column's biome
|
||||
readonly rules: BiomeRuleJson[];
|
||||
readonly sources: DensitySources;
|
||||
#seeds = new Map<string, OverworldTerrain>();
|
||||
#seeds = new Map<string, NoiseTerrain>();
|
||||
|
||||
// throws when the data doesn't add up, like a density function that doesn't exist
|
||||
constructor(id: string, data: WorldgenData) {
|
||||
@@ -36,10 +36,10 @@ export class Generator {
|
||||
this.for_seed("");
|
||||
}
|
||||
|
||||
for_seed(seed: string): OverworldTerrain {
|
||||
for_seed(seed: string): NoiseTerrain {
|
||||
let terrain = this.#seeds.get(seed);
|
||||
if (!terrain) {
|
||||
terrain = new OverworldTerrain(seed, this);
|
||||
terrain = new NoiseTerrain(seed, this);
|
||||
this.#seeds.set(seed, terrain);
|
||||
}
|
||||
return terrain;
|
||||
|
||||
Reference in New Issue
Block a user