Waterlogging
This commit is contained in:
@@ -86,6 +86,7 @@ export function check_references(mods: LoadedMod[], engine_textures: Iterable<st
|
||||
const entity_model_jsons = new Map<string, EntityModelJson>();
|
||||
const effect_owners = new Map<string, string[]>();
|
||||
const tag_owners = new Map<TagRegistry, Set<string>>();
|
||||
const liquids = new Set<string>();
|
||||
const add = (map: Map<string, string[]>, id: string, mod: string) => map.set(id, [...(map.get(id) ?? []), mod]);
|
||||
|
||||
const textures = new Set<string>(engine_textures);
|
||||
@@ -94,6 +95,7 @@ export function check_references(mods: LoadedMod[], engine_textures: Iterable<st
|
||||
for (const { json } of mod.blocks) {
|
||||
add(block_owners, json.id, mod.id);
|
||||
if (json.item !== false) add(item_owners, json.id, mod.id);
|
||||
if (json.liquid) liquids.add(json.id);
|
||||
}
|
||||
// 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);
|
||||
@@ -165,6 +167,12 @@ export function check_references(mods: LoadedMod[], engine_textures: Iterable<st
|
||||
}
|
||||
}
|
||||
if (json.drops) uses(file, json.drops, "item");
|
||||
if (json.waterloggable) {
|
||||
uses(file, json.waterloggable, "block");
|
||||
if (block_owners.has(json.waterloggable) && !liquids.has(json.waterloggable)) {
|
||||
errors.push(`${file}: waterloggable ${json.waterloggable} isn't a liquid`);
|
||||
}
|
||||
}
|
||||
for (const id of [...(json.place_on ?? []), ...(json.place_in ?? [])]) {
|
||||
if (id !== "bworld:air") uses(file, id, "block");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user