# Durability

**Use one of these methods to add a** [**Durability Requirement**](https://frinn.gitbook.io/custom-machinery-1.19/recipes/requirements/durability) **to the recipe.**

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

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

.damageItemTag("tag", amount)
.damageItemTag("tag", amount, nbt)
.damageItemTag("tag", amount, "slot")
.damageItemTag("tag", amount, nbt, "slot")

//Don't break the item if its durability reach 0
.damageItemTagNoBreak("tag", amount)
.damageItemTagNoBreak("tag", amount, nbt)
.damageItemTagNoBreak("tag", amount, "slot")
.damageItemTagNoBreak("tag", amount, nbt, "slot")

.repairItem(item, amount)
.repairItem(item, amount, "slot")

.repairItemTag("tag", amount)
.repairItemTag("tag", amount, nbt)
.repairItemTag("tag", amount, "slot")
.repairItemTag("tag", amount, nbt, "slot")
```

* The `item` param must be created using `Item.of()` KubeJS method. \
  Example : `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](https://frinn.gitbook.io/custom-machinery-1.19/creating-custom-machines/machine-components/item-component) `slot` property.
* The `tag` param must be a string starting with # defining a valid tag id. \
  Example : `"#forge:stone"`
* The `amount` param must be a positive integer.
* The `nbt` param must be a map. \
  Example: `{nbt1: 1, nbt2: "something"}`.

### Example

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

  event.recipes.custommachinery.custom_machine("custommachinery:power_crusher", 100)
  .damageItem(Item.of("minecraft:cobblestone"), 1)
  
})
```
