UNPKG

@minecraft/creator-tools

Version:

Minecraft Creator Tools command line and libraries.

109 lines (108 loc) 6.51 kB
import Project from "./Project"; import { ProjectItemType } from "./IProjectItemData"; import ISnippet from "./ISnippet"; import IGalleryItem from "./IGalleryItem"; import IFolder from "../storage/IFolder"; import { PackType } from "../minecraft/Pack"; import { IAnnotatedValue } from "../core/AnnotatedValue"; import ProjectItem from "./ProjectItem"; export declare enum NewEntityTypeAddMode { baseId = 0 } export declare enum NewItemTypeAddMode { baseId = 0 } export declare enum ProjectMetaCategory { mix = 0, worldTemplate = 1, texturePack = 2, addOn = 3, skinPack = 4, persona = 5 } export default class ProjectUtilities { static ensureContentInDefaultScriptFile(project: Project, signatureToken: string, content: string, placeAtBottom?: boolean): Promise<void>; static getDefaultFolderForPack(project: Project, packType: PackType): Promise<IFolder>; static getSimplifiedProjectName(projectName: string): string; static getPackTypeName(packType: PackType): "Unknown" | "Resource" | "Behavior" | "Skin"; static ensureJsonItem(project: Project, jsonContent: string, fileName: string): Promise<ProjectItem>; static getItemsFromSearch(project: Project, searchResults: IAnnotatedValue[] | undefined): ProjectItem[]; static isBehaviorPackRelated(folderName: string): boolean; static isResourcePackRelated(folderName: string): boolean; static inferJsonProjectItemTypeFromExtension(path: string): ProjectItemType; static inferJsonProjectItemTypeFromPath(path: string): ProjectItemType; /** * Attempts to infer a project item type using the top-level keys present in a JSON object. * Falls back to unknown when no meaningful match is found. */ static inferJsonProjectItemTypeFromContent(json: any): ProjectItemType; static getItemFromAnnotatedValue(project: Project, value: IAnnotatedValue): ProjectItem; static isVibrantVisualsCompatible(project: Project): Promise<boolean>; static isVibrantVisualsEnhanced(project: Project): boolean; static ensureDefaultItems(project: Project): Promise<void>; static hasEntities(project: Project): boolean; static hasBlocks(project: Project): boolean; static hasItems(project: Project): boolean; static hasDocumentationMetadata(folder: IFolder, depth?: number): Promise<boolean>; static prepareProjectForDocumentation(project: Project): Promise<void>; static getBaseBehaviorPackPath(project: Project): Promise<string>; static getBaseResourcePackPath(project: Project): Promise<string>; static applyScriptEntryPoint(project: Project, newScriptEntryPoint: string): Promise<void>; static applyDescription(project: Project, newDescription: string): Promise<void>; static applyCreator(project: Project, newCreator: string): Promise<void>; static applyShortName(project: Project, newShortName: string): Promise<void>; static ensureGeneratedWith(project: Project, isToolWeb?: boolean): Promise<void>; static applyTitle(project: Project, newTitle: string): Promise<void>; static applyBehaviorPackUniqueId(project: Project, newBehaviorPackId: string): Promise<void>; static applyResourcePackUniqueId(project: Project, newResourcePackId: string): Promise<void>; static getSuggestedProjectShortName(creator: string, name: string): string; static getSuggestedShortName(caption: string): string; static getSuggestedProjectName(project: IGalleryItem): string; static getSuggestedProjectNameFromElements(id?: string, gitHubFolder?: string, gitHubRepoName?: string): string; static getBaseScriptsPath(project: Project): Promise<string>; static renameDefaultFolders(project: Project, newTokenName: string): Promise<void>; /** * Attempts to rename a pack folder. If the rename fails (e.g., OneDrive file locks), * falls back to copying contents to a new folder and deleting the original. */ private static _renameOrCopyFolder; static processNewProject(project: Project, title: string, description: string, suggestedShortName?: string, isWeb?: boolean): Promise<void>; /** * Detects the auto-derived "my" + galleryId pattern (e.g. "myaddonStarter") * produced by `getSuggestedProjectNameFromElements` when the addonStarter * special case is bypassed, and substitutes a human-readable title. * * Currently only normalises the addon starter family — extend with additional * checks if more gallery templates start leaking technical ids into manifests. */ static makeFriendlyProjectTitle(title: string): string; static setNewModuleId(project: Project, newModuleId: string, oldModuleId: string): Promise<void>; static getDefaultBehaviorPackFolder(project: Project, paths: string[]): Promise<IFolder>; static getIsAddon(project: Project): Promise<boolean>; static getMetaCategory(project: Project): Promise<ProjectMetaCategory>; static getMetaCategoryDescription(category: ProjectMetaCategory): "Persona" | "Add-On" | "World Template" | "Texture Pack" | "Skin Pack" | "Mix"; static setIsAddon(project: Project): Promise<void>; static randomizeAllUids(project: Project): Promise<void>; static sanitizeProjectName(name: string): string; static CodeReplaceTokens: string[]; static ImportTypes: { vanilla: string[]; math: string[]; mcui: string[]; mc: string[]; mced: string[]; }; static getTopicUrl(topic: string): string; static adaptFullSample(content: string): string; static adaptSample(sampleContent: string, fileContent: string): string; static modifyImports(fileContent: string): string; static ensureImportLines(introSection: string, restOfContent: string, moduleName: string, importCollection: string[]): string; static ensureTypeScriptFileWith(project: Project, token: string, templateSet: string, templateName: string, fileNameCore: string, replacers: { [sourceString: string]: string; }): Promise<void>; static injectSnippet(project: Project, snippet: ISnippet, fullScriptBoxReplace: boolean): Promise<void>; static addBlockType(project: Project, blockTypeId?: string, blockTypeName?: string): Promise<void>; static canonicalizeStoragePath(path: string | null | undefined): string; static canonicalizeNamespace(path: string | null | undefined): string; static getFileName(project: Project, basePath: string, baseName: string, extension: string, includeBase: boolean): Promise<string>; }