UNPKG

@minecraft/creator-tools

Version:

Minecraft Creator Tools command line and libraries.

57 lines (56 loc) 2.75 kB
import Project from "./Project"; import ProjectItem from "./ProjectItem"; export default class RelationsIndex { /** Entity type resources indexed by their definition ID (e.g., "minecraft:pig") */ entityResourcesById: Map<string, ProjectItem[]>; /** Spawn rules indexed by their entity ID (e.g., "minecraft:pig") */ spawnRulesById: Map<string, ProjectItem[]>; /** Entity type behaviors indexed by their definition ID */ entityBehaviorsById: Map<string, ProjectItem[]>; /** Attachable resources indexed by their ID */ attachablesById: Map<string, ProjectItem[]>; /** Item type behaviors indexed by their ID */ itemTypesById: Map<string, ProjectItem[]>; /** Feature behaviors indexed by their ID */ featureBehaviorsById: Map<string, ProjectItem[]>; /** Animation resources indexed by individual animation IDs (one file can have multiple) */ animationsById: Map<string, ProjectItem[]>; /** Animation controller resources indexed by individual controller IDs */ animationControllersById: Map<string, ProjectItem[]>; /** Render controllers indexed by individual controller IDs */ renderControllersById: Map<string, ProjectItem[]>; /** Model geometry items indexed by individual geometry identifiers */ modelsById: Map<string, ProjectItem[]>; /** Loot tables indexed by canonicalized pack-relative path */ lootTablesByPath: Map<string, ProjectItem>; /** Whether the index has been built */ isBuilt: boolean; /** * Build all indexes from the project's items. * Batch-loads content for all relatable item types, parses definitions, * and populates lookup maps. */ build(project: Project, onProgress?: (message: string) => void): Promise<void>; private static readonly EMPTY_ITEMS; /** Look up items in a map, returning empty array if not found */ getItemsById(map: Map<string, ProjectItem[]>, id: string): ProjectItem[]; /** * Add unique child items from the index to a parent item. * Deduplicates when multiple IDs in `idList` resolve to the same ProjectItem. * Returns the set of IDs from `idList` that were successfully matched, so callers * can determine which IDs remain unfulfilled. */ addUniqueChildItems(parentItem: ProjectItem, indexMap: Map<string, ProjectItem[]>, idList: string[]): Set<string>; private _addToIndex; private _indexEntityResources; private _indexSpawnRules; private _indexEntityBehaviors; private _indexAttachables; private _indexItemTypes; private _indexAnimations; private _indexAnimationControllers; private _indexRenderControllers; private _indexModels; private _indexLootTables; private _indexFeatureBehaviors; }