Skip blocks that don't exist on schematics

This commit is contained in:
2026-11-21 09:10:43 -03:00
parent c0c182490e
commit f36176a872
6 changed files with 40 additions and 9 deletions
+1 -1
View File
@@ -587,7 +587,7 @@ export interface SchematicApi {
// create's schematic and quill. resolves to where the file is. throws for a box of more than 1048576 blocks (2^20)
export(from: Position, to: Position): Promise<string>;
// adds a schematic for place, by an id in this mod's namespace, while the server phase runs. it's checked here:
// every block, state and entity in it has to be registered
// every state and entity in it has to be registered. blocks that aren't are left out, with a warning
register(id: Id, schematic: Schematic): void;
// a copy of a registered schematic, a file's or one a script registered, with its id, like neoforge's
// StructureTemplateManager.get. undefined for an id nothing registered. for reading what's in it before placing it,
+7 -1
View File
@@ -509,7 +509,13 @@ export function check_references(mods: LoadedMod[], engine_textures: Iterable<st
}
// cubi: entities, like dropped items, are the engine's
for (const { file, json } of mod.schematics) {
for (const { id } of json.palette) uses(file, id, "block");
// the server skips blocks that don't exist, so a schematic still loads without the mod they came from
for (const id of new Set(json.palette.map((entry) => entry.id))) {
check_namespace(file, id);
if (!block_owners.has(id)) {
warnings.push(`${file}: block ${id} doesn't exist, it will be left out`);
}
}
for (const { id } of json.entities) {
check_namespace(file, id);
if (!id.startsWith("cubi:") && !entity_owners.has(id)) {