> For the complete documentation index, see [llms.txt](https://frinn.gitbook.io/custom-machinery-1.21/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://frinn.gitbook.io/custom-machinery-1.21/mod-integrations/kubejs/recipes/durability.md).

# Durability

Use the durability requirement in a KubeJS recipe

**Use one of these methods to add a** [**Durability Requirement**](/custom-machinery-1.21/recipes/requirements/durability.md) **to the recipe.**

{% hint style="info" %}
When damaging items any enchantments (like unbreaking) or other special behaviors tied to this item will be properly applied.
{% endhint %}

```javascript
.damageItem(ingredient, amount)
.damageItem(ingredient, amount, "slot")

//Don't break the item if its durability reach 0
.damageItemNoBreak(ingredient, amount)
.damageItemNoBreak(ingredient, amount, "slot")

.repairItem(ingredient, amount)
.repairItem(ingredient, amount, "slot")
```

* The `ingredient` param must be an ItemStack created using one of the following syntax:&#x20;
  * String syntax : `"diamond"` or `"botania:pure_daisy"` or `"4x mekanism:osmium_ingot"`
  * &#x20;`Item.of()` KubeJS method : `Item.of("minecraft:diamond", 42)`
* The `slot` param must be a string corresponding to a slot id defined in a custom machine json [Item Component](/custom-machinery-1.21/creating-custom-machines/machine-components/item-component.md) `slot` property.
* The `amount` param must be a positive integer. It's the amount of durability added/removed.

### Example

The recipe will damage a diamond pickaxe, removing 3 durability points.

```javascript
ServerEvents.recipes(event => {

  event.recipes.custommachinery.custom_machine("custommachinery:power_crusher", 100)
  .damageItem("diamond_pickaxe", 3)
  
})
```
