# Item

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 have 4 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>Item</summary>

#### Name : `item`

#### Description :&#x20;

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 the # prefix like `#minecraft:logs`.

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

#### Example :&#x20;

```json
"item": "minecraft:diamond"
```

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

```json
"item": "#minecraft:logs"
```

The recipe will consume 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>

<details>

<summary>Amount</summary>

#### Name : `amount`

Description :&#x20;

An integer that define the amount of the specified item you want to be consumed/produced.&#x20;

It can be higher than the maximum stack size of said item but remember that the machine need enough item inventory slots to input/output the items (ex : if you set the requirement to 20 iron chestplate the machine will need 20 input/output slots to consume/produce the items since the maximum stack size of an iron chestplate is 1).

#### Example :&#x20;

```json
"amount": 16
```

The recipe will consume/produce 16 of the specified item.

</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>Nbt</summary>

#### Name : `nbt`

#### Description :&#x20;

A string that represent a nbt tag that will be required on the input item, or added to the output item.&#x20;

If the item requirement is in input mode it will search for items in input slots that have AT LEAST those nbt tag, if the item have more tag it's fine as long as it have all the tags specified in this property.&#x20;

The nbt tag must be defined the same way you use it in the /give command.

You can see the nbt tag of an item using `/data get entity @s SelectedItem` and then copy the part after `tag:` inside {}.

#### Default : nothing&#x20;

No nbt tags

#### Example :&#x20;

```json
"nbt": "{'test1': true, 'Amount': 10}"
```

The item requirement will search for items with nbt tag "test1" with value true and tag "Amount" with value 10.

</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](https://frinn.gitbook.io/custom-machinery-1.16/creating-custom-machines/machine-components/item-component#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>

### Example

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

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

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

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://frinn.gitbook.io/custom-machinery-1.16/recipes/requirements/item.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
