UNPKG

@minecraft/creator-tools

Version:

Minecraft Creator Tools command line and libraries.

134 lines (133 loc) 6.28 kB
import IEntityTypeBehaviorPack from "./IEntityTypeBehaviorPack"; import IFile from "../storage/IFile"; import IManagedComponentSetItem from "./IManagedComponentSetItem"; import IComponent from "./IComponent"; import { IEventHandler } from "ste-events"; import ManagedComponentGroup from "./ManagedComponentGroup"; import IManagedComponent from "./IManagedComponent"; import { ManagedComponent } from "./ManagedComponent"; import IEventAction from "./IEventAction"; import IEventActionSet from "./IEventActionSet"; import Project from "../app/Project"; import ProjectItem from "../app/ProjectItem"; import RelationsIndex from "../app/RelationsIndex"; import IDefinition from "./IDefinition"; import IEventWrapper from "./IEventWrapper"; import IComponentGroup from "./IComponentGroup"; export declare enum EntityTypeComponentCategory { attribute = 0, complex = 1, behavior = 2, trigger = 3 } export declare enum EntityTypeComponentExtendedCategory { attribute = 0, complex = 1, movementComplex = 2, combatAndHealthComplex = 3, sensorComponents = 4, trigger = 5, behavior = 6, movementBehavior = 7, mobSpecificBehavior = 8 } export declare const AttributeComponents: { [id: string]: string; }; export declare enum EntityPropertyType { enum = 0, boolean = 1, float = 2, int = 3 } export default class EntityTypeDefinition implements IManagedComponentSetItem, IDefinition { private _wrapper?; private _file?; private _id?; private _isLoaded; private _loadedWithComments; /** Set during persist() so the resulting onFileContentUpdated event doesn't wipe our already-current in-memory state. */ private _isSelfPersisting; private _managedComponents; _data?: IEntityTypeBehaviorPack; _componentGroups: { [name: string]: ManagedComponentGroup; }; _events: { [name: string]: IEventAction | IEventActionSet; }; private _onLoaded; private _onComponentAdded; private _onComponentRemoved; private _onComponentChanged; get data(): IEntityTypeBehaviorPack; get componentGroups(): { [name: string]: ManagedComponentGroup; }; static getFormIdFromComponentId(componentId: string): string; static getComponentCategory(id: string): EntityTypeComponentCategory; static getExtendedComponentCategory(id: string): EntityTypeComponentExtendedCategory; get formatVersion(): string; static getComponentFromBaseFileName(name: string): string; static getComponentCategoryDescription(category: EntityTypeComponentCategory): "Behavior" | "Attribute" | "Trigger" | "Component"; static getPluralComponentCategoryDescription(category: EntityTypeComponentCategory): "Attributes" | "Behaviors (AI)" | "Triggers" | "Components"; get onComponentAdded(): import("ste-events").IEvent<EntityTypeDefinition, IManagedComponent>; get onComponentRemoved(): import("ste-events").IEvent<EntityTypeDefinition, string>; get onComponentChanged(): import("ste-events").IEvent<EntityTypeDefinition, IManagedComponent>; get isLoaded(): boolean; get behaviorPackFile(): IFile | undefined; get onLoaded(): import("ste-events").IEvent<EntityTypeDefinition, EntityTypeDefinition>; set behaviorPackFile(newFile: IFile | undefined); _handleFileUpdated(file: IFile, fileB: IFile): void; get id(): string; set id(newId: string); get runtimeIdentifier(): string | undefined; set runtimeIdentifier(newId: string | undefined); get aliases(): { [aliasName: string]: object; }; get properties(): { [propertyName: string]: import("./IEntityTypeDescription").IEntityTypeDescriptionProperty; }; constructor(); getFormatVersionIsCurrent(): Promise<boolean>; getFormatVersionAsNumberArray(): number[] | undefined; removeProperty(propertyName: string): void; get shortId(): string; getComponent(id: string): IManagedComponent; getComponentsInBaseAndGroups(id: string): IManagedComponent[]; getCoreAndComponentGroupList(): IManagedComponentSetItem[]; getAllComponents(): IManagedComponent[]; get behaviorPackFormatVersion(): string; setBehaviorPackFormatVersion(versionStr: string): void; notifyComponentUpdated(id: string): void; getComponents(): IManagedComponent[]; getComponentGroupsComponentUsedIn(componentName: string): ManagedComponentGroup[]; getComponentGroup(componentGroupName: string): ManagedComponentGroup | undefined; getComponentGroups(): ManagedComponentGroup[]; getEvent(eventName: string): IEventActionSet | IEventAction | undefined; getEffectiveComponents(componentGroupAddRemoveList: string[]): ManagedComponentGroup; getEvents(): IEventWrapper[]; addComponent(id: string, componentOrData: ManagedComponent | IComponent | string | string[] | boolean | number[] | number | undefined): ManagedComponent; addComponentGroup(id?: string, componentOrData?: ManagedComponentGroup | IComponentGroup | undefined): ManagedComponentGroup; removeComponent(id: string): void; _ensureBehaviorPackDataInitialized(): void; getProperties(): { [propertyName: string]: import("./IEntityTypeDescription").IEntityTypeDescriptionProperty; }; getPropertyList(): any[]; static getPropertyTypeString(stateType: EntityPropertyType): "enum" | "bool" | "int" | "float"; addProperty(propertyName: string, propertyType: EntityPropertyType): void; addEvent(eventName?: string): void; addChildItems(project: Project, item: ProjectItem, index?: RelationsIndex): Promise<void>; static ensureOnFile(behaviorPackFile: IFile, loadHandler?: IEventHandler<EntityTypeDefinition, EntityTypeDefinition>, preserveComments?: boolean): Promise<EntityTypeDefinition>; getScript(isTypeScript: boolean): string; persist(): boolean; /** * Loads the entity type definition from the file. * @param preserveComments If true, uses comment-preserving JSON parsing for edit/save cycles. * If false (default), uses efficient standard JSON parsing. * Can be called again with true to "upgrade" a read-only load to read/write. */ load(preserveComments?: boolean): Promise<void>; }