Remove duplicate code

This commit is contained in:
2026-10-13 11:57:43 -03:00
parent dfc6a6d77b
commit 5165698fe3
50 changed files with 307 additions and 812 deletions
+1 -5
View File
@@ -4,7 +4,7 @@
// world generation as data: noises, density functions, noise settings (a generator) and biome sources, see
// docs/modding/worldgen/terrain.md. checked here, compiled by density.ts and generator.ts. the names follow
// minecraft's (density functions, the noise router, surface rules) where the idea is the same
import { ID_PATTERN, TAG_ID_PATTERN } from "../mod_data.ts";
import { ID_PATTERN, is_object, TAG_ID_PATTERN } from "../mod_data.ts";
// ids of worldgen data can have folders, like "bworld:overworld/erosion"
export const WORLDGEN_ID_PATTERN = TAG_ID_PATTERN;
@@ -540,7 +540,3 @@ function block_id(value: unknown, field: string, refs: WorldgenRefs, problems: s
if (typeof value === "string" && ID_PATTERN.test(value)) refs.blocks.add(value);
else problems.push(`${field} must be a block's id`);
}
function is_object(value: unknown): value is Record<string, unknown> {
return typeof value === "object" && value !== null && !Array.isArray(value);
}