Curios slots rendering !

This commit is contained in:
2026-10-01 17:57:22 -03:00
parent ea9f3f61bb
commit f2c3cb8135
39 changed files with 1032 additions and 226 deletions
+24 -1
View File
@@ -13,6 +13,7 @@ import {
type TagJson,
type TagRegistry,
} from "./mod_data.ts";
import { PLAYER_PARTS } from "./everything_registry.ts";
import { BUILTIN_MODELS, type ModelJson } from "./block_models.ts";
import { resolve_tags } from "./tags.ts";
import { BIOMES } from "./worldgen/overworld.ts";
@@ -77,6 +78,7 @@ export function check_references(mods: LoadedMod[], engine_textures: Iterable<st
const entity_owners = new Map<string, string[]>();
const entity_jsons = new Map<string, EntityJson>();
const entity_model_owners = new Map<string, string[]>();
const entity_model_jsons = new Map<string, EntityModelJson>();
const tag_owners = new Map<TagRegistry, Set<string>>();
const add = (map: Map<string, string[]>, id: string, mod: string) => map.set(id, [...(map.get(id) ?? []), mod]);
@@ -93,7 +95,10 @@ export function check_references(mods: LoadedMod[], engine_textures: Iterable<st
add(entity_owners, json.id, mod.id);
entity_jsons.set(json.id, json);
}
for (const { json } of mod.entity_models) add(entity_model_owners, json.id, mod.id);
for (const { json } of mod.entity_models) {
add(entity_model_owners, json.id, mod.id);
entity_model_jsons.set(json.id, json);
}
for (const { json } of mod.tags) {
if (!tag_owners.has(json.registry)) tag_owners.set(json.registry, new Set());
tag_owners.get(json.registry)!.add(json.id);
@@ -177,6 +182,24 @@ export function check_references(mods: LoadedMod[], engine_textures: Iterable<st
for (const texture of Object.values(json.data_textures ?? {})) uses(file, texture, "texture");
if (json.places) uses(file, json.places, "block");
if (json.food?.returns) uses(file, json.food.returns, "item");
if (json.worn) {
const { model, texture, slim_model, slim_texture } = json.worn;
for (const id of [model, slim_model]) {
if (id === undefined) continue;
uses(file, id, "entity model");
// nothing of it would move with the player
const bones = entity_model_jsons.get(id)?.bones;
if (bones && !bones.some((bone) => (PLAYER_PARTS as readonly string[]).includes(bone.name))) {
warnings.push(
`${file}: worn model ${id} has no bone named like a player part (${
PLAYER_PARTS.join(", ")
})`,
);
}
}
uses(file, texture, "texture");
if (slim_texture !== undefined) uses(file, slim_texture, "texture");
}
}
for (const { file, json } of mod.recipes) {
switch (json.type) {