> 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/recipes/requirements/item.md).

# Item

Make the recipe consume or produce items

Item requirement is used to define item inputs and outputs for a custom machine recipe.

To use it you need to provide the registry name and the amount of the item you want the recipe to consume/produce.

This requirement is available in both `input` and `output` modes.

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

In output mode : When finishing to craft the recipe, the machine will produce the desired amount of the specified item and put them in the first disponible output slot.

The requirement type of item requirement is :  "`custommachinery:item"`.

### Properties

The item requirement has 3 mandatory properties and 3 optional properties.

#### Mandatory properties

```json
"type": "custommachinery:item" //Mandatory to define an item requirement.
```

<details>

<summary>Mode</summary>

#### Name : `mode`

#### Description :

Define the I/O mode of the requirement.

* `input` The requirement will consume items at the start of the crafting process.
* `output` The requirement will produce items at the end of the crafting process.

#### Example :

```json
"mode": "input"
```

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

</details>

<details>

<summary>Ingredient</summary>

#### Name : `ingredient`

#### Description :&#x20;

A sized ingredient with a syntax like this :&#x20;

```json
"ingredient": {
    "item": "item_id",
    "count": amount
}
```

* "item" property is the registry name of the item you want to be consumed/produced 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`).
* If the requirement mode is `input` you can use a tag instead, by using "tag" instead of "item". Example : `"tag": "tag_id"`

**You can't use a tag if the requirement mode is output !**

#### Example :&#x20;

```json
"ingredient": {
    "item": "minecraft:diamond",
    "count": 1
}
```

The item consumed/produced by the recipe will be a vanilla Diamond.

<pre class="language-json"><code class="lang-json"><strong>"ingredient": {
</strong><strong>    "tag": "minecraft:logs",
</strong><strong>    "count": 1,
</strong><strong>}
</strong></code></pre>

The recipe will consume 1 of any logs.

#### Note :&#x20;

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

</details>

#### Optional properties

<details>

<summary>Chance</summary>

#### Name : `chance`

#### Description :

A double between 0.0 and 1.0 that define the chance of the requirement to be processed.

#### Default : 1

The requirement will always be processed.

#### Example :

```json
"chance": 0.7
```

The requirement will have 70% chance to be processed.

</details>

<details>

<summary>Slot</summary>

#### Name : `slot`

#### Description :&#x20;

The slot id of a slot you want to force the player to put the item in.&#x20;

The slot id **must be exactly the same** as the one specified in the [Item Component ID property](/custom-machinery-1.21/creating-custom-machines/machine-components/item-component.md#mandatory-properties) or it will not work.&#x20;

If the requirement mode is "output" the produced item will be put in the specified slot.

#### Default : `empty`

The item can be put in any slot.

#### Example :&#x20;

```json
"slot": "input1"
```

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

</details>

<details>

<summary>Consume on end</summary>

#### Name : `consume_on_end`

#### Description :&#x20;

A boolean value, if true the item will be consumed at the end of the crafting process instead of the start.

The items are required to be in an input slot during the whole crafting process, if removed by a player or any other mean the process will stop and the machine will error.

This can be combined with the [reset on error](/custom-machinery-1.21/recipes/machine-recipe.md#error) feature to cancel a recipe if a player remove the items from the input slot.

#### Default : `false`

The items are consumed at the start of the crafting process.

#### Example :&#x20;

```json
"consume_on_end": true
```

</details>

### Examples

An item requirement that will make the recipe consume 50 vanilla cobblestone:

```json
{
    "type": "custommachinery:item",
    "mode": "input",
    "ingredient": {
        "item": "minecraft:cobblestone",
        "count": 50
    }
}
```

An item requirement that will make the recipe produce 1 vanilla diamond chestplate with 1% chance:

```json
{
    "type": "custommachinery:item",
    "mode": "output",
    "ingredient": {
        "item": "minecraft:diamond_chestplate",
        "count": 1
    },
    "chance": 0.01
}
```
