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.

Ingredient

Name : ingredient

Description :

An ingredient with one of the following syntax :

  • For items

"input": {
    "item": "item_id"
}

"item_id" is the registry name of the item you want to be consumed by the recipe.

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).

  • For tags

"input": {
    "tag": "tag_id"
}

"tag_id" is a tag grouping any item that can be consumed by the recipe.

Example :

"ingredient": {
    "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.

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",
    "ingredient": {
        "item": "minecraft:diamond_pickaxe"
    },
    "amount": 50
}

Last updated