Messy but working chicken
This commit is contained in:
+13
-2
@@ -5,12 +5,16 @@ import type { ModelJson } from "./block_models.ts";
|
||||
import { MAX_TEXTURE_SIZE } from "./constants.ts";
|
||||
import {
|
||||
type BlockJson,
|
||||
type EntityJson,
|
||||
type EntityModelJson,
|
||||
ID_PATTERN,
|
||||
type ItemJson,
|
||||
type ManifestJson,
|
||||
type OreJson,
|
||||
type RecipeJson,
|
||||
validate_block,
|
||||
validate_entity,
|
||||
validate_entity_model,
|
||||
validate_item,
|
||||
validate_manifest,
|
||||
validate_model,
|
||||
@@ -49,7 +53,7 @@ export class BmodError extends Error {
|
||||
|
||||
// the zip's layout:
|
||||
// manifest.json the mod's manifest, with "scripts" and "credits" pointing into the zip
|
||||
// data.json every block, model, item, recipe and ore
|
||||
// data.json every block, model, item, recipe, ore, entity and entity model
|
||||
// scripts/<side>.js
|
||||
// textures/<name>.png the texture <mod id>:<name>
|
||||
// credits.md
|
||||
@@ -133,9 +137,16 @@ export function read_bmod(bytes: Uint8Array, file: string): Bmod {
|
||||
items: checked(raw_data.items, "items", validate_item, problems) as ItemJson[],
|
||||
recipes: checked(raw_data.recipes, "recipes", validate_recipe, problems) as RecipeJson[],
|
||||
ores: checked(raw_data.ores, "ores", validate_ore, problems) as OreJson[],
|
||||
entities: checked(raw_data.entities, "entities", validate_entity, problems) as EntityJson[],
|
||||
entity_models: checked(
|
||||
raw_data.entity_models,
|
||||
"entity_models",
|
||||
validate_entity_model,
|
||||
problems,
|
||||
) as EntityModelJson[],
|
||||
};
|
||||
// a mod only registers ids in its own namespace
|
||||
for (const { id } of [...data.blocks, ...data.models, ...data.items]) {
|
||||
for (const { id } of [...data.blocks, ...data.models, ...data.items, ...data.entities, ...data.entity_models]) {
|
||||
if (typeof id === "string" && id.split(":")[0] !== mod) problems.push(`${id} isn't in this mod's namespace`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user