@minecraft/creator-tools
Version:
Minecraft Creator Tools command line and libraries.
107 lines (106 loc) • 12.7 kB
TypeScript
import IColor from "../core/IColor";
import { PackType } from "../minecraft/Pack";
import { ProjectItemCategory, ProjectItemType } from "./IProjectItemData";
import IProjectItemRelationship from "./IProjectItemRelationship";
import Project from "./Project";
import ProjectItem from "./ProjectItem";
import { ProjectItemTypeGroup } from "./ProjectItemTypeInfo";
export declare const ProjectItemSortOrder: ProjectItemType[];
export declare const FormMappings: {
[typeIdAsString: string]: {
formCategory: string;
formName: string;
select?: string;
};
};
export default class ProjectItemUtilities {
static inferTypeFromContent(content: Uint8Array | string, fileName: string): {
itemType: ProjectItemType;
packType?: PackType;
path?: string;
};
static getFormPathForType(itemType: ProjectItemType): "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";
/**
* Returns the path to a community/Blockception JSON schema for the given item type.
* These schemas are located in public/res/latest/schemas/ and are loaded via Database.getCommunitySchema().
*/
static getCommunitySchemaPathForType(itemType: ProjectItemType): "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";
/**
* Returns the path to an official JSON schema for the given item type.
* These schemas are located in public/schemas/ and are loaded via Database.getOfficialSchema().
* The official schemas have different naming conventions than community schemas.
*/
static getOfficialSchemaPathForType(itemType: ProjectItemType): string | undefined;
static inferTypeFromJsonContent(jsonContent: string, fileName: string): {
itemType: ProjectItemType;
packType?: PackType;
path?: string;
};
static isDescendentOfPath(projectItem: ProjectItem, projectPath: string): boolean;
static getSortOrder(itemType: ProjectItemType): number;
static getItemByTypeAndName(project: Project, name: string, projectItemType: ProjectItemType): ProjectItem;
static getAccessoryFolderPathFromFilePath(projectItem: ProjectItem): string;
static getCategory(itemType: ProjectItemType): ProjectItemCategory.assets | ProjectItemCategory.logic | ProjectItemCategory.types | ProjectItemCategory.build | ProjectItemCategory.package | ProjectItemCategory.unknown | ProjectItemCategory.mctools;
static isTextureType(itemType: ProjectItemType): boolean;
static isImageType(itemType: ProjectItemType): boolean;
static isAudioType(itemType: ProjectItemType): boolean;
static isPackageType(itemType: ProjectItemType): boolean;
static isBinaryType(itemType: ProjectItemType): boolean;
static isVibrantVisualsTypeRelated(itemType: ProjectItemType): boolean;
static isVibrantVisualsRelated(item: ProjectItem): boolean;
static getMimeTypes(item: ProjectItem): string[];
static getDescriptionForType(type: ProjectItemType): "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";
static getTooltipForType(type: ProjectItemType): string;
static wouldBeCircular(candidate: ProjectItem, considering?: ProjectItem, visitedPaths?: Set<string>, dontGoUpward?: boolean, dontGoDownward?: boolean): boolean;
/**
* Recursively collects all descendant items reachable via childItems relationships.
* Includes the starting item itself. Uses cycle detection to prevent infinite loops.
* This is used to discover the full "tree" of files that make up an entity/block/item
* (e.g., BP entity → RP entity → model, textures, animations, spawn rules, loot tables).
*/
static collectAllDescendantItems(item: ProjectItem): ProjectItem[];
private static _collectDescendantsRecursive;
static isTextureSetTexture(projectItem: ProjectItem): boolean;
static isBlock(type: ProjectItemType): type is ProjectItemType.blockTypeBehavior | ProjectItemType.blockMaterialsBehaviorJson | ProjectItemType.blocksCatalogResourceJson | ProjectItemType.terrainTextureCatalogResourceJson | ProjectItemType.blockCulling;
static isBlockRelated(projectItem: ProjectItem, dontGoUpward?: boolean, dontGoDownward?: boolean): boolean;
static isUI(type: ProjectItemType): type is ProjectItemType.uiJson | ProjectItemType.uiTexture;
static isUIRelated(projectItem: ProjectItem, goUpwardOnly?: boolean, goDownwardOnly?: boolean, visited?: Set<ProjectItem>): boolean;
static isBehaviorRelated(itemType: ProjectItemType): boolean;
static getRootAncestorItems(item: ProjectItem, ancestorList?: ProjectItem[]): ProjectItem[];
static getRelationshipDescription(itemRel: IProjectItemRelationship): string;
static isDesignRelated(itemType: ProjectItemType): boolean;
static isResourceRelated(itemType: ProjectItemType): boolean;
static isItem(type: ProjectItemType): type is ProjectItemType.itemTypeBehavior | ProjectItemType.attachableResourceJson | ProjectItemType.itemTypeLegacyResource | ProjectItemType.itemTextureJson;
static isItemRelated(projectItem: ProjectItem, dontGoUpward?: boolean, dontGoDownward?: boolean): boolean;
static isEntity(type: ProjectItemType): type is ProjectItemType.entityTypeBehavior | ProjectItemType.entityTypeResource | ProjectItemType.renderControllerJson;
static isEntityRelated(projectItem: ProjectItem, dontGoUpward?: boolean, dontGoDownward?: boolean): boolean;
static isParticle(type: ProjectItemType): type is ProjectItemType.particleJson;
static isParticleRelated(projectItem: ProjectItem, dontGoUpward?: boolean, dontGoDownward?: boolean): boolean;
static getNewItemName(type: ProjectItemType): string;
/**
* Gets the semantic color for a project item type based on its category group.
* Uses the Minecraft-themed color palette from ProjectItemTypeInfo.
*/
static getColorForType(type: ProjectItemType): IColor;
/**
* Gets the type group (semantic category) for a project item type.
*/
static getTypeGroup(type: ProjectItemType): ProjectItemTypeGroup;
static getPluralDescriptionForType(type: ProjectItemType): string;
static getCousinOfType(projectItem: ProjectItem, itemType: ProjectItemType): ProjectItem | undefined;
static getFirstDescendentOfType(projectItem: ProjectItem, itemType: ProjectItemType): ProjectItem | undefined;
static getDefaultFolderForType(project: Project, itemType: ProjectItemType): Promise<import("../storage/IFolder").default>;
static getNewItemTechnicalName(type: ProjectItemType): string;
static getFolderRootsForType(itemType: ProjectItemType): readonly string[];
}
export declare function getEnsuredFile(items: readonly ProjectItem[], predicate: (item: ProjectItem) => boolean): Promise<any>;
export declare const getEnsuredFileOfType: (items: readonly ProjectItem[], type: ProjectItemType) => Promise<any>;
export declare function findEnsuredFiles(items: readonly ProjectItem[], predicate: (item: ProjectItem) => boolean): Promise<import("../storage/IFile").default[]>;
export declare const findEnsuredFilesOfType: (items: readonly ProjectItem[], type: ProjectItemType) => Promise<import("../storage/IFile").default[]>;
export declare function getNeighborFiles(items: readonly ProjectItem[], subject: ProjectItem): ProjectItem[];
export declare function getWorldTemplates(items: readonly ProjectItem[]): {
name: string;
items: ProjectItem[];
}[];
export declare function getMarketContent(items: readonly ProjectItem[]): ProjectItem[];
export declare function tryEnsureFiles(items: ProjectItem[], predicate?: (item: ProjectItem) => boolean): Promise<readonly [ProjectItem[], ProjectItem[]]>;