# Item inputs and outputs

Counted ingredients and fixed or weighted outputs.

## Item inputs

Each shared-format `input_items` entry is an object containing `ingredient`, with an optional `count` of `[1, i32::MAX]` that defaults to 1. The item’s stack limit bounds the usable count.

An exact item:

```json
{"ingredient": "minecraft:iron_ingot", "count": 2}
```

An item tag:

```json
{"ingredient": "#c:ingots/steel", "count": 2}
```

The leading `#` denotes an ingredient tag; a plain string names an item.

An input can also demand component values. For example, this is the form of a cold depleted-uranium requirement:

```json
{
  "ingredient": "hbm:waste_uranium",
  "components": {
    "hbm:decay_heat": false
  }
}
```

For fluid-container inputs, component predicates and the handling of changed components, see [Ingredients and Components](https://movblock.mov/ntm-next/wiki/ingredients-and-components.md).

## Item outputs

The shared `output_items` field is an array of output positions. Each position can hold a fixed output or, for machines which roll outputs, a weighted choice.

| Form for one entry | Meaning | Range |
| - | - | - |
| `"minecraft:paper"` | One item, no explicit components | |
| `{"id":"minecraft:paper","count":3}` | Three items | `count`: `[1, 99]` |
| `{"id":"minecraft:paper","count":3,"chance":0.25}` | Three items with a $25\%$ chance; otherwise no output at that position | `count`: `[1, 99]`; `chance`: rounds to $[\frac{1}{1000}, \frac{999}{1000}]$ |

`chance` rolls once for the entire stack, except in the Assembly Machine, Assembly Factory, Precision Assembly Machine, Chemical Plant, Chemical Factory, PUREX, Supercomputer, Rock Mill, Plasma Forge and Fusion Reactor Vessel, which roll each item of the stack separately. The shortcut rounds the probability to a weight out of 1000; valid results are `[1, 999]`. Omit `chance` for a guaranteed output.

For multiple alternatives, put a weighted list inside one output position:

```json
{
  "output_items": [
    [
      {"data": {"id": "minecraft:paper", "count": 3}, "weight": 3},
      {"data": {"id": "minecraft:stick"}, "weight": 1},
      {"data": {}, "weight": 4}
    ]
  ]
}
```

This output position yields paper with probability $\frac{3}{8}$, a stick with probability $\frac{1}{8}$, or nothing with probability $\frac{4}{8}$. Additional outer-array entries define separate output positions.

Each weight is `[0, i32::MAX]`; their sum may be `[0, i32::MAX]`. A positive sum selects an output.

In the machines listed above, a list holding one item and one empty entry rolls like `chance`, and a position with several possible items outputs only into an empty slot.

> **since NTM 1.0.1**
>
> The Centrifuge, Ore Acidizer, Combination Oven, Burner Press, Electric Press, RBMK Irradiation Channel, Fusion Reactor Breeding Chamber, Coker Unit, Industrial Solidification Machine, Pyrolysis Oven, Exposure Chamber, Ammo Press, Soldering Station, Gas Centrifuge and custom machines roll each output position once per operation. An operation starts only if every output fits without rolling: [until NTM 1.0.4: a fixed or `chance` output must stack onto the held output stack, and a position with several possible items needs its slot empty][since NTM 1.0.4: a position whose possible stacks share one item and its components must stack its largest count onto the held output stack, and a position with several distinct items or components needs its slot empty]. The Gas Centrifuge requires every combination its output positions can roll to fit its shared output slots.

For crafting outputs selected from an item tag, see [Item-tag result](https://movblock.mov/ntm-next/wiki/recipes/tag-result.md).

Custom machines roll weighted choices. [Shredder](https://movblock.mov/ntm-next/wiki/recipe-types/shredder.md) recipes require exactly one count-1 input and one output position; fluids, duration and power stay empty or zero.
