UNPKG

@minecraft/creator-tools

Version:

Minecraft Creator Tools command line and libraries.

33 lines (32 loc) 1.08 kB
"use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", { value: true }); exports.RepairableItemTrait = void 0; const ContentTraits_1 = require("./ContentTraits"); /** * Repairable - can be repaired. */ class RepairableItemTrait extends ContentTraits_1.ItemContentTrait { get id() { return "repairable"; } getData(config) { const repairItems = config?.repairItems ?? ["minecraft:iron_ingot"]; return { id: "repairable", displayName: "Repairable", description: "Can be repaired", category: "special", components: { "minecraft:repairable": { repair_items: repairItems.map((item) => ({ items: [item], repair_amount: "context.other->q.remaining_durability + 0.05 * context.other->q.max_durability", })), }, }, }; } } exports.RepairableItemTrait = RepairableItemTrait;