#Generic Repair Recipe

5 messages · Page 1 of 1 (latest)

humble crane
#

I'm trying to create a generic repair recipe, to repair any item that is damaged but I'm not sure how to match on the required item types. I know for output I can use .modifyResult to decrease the Damage done, but I'm not sure how to match the item.

The script below kinda does what I want, but I don't want the recipe to be valid for items with no Damage, and I want it to work on any item that has Damage

event.custom({
        "type": "create:filling",
        "ingredients": [
            {
                "item": "minecraft:diamond_sword"
            },
            {
                "fluid": "create_enchantment_industry:experience",
                "amount": 10
            }
        ],
        "results": [
            {
                "item": "minecraft:diamond_sword"
            }
        ]
    }).modifyResult((inventory, itemstack) => {
        item = inventory.find(Item.of('minecraft:diamond_sword').ignoreNBT())
        if (item.nbt == null) return itemstack
        nbt = item.nbt
        nbt.Damage = nbt.Damage - 1;
        return itemstack.withNBT(nbt)
    })
random sandalBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

random sandalBOT
#

@humble crane Unresolved thread still hasn't been closed! If your question was answered, please close this post with </ticket close:1054771505520717835> command!

random sandalBOT
#

@humble crane Unresolved thread still hasn't been closed! If your question was answered, please close this post with </ticket close:1054771505520717835> command!

random sandalBOT
#

@humble crane Unresolved thread still hasn't been closed! If your question was answered, please close this post with </ticket close:1054771505520717835> command!