bedrock-development
Version:
APIs for creating and editing files related to Minecraft Bedrock development.
30 lines (29 loc) • 1.13 kB
JavaScript
import { Directories } from "../../file_manager.js";
import { currentFormatVersion } from "../../utils.js";
import { MinecraftDataType } from "../minecraft.js";
export class ClientAnimationController extends MinecraftDataType {
static get DirectoryPath() {
return Directories.RESOURCE_PATH + 'animation_controllers/';
}
constructor(filepath, template) {
super(filepath, template);
this.format_version = template.format_version;
this.animation_controllers = template.animation_controllers;
}
static createFromTemplate(nameData) {
return new ClientAnimationController(this.createFilePath(nameData), {
format_version: currentFormatVersion,
animation_controllers: {
[`controller.animation.${nameData.namespace}.${nameData.shortname}`]: {
initial_state: 'default',
states: {
'default': {}
}
}
}
});
}
addAnimationController(key, controller) {
this.animation_controllers[key] = controller;
}
}