Add various generic models
This commit is contained in:
+13
-4
@@ -18,7 +18,7 @@ import {
|
||||
type TagRegistry,
|
||||
} from "./mod_data.ts";
|
||||
import { PLAYER_PARTS } from "./everything_registry.ts";
|
||||
import { BUILTIN_MODELS, type ModelJson } from "./block_models.ts";
|
||||
import { BUILTIN_MODELS, type ModelFileJson, parent_loop } from "./block_models.ts";
|
||||
import { resolve_tags } from "./tags.ts";
|
||||
import type { TextureJson } from "./texture_animation.ts";
|
||||
import { loot_references, type LootTableJson } from "./loot.ts";
|
||||
@@ -49,7 +49,7 @@ export interface LoadedMod {
|
||||
report: ModReport;
|
||||
manifest?: Record<string, unknown>;
|
||||
blocks: { file: string; json: BlockJson }[];
|
||||
models: { file: string; json: ModelJson }[];
|
||||
models: { file: string; json: ModelFileJson }[];
|
||||
items: { file: string; json: ItemJson }[];
|
||||
recipes: { file: string; json: RecipeJson }[];
|
||||
ores: { file: string; json: OreJson }[];
|
||||
@@ -105,6 +105,7 @@ export function check_references(mods: LoadedMod[], engine_textures: Iterable<st
|
||||
const block_owners = new Map<string, string[]>();
|
||||
const item_owners = new Map<string, string[]>();
|
||||
const model_owners = new Map<string, string[]>();
|
||||
const model_parents = new Map<string, string>();
|
||||
const entity_owners = new Map<string, string[]>();
|
||||
const entity_jsons = new Map<string, EntityJson>();
|
||||
const entity_model_owners = new Map<string, string[]>();
|
||||
@@ -136,7 +137,10 @@ export function check_references(mods: LoadedMod[], engine_textures: Iterable<st
|
||||
}
|
||||
// one without a texture is the item of the mod's block, which is already counted
|
||||
for (const { json } of mod.items) if (json.texture !== undefined) add(item_owners, json.id, mod.id);
|
||||
for (const { json } of mod.models) add(model_owners, json.id, mod.id);
|
||||
for (const { json } of mod.models) {
|
||||
add(model_owners, json.id, mod.id);
|
||||
if (json.parent !== undefined) model_parents.set(json.id, json.parent);
|
||||
}
|
||||
for (const { json } of mod.entities) {
|
||||
add(entity_owners, json.id, mod.id);
|
||||
entity_jsons.set(json.id, json);
|
||||
@@ -241,7 +245,12 @@ export function check_references(mods: LoadedMod[], engine_textures: Iterable<st
|
||||
for (const texture of Object.values(json.textures ?? {})) {
|
||||
if (!texture.startsWith("#")) uses(file, texture, "texture");
|
||||
}
|
||||
for (const element of json.elements) {
|
||||
if (json.parent !== undefined) {
|
||||
uses(file, json.parent, "model");
|
||||
const loop = parent_loop(json.id, (id) => model_parents.get(id));
|
||||
if (loop) errors.push(`${file}: model ${json.id}'s parents loop: ${loop.join(" -> ")}`);
|
||||
}
|
||||
for (const element of json.elements ?? []) {
|
||||
for (const face of Object.values(element.faces)) {
|
||||
if (face && !face.texture.startsWith("#")) uses(file, face.texture, "texture");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user