bedrock-development
Version:
APIs for creating and editing files related to Minecraft Bedrock development.
28 lines (27 loc) • 1.02 kB
JavaScript
import { Directories } from "../../file_manager.js";
import { currentFormatVersion } from "../../utils.js";
import { MinecraftDataType } from "../minecraft.js";
export class ClientAnimation extends MinecraftDataType {
static get DirectoryPath() {
return Directories.RESOURCE_PATH + 'animations/';
}
constructor(filepath, template) {
super(filepath, template);
this.format_version = template.format_version;
this.animations = template.animations;
}
static createFilePath(nameData) {
return this.DirectoryPath + nameData.directory + nameData.shortname + ".anim.json";
}
static createFromTemplate(nameData) {
return new ClientAnimation(this.createFilePath(nameData), {
format_version: currentFormatVersion,
animations: {
[`animation.${nameData.namespace}.${nameData.shortname}`]: {
animation_length: 1,
timeline: {}
}
}
});
}
}