Animation clips
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
// validates every mod in mods/: manifests, data files, textures, references between them, and typechecks their scripts
|
||||
import * as z from "zod";
|
||||
import {
|
||||
clips_from_bedrock,
|
||||
data_file,
|
||||
entity_model_from_geo,
|
||||
FORMAT_VERSION,
|
||||
@@ -131,6 +132,7 @@ function load_mod(mods_dir: string, id: string): LoadedMod {
|
||||
spawns: [],
|
||||
entities: [],
|
||||
entity_models: [],
|
||||
animations: [],
|
||||
effects: [],
|
||||
fluids: [],
|
||||
tags: [],
|
||||
@@ -229,6 +231,20 @@ function load_mod(mods_dir: string, id: string): LoadedMod {
|
||||
if (model) mod.entity_models.push({ file: path, json: model });
|
||||
}
|
||||
|
||||
// animations/<name>.animation.json, as blockbench exports them for bedrock. each animation in one is a clip
|
||||
for (const file of walk(`${dir}/animations`, ".animation.json")) {
|
||||
const path = `animations/${file}`;
|
||||
const json = read_json(`${dir}/${path}`, (m) => error(`${path}: ${m}`));
|
||||
if (json === undefined) continue;
|
||||
const { clips, problems, warnings } = clips_from_bedrock(
|
||||
json,
|
||||
`${id}:${file.replace(/\.animation\.json$/, "")}`,
|
||||
);
|
||||
for (const problem of problems) error(`${path}: ${problem}`);
|
||||
for (const warning of warnings) mod.report.warnings.push(`${path}: ${warning}`);
|
||||
for (const clip of clips) mod.animations.push({ file: path, json: clip });
|
||||
}
|
||||
|
||||
// tags/<registry>/<namespace>/<path>.json is the tag <namespace>:<path>, in any namespace: tags are shared
|
||||
for (const file of walk(`${dir}/tags`, ".json")) {
|
||||
const path = `tags/${file}`;
|
||||
|
||||
Reference in New Issue
Block a user