Durability

Make the recipe damage or repair items

Durability requirement is used to damage or repair items in inputs slots.

To use it you need to provide the registry name of the item and the amount of durability you want the recipe to damage/repair.

This requirement is available in both input and output modes.

The requirement type of durability requirement is : "custommachinery:durability".

Properties

The durability requirement has 4 mandatory properties and 3 optional properties.

Mandatory properties

"type": "custommachinery:durability" //Mandatory to define a durability requirement.
Mode

Name : mode

Description :

Define when the requirement will be processed and what it does.

  • input When starting to craft the recipe, the machine will consume the desired amount of the specified item durability from the input slot they are in.

  • output When finishing to craft the recipe, the machine will repair the desired amount of the specified item durability. The item must still be in an input slot.

Example :

"mode": "input"

The requirement will consume durability at the start of the crafting process.

Item

Name : item

Description :

The registry name of the item you want to damage/repair. It must be specified like namespace:item_registry_name with "namespace" being either "minecraft" if the item is from vanilla or a mod ID if the item is from a mod (ex : "minecraft:diamond" or "mekanism:copper_ingot").

Example :

"item": "minecraft:diamond"

The item damaged/repaired by the recipe will be a vanilla Diamond.

Note :

You can see an item registry name by activating advanced infos (F3 + H in-game) and hovering the item in an inventory.

Amount

Name : amount

Description :

An integer that define the amount of durability you want to remove/add to the specified item.

Example :

"amount": 16

The recipe will damage/repair the specified item 16 durability.

Optional properties

Chance

Name : chance

Description :

A double between 0.0 and 1.0 that define the chance of the item to be damaged if input or repaired if output, the chance is applied for the whole stack defined in this requirement.

Default : 1

The item will always be damaged/repaired.

Example :

"chance": 0.7

The item will have 70% chance to be damaged/repaired.

NBT

Name : nbt

Description :

A string that represent a nbt tag that will be required on the item. Only item that have all nbt tags specified here will be damaged/repaired.

You can see the nbt tag of an item using /data get entity @s SelectedItem and then copy the part after tag: inside {}.

Default :

Nothing, no nbt tags required or added.

Example :

"nbt": "{'test1': true, 'Amount': 10}"

The item requirement will search for items with nbt tag "test1" with value true and tag "Amount" with value 10.

Slot

Name : slot

Description :

The slot id of a slot you want to force the player to put the item in. The slot id must be exactly the same as the one specified in the Item Component ID property or it will not work.

Default : empty

The item can be put in any slot.

Example :

"slot": "input1"

The item will be input/output only in the slot with id input1.

Break

Name : break

Description :

Define whether the requirement can break the item when its durability is down to 0.

Otherwise the item will stay in the slot with 0 durability and will be able to be repaired by the player.

Default : false

Example :

"break": true

The requirement will break the item.

Example

An Durability Requirement that will make the recipe damage a vanilla diamond pickaxe 50 durability points:

{
    "type": "custommachinery:durability",
    "mode": "input",
    "item": "minecraft:diamond_pickaxe",
    "amount": 50
}

Last updated