# Item filter

U**se one of these methods to add an** [item-filter](https://frinn.gitbook.io/custom-machinery-1.21/recipes/requirements/item-filter "mention") **requirement to the recipe.**

```javascript
.requireItemFilter(IIngredient ingredient)
.requireItemFilter(IIngredient ingredient, String slot)
```

* The `ingredient` param must be a CT [IIngredient](https://docs.blamejared.com/1.20.2/en/vanilla/api/ingredient/IIngredient).
* The `slot` param must be a valid slot id.

### Example

The following recipe will run only if the filter slot "filter1" is set to a vanilla diamond :&#x20;

```javascript
<recipetype:custommachinery:custom_machine>.create("custommachinery:power_crusher", 20)
.requireItemFilter(<item:minecraft:diamond>, "filter1")
.build();
```
