@minecraft/creator-tools
Version:
Minecraft Creator Tools command line and libraries.
171 lines (170 loc) • 12.6 kB
TypeScript
import IProjectItemData, { ProjectItemCreationType, ProjectItemEditPreference, ProjectItemErrorStatus, ProjectItemStorageType } from "./IProjectItemData";
import { ProjectItemType } from "./IProjectItemData";
import Project from "./Project";
import IFile from "../storage/IFile";
import IFolder from "../storage/IFolder";
import IGitHubInfo from "./IGitHubInfo";
import { ProjectEditPreference } from "./IProjectData";
import MCWorld from "../minecraft/MCWorld";
import { IFileUpdateEvent } from "../storage/IStorage";
import Pack from "../minecraft/Pack";
import ProjectItemRelationship from "./IProjectItemRelationship";
import IProjectItemUnfulfilledRelationship from "./IProjectItemUnfulfilledRelationship";
import ProjectItemVariant from "./ProjectItemVariant";
export interface IProjectItemContentUpdateEvent {
item: ProjectItem;
fileUpdate: IFileUpdateEvent;
}
export default class ProjectItem {
private _data;
private _project;
private _onPropertyChanged;
private _onFileRetrieved;
private _onFolderRetrieved;
private _onLoaded;
private _defaultFile;
private _defaultFolder;
private _pendingLoadRequests;
private _isLoading;
private _isFileContentProcessed;
private _imageUrlBase64Cache;
private _pack;
private _primaryFile?;
private _accessoryFolder;
parentItems: ProjectItemRelationship[] | undefined;
childItems: ProjectItemRelationship[] | undefined;
unfulfilledRelationships: IProjectItemUnfulfilledRelationship[] | undefined;
private _variants;
constructor(parent: Project, incomingData?: IProjectItemData);
get parentItemCount(): number;
get childItemCount(): number;
get unfulfilledRelationshipsCount(): number;
get isInWorld(): boolean | undefined;
set isInWorld(isInWorld: boolean | undefined);
get project(): Project;
get onPropertyChanged(): import("ste-events").IEvent<ProjectItem, string>;
get onLoaded(): import("ste-events").IEvent<ProjectItem, ProjectItem>;
get onFileRetrieved(): import("ste-events").IEvent<ProjectItem, IFile>;
get onFolderRetrieved(): import("ste-events").IEvent<ProjectItem, IFolder>;
get gitHubReference(): IGitHubInfo | undefined;
get isInFileContainer(): boolean;
get isFileContainerStorageItem(): boolean;
hasCustomVariants(): boolean;
hasVersionSliceCustomVariants(): boolean;
private _shouldEnsureDefaultVariant;
getVariant(variantName: string): ProjectItemVariant;
get isWorld(): boolean;
static getGitHubSignature(info: IGitHubInfo): string;
get defaultVariant(): ProjectItemVariant;
ensureAccessoryFolder(): Promise<IFolder>;
ensureDefaultVariant(): ProjectItemVariant;
getVariantList(): any[];
_getVariantList(): any[];
getVariantListMostImportantLast(): any[];
getVariantListMostImportantFirst(): any[];
hasNonDefaultVariant(): boolean;
ensureVariant(label: string): ProjectItemVariant;
getFile(variantName?: string): IFile;
getFolder(variantName?: string): IFolder;
getPack(): Promise<Pack>;
addUnfulfilledRelationship(path: string, itemType: ProjectItemType, isVanillaDependent?: boolean): void;
ensureDependencies(): Promise<void>;
addChildItem(childItem: ProjectItem): void;
addParentItem(parentItem: ProjectItem): void;
toString(): string;
getPackRelativePath(): Promise<string>;
static gitHubReferencesEqual(refA: IGitHubInfo | undefined, refB: IGitHubInfo | undefined): boolean;
set gitHubReference(value: IGitHubInfo | undefined);
get title(): string;
get typeTitle(): "Unknown" | "Skins Catalog" | "Persona" | "SDL Layout" | "Renderer" | "Splashes" | "Loading Messages" | "Font Metadata" | "Emoticons" | "JavaScript" | "Built JavaScript" | "TypeScript" | "General json file" | "Design pack manifest" | "Behavior pack manifest" | "Resource pack manifest" | "Test JavaScript file" | "Entity type JavaScript" | "Entity type TypeScript" | "Entity type" | "Minecraft template" | "Minecraft world" | "Minecraft project" | "Minecraft addon" | "Minecraft pack" | "Minecraft zip" | "Structure" | "Function" | "Tick" | "Material" | "Material Set" | "Geometry" | "Fragment" | "Vertex" | "Shadow" | "Water" | "Jigsaw Processor List" | "Jigsaw Structure" | "Jigsaw Template Pool" | "Contents Catalog" | "Jigsaw Structure Set" | "PBR" | "Atmospherics" | "Point Light" | "Color Grading" | "Camera" | "Aim Assist Preset" | "Aim Assist Category" | "Behavior Tree" | "Spawn Group" | "Catalog index" | "Persona pack" | "Design pack" | "Behavior pack folder" | "Resource pack folder" | "Skin pack" | "Action Set" | "World test" | "World behavior pack list" | "World resource pack list" | "Behavior pack animation" | "Behavior pack animation controller" | "Block type" | "Item type" | "Loot table" | "Biome resources" | "File list" | "Crafting Item catalog" | "Block resource catalog" | "Sound catalog" | "Animation" | "Animation controller" | "Entity type visuals/audio" | "Fog" | "Model" | "Particle" | "Render controller" | "Block culling" | "User interface" | "Language catalog" | "Biome" | "Biome Resources" | "Entity dialogue" | "World feature rule" | "Feature" | "Function event" | "Recipe" | "Spawn rule" | "Trading" | "Volume" | "Attachable" | "Item type resources" | "Materials" | "Music catalog" | "Audio" | "Content Description" | "Content Report" | "TypeScript config" | "Prettier JavaScript/JSON style config" | "JavaScript config" | "DocFX definition" | "JSDoc definition" | "NPM package definition" | "NPM package lock definition" | "Environment File" | "Legacy Level Data" | "Level Data" | "JavaScript Map" | "ESLint config" | "Just config" | "Doc info json" | "Nine-slice scaling config" | "Script types definition" | "Vanilla data definition" | "Engine ordering definition" | "Command definition" | "Skin pack manifest" | "Persona manifest" | "Block type base JavaScript" | "Block type base TypeScript" | "Image" | "Texture" | "UI texture" | "Design texture" | "Icon" | "Marketing image" | "Store image" | "VS Code launch file" | "VS Code tasks" | "VS Code settings" | "VS Code extensions" | "Language translations" | "World template manifest" | "Texture set" | "Texture list" | "Lighting" | "Flipbook texture set" | "Item texture" | "Terrain texture" | "UI global variables" | "Form" | "Dimension" | "MCTools preferences" | "Behavior pack history" | "Resource pack history" | "Education manifest" | "Voxel shape";
getPackFolderName(): string;
get folderPath(): string;
getFolderGroupingPath(): string;
getCommunitySchemaPath(): "general/manifest.json" | "general/world_x_packs.json" | "behavior/animation_controllers/animation_controller.json" | "behavior/animations/animations.json" | "behavior/blocks/blocks.json" | "behavior/items/items.json" | "behavior/loot_tables/loot_tables.json" | "behavior/dialogue/dialogue.json" | "behavior/entities/entities.json" | "resource/atmospherics/atmospherics.json" | "resource/blocks.json" | "resource/sounds.json" | "resource/animations/actor_animation.json" | "resource/animation_controllers/animation_controller.json" | "resource/entity/entity.json" | "resource/fog/fog.json" | "resource/models/entity/model_entity.json" | "resource/biomes_client.json" | "resource/particles/particles.json" | "resource/render_controllers/render_controllers.json" | "resource/block_culling/block_culling.json" | "behavior/item_catalog/crafting_item_catalog.json" | "language/languages.json" | "behavior/features/features.json" | "behavior/feature_rules/feature_rules.json" | "behavior/functions/tick.json" | "behavior/recipes/recipes.json" | "behavior/spawn_rules/spawn_rules.json" | "behavior/trading/trading.json" | "resource/attachables/attachables.json" | "resource/items/items.json" | "resource/materials/materials.json" | "resource/sounds/music_definitions.json" | "resource/sounds/sound_definitions.json" | "resource/ui/ui.json" | "resource/textures/flipbook_textures.json" | "resource/textures/item_texture.json" | "resource/textures/terrain_texture.json" | "resource/ui/_global_variables.json";
getOfficialSchemaPath(): string;
getFormPath(): "entity/entity_behavior_document" | "biome/biome_json_file" | "block_culling/blockculling" | "biomes_client/biomes_client" | "client_deferred_rendering/atmosphericscattering_atmosphericscatteringconfigsettings" | "client_deferred_rendering/colorgraderconfig_colorgradingparameterssrc" | "client_deferred_rendering/lightinggroup_lightingimpl_1_21_70" | "client_deferred_rendering/pbrfallbackconfig_pbrfallbackconfigsettings" | "client_deferred_rendering/pointlightconfig_pointlightconfigsettings" | "client_deferred_rendering/shadowstylizationconfig_shadowstylizationconfigsettings" | "client_deferred_rendering/waterconfig_waterconfigsettingsv1" | "client_item/resource" | "feature/feature_rule_definition" | "features/features" | "fogs/fogs" | "jigsaw/minecraft_jigsaw_structure_metadata" | "spawn/spawn_rules_document" | "visual/geometry.v1.21.0" | "visual/texture_set.v1.21.30" | "voxel_shapes/voxel_shape_document" | "visual/geometry.v1.8.0";
get errorStatus(): ProjectItemErrorStatus | undefined;
set errorStatus(newErrorStatus: ProjectItemErrorStatus | undefined);
get source(): string | undefined;
set source(newSource: string | undefined);
get errorMessage(): string | undefined;
set errorMessage(newErrorMessage: string | undefined);
get projectPath(): string | undefined | null;
set projectPath(newBasePath: string | undefined | null);
get effectiveEditPreference(): ProjectEditPreference.summarized | ProjectEditPreference.editors | ProjectEditPreference.raw;
get editPreference(): ProjectItemEditPreference;
set editPreference(newEditPreference: ProjectItemEditPreference);
get storageType(): ProjectItemStorageType;
set storageType(newStorageType: ProjectItemStorageType);
get creationType(): ProjectItemCreationType | undefined;
set creationType(newCreationType: ProjectItemCreationType | undefined);
get itemType(): ProjectItemType;
get defaultFile(): IFile;
/**
* Get the cached thumbnail data URL for this item.
* Returns undefined if no thumbnail has been generated.
*/
get cachedThumbnail(): string | undefined;
/**
* Set the cached thumbnail for this item.
* Also updates the thumbnailGeneratedAt timestamp and clears the imageUrl cache.
*/
set cachedThumbnail(value: string | undefined);
/**
* Get the timestamp when the thumbnail was last generated.
*/
get thumbnailGeneratedAt(): number | undefined;
/**
* Get the thumbnail link - path to another item whose thumbnail should be used.
*/
get thumbnailLink(): string | undefined;
/**
* Set the thumbnail link - path to another item whose thumbnail should be used.
*/
set thumbnailLink(value: string | undefined);
/**
* Check if this item type supports thumbnail generation.
*/
get supportsThumbnail(): boolean;
/**
* Clear the cached thumbnail and imageUrl cache.
* Call this when the file content changes.
*/
clearThumbnailCache(): void;
sortVariantsMostImportantLast(a: string, b: string): number;
sortVariantsMostImportantFirst(a: string, b: string): number;
get primaryVariantLabel(): string | undefined;
get primaryFile(): IFile | null;
get defaultFolder(): IFolder;
set itemType(newItemType: ProjectItemType);
get isContentLoaded(): boolean;
get tags(): string[];
setFile(file: IFile): Promise<void>;
get needsSave(): boolean;
updateProjectPath(): void;
rename(newFileBaseName: string): Promise<void>;
deleteItem(): Promise<void>;
get imageUrl(): string;
get name(): string;
loadFolder(): Promise<IFolder>;
_handleMCWorldLoaded(world: MCWorld, worldA: MCWorld): void;
_fireLoadedEvent(): void;
invalidateContentProcessedState(): void;
getManager(): Promise<any>;
ensureStorage(): Promise<void>;
get isStorageEnsured(): boolean;
loadContentDirect(): Promise<void>;
ensureFileStorage(): Promise<IFile>;
loadFileContent(): Promise<IFile>;
loadFileStorage(): Promise<void>;
getJsonObject(): Promise<object | undefined>;
getStringContent(): Promise<string | undefined>;
getContentAsJson(): Promise<any | null>;
loadContent(): Promise<boolean>;
prepareToSave(): Promise<void>;
getJavaScriptLibTwin(): IFile;
getFunctionTwin(): IFile;
saveContent(): Promise<void>;
hasTag(name: string): boolean;
ensureTag(name: string): void;
}