@minecraft/creator-tools
Version:
Minecraft Creator Tools command line and libraries.
78 lines (77 loc) • 4.24 kB
TypeScript
import IFile from "../storage/IFile";
import { IEventHandler } from "ste-events";
import IBlockbenchModel, { IBlockbenchAnimationAnimator, IBlockbenchElement, IBlockbenchFace, IBlockbenchOutlineItem, IBlockbenchOutlineOrGroupItem } from "./IBlockbenchModel";
import ProjectItem from "../app/ProjectItem";
import ModelGeometryDefinition from "../minecraft/ModelGeometryDefinition";
import EntityTypeResourceDefinition from "../minecraft/EntityTypeResourceDefinition";
import { IGeometry, IGeometryBone, IGeometryBoneCube } from "../minecraft/IModelGeometry";
import Project from "../app/Project";
import AnimationResourceDefinition from "../minecraft/AnimationResourceDefinition";
export default class BlockbenchModel {
private _file?;
private _id?;
private _isLoaded;
private _data?;
private _onLoaded;
get data(): IBlockbenchModel | undefined;
set data(content: IBlockbenchModel | undefined);
get isLoaded(): boolean;
get file(): IFile | undefined;
set file(newFile: IFile | undefined);
get onLoaded(): import("ste-events").IEvent<BlockbenchModel, BlockbenchModel>;
get name(): string;
get id(): string | undefined;
set id(newId: string | undefined);
static ensureFromContent(content: string): BlockbenchModel;
getMinecraftUVFace(face: IBlockbenchFace): {
uv: number[];
uv_size: number[];
};
updateMinecraftAnimationsFromBlockbench(animationDef: AnimationResourceDefinition, etrd?: EntityTypeResourceDefinition): Promise<void>;
updateGeometryFromModel(geo: IGeometry, formatVersion: number[]): Promise<void>;
static isLessThan110(formatVersion: number[]): boolean;
processOutlineItemsIntoBonesByName(outlineItems: (string | IBlockbenchOutlineItem)[], groupsByUuid: {
[name: string]: IBlockbenchOutlineOrGroupItem;
}, bonesByName: {
[name: string]: IGeometryBone;
}, cubesById: {
[name: string]: IGeometryBoneCube;
}, locatorsById: {
[name: string]: IBlockbenchElement;
}, formatVersion: number[], parent?: IGeometryBone, context?: {
addIndex: number;
}): void;
integrateIntoProject(project: Project): Promise<void>;
static ensureOnFile(file: IFile, loadHandler?: IEventHandler<BlockbenchModel, BlockbenchModel>): Promise<BlockbenchModel>;
persist(): Promise<boolean>;
save(): Promise<void>;
load(): Promise<void>;
static createEmptyModel(name: string, identifier: string): IBlockbenchModel;
/**
* Exports Minecraft animations to Blockbench format
* @param animationDef The Minecraft animation resource definition to export from
* @param bbmodel The Blockbench model to export animations to
*/
static exportAnimationsToBlockbench(animationDef: AnimationResourceDefinition, bbmodel: IBlockbenchModel): Promise<void>;
/**
* Converts Minecraft keyframe data to Blockbench keyframe format
* @param keyframeData The Minecraft keyframe data (can be static values or time-based keyframes)
* @param channel The animation channel (rotation, position, scale)
* @param animator The Blockbench animator to add keyframes to
*/
static convertKeyframesToBlockbench(keyframeData: any, // Using any to handle the complex union types from Minecraft
channel: string, animator: IBlockbenchAnimationAnimator): void;
static exportModel(modelProjectItem: ProjectItem, modelIndex?: number): Promise<IBlockbenchModel | undefined>;
/**
* Creates a Blockbench model (.bbmodel) directly from a ModelGeometryDefinition,
* without needing a full ProjectItem or project relations.
* Useful for the ModelViewer "Open in Blockbench" action.
*/
static exportFromDefinition(modelDef: ModelGeometryDefinition, modelIndex?: number): IBlockbenchModel | undefined;
static getUpBoxUvCoordinates(cube: IGeometryBoneCube): number[];
static getDownBoxUvCoordinates(cube: IGeometryBoneCube): number[];
static getEastBoxUvCoordinates(cube: IGeometryBoneCube): number[];
static getNorthBoxUvCoordinates(cube: IGeometryBoneCube): number[];
static getWestBoxUvCoordinates(cube: IGeometryBoneCube): number[];
static getSouthBoxUvCoordinates(cube: IGeometryBoneCube): number[];
}