UNPKG

@minecraft/creator-tools

Version:

Minecraft Creator Tools command line and libraries.

66 lines (64 loc) 3.54 kB
"use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", { value: true }); exports.UnlinkedItemInfoGeneratorTest = void 0; const ProjectInfoItem_1 = require("./ProjectInfoItem"); const ProjectItemUtilities_1 = require("../app/ProjectItemUtilities"); const IInfoItemData_1 = require("./IInfoItemData"); const Database_1 = require("../minecraft/Database"); const IProjectItemData_1 = require("../app/IProjectItemData"); var UnlinkedItemInfoGeneratorTest; (function (UnlinkedItemInfoGeneratorTest) { UnlinkedItemInfoGeneratorTest[UnlinkedItemInfoGeneratorTest["unlinkedItemIsNotUsed"] = 191] = "unlinkedItemIsNotUsed"; UnlinkedItemInfoGeneratorTest[UnlinkedItemInfoGeneratorTest["itemNotFoundInPack"] = 204] = "itemNotFoundInPack"; UnlinkedItemInfoGeneratorTest[UnlinkedItemInfoGeneratorTest["avoidLinksToVanillaItems"] = 205] = "avoidLinksToVanillaItems"; })(UnlinkedItemInfoGeneratorTest = exports.UnlinkedItemInfoGeneratorTest || (exports.UnlinkedItemInfoGeneratorTest = {})); class UnlinkedItemInfoGenerator { constructor() { this.id = "UNLINK"; this.title = "Unlinked item info generator"; this.canAlwaysProcess = true; } getTopicData(topicId) { return { title: topicId.toString(), }; } summarize(info, infoSet) { } async generate(projectItem, contentIndex) { const items = []; if (projectItem.unfulfilledRelationships) { for (const rel of projectItem.unfulfilledRelationships) { if (rel.isVanillaDependent) { // UNLINK205 items.push(new ProjectInfoItem_1.default(IInfoItemData_1.InfoItemType.recommendation, this.id, UnlinkedItemInfoGeneratorTest.avoidLinksToVanillaItems, `Link to vanilla ` + ProjectItemUtilities_1.default.getDescriptionForType(rel.itemType) + ` item; avoid if possible`, projectItem, rel.path)); } else { // UNLINK204 items.push(new ProjectInfoItem_1.default(IInfoItemData_1.InfoItemType.warning, this.id, UnlinkedItemInfoGeneratorTest.itemNotFoundInPack, `Link to ` + ProjectItemUtilities_1.default.getDescriptionForType(rel.itemType).toLowerCase() + ` is not found in this pack`, projectItem, rel.path)); } } } if (projectItem.itemType === IProjectItemData_1.ProjectItemType.texture || projectItem.itemType === IProjectItemData_1.ProjectItemType.audio) { if (projectItem.parentItemCount <= 0 && projectItem.childItemCount <= 0) { const path = projectItem.getPackRelativePath(); if (path) { const isVanilla = await Database_1.default.matchesVanillaPath(path); if (!isVanilla) { // UNLINK191 items.push(new ProjectInfoItem_1.default(IInfoItemData_1.InfoItemType.warning, this.id, UnlinkedItemInfoGeneratorTest.unlinkedItemIsNotUsed, ProjectItemUtilities_1.default.getDescriptionForType(projectItem.itemType) + ` does not have any items in this pack that are using this.`, projectItem)); } } } } return items; } } exports.default = UnlinkedItemInfoGenerator; //# sourceMappingURL=../maps/info/UnlinkedItemInfoGenerator.js.map