# Crafting input state

Required component values and state-preserving crafting inputs.

The `input_state` field of [shaped](https://movblock.mov/ntm-next/26.3/wiki/recipes/crafting-shaped.md) and [shapeless](https://movblock.mov/ntm-next/26.3/wiki/recipes/crafting-shapeless.md) NTM crafting recipes declares component requirements and a preservation destination. Both loaders use the same field format.

An omitted rule accepts pristine stacks: stacks without component changes relative to their item definition. Modified inputs must satisfy an explicit state requirement or retain their changed state in the result or crafting remainder.

## Fields

| Field | Meaning and default |
| - | - |
| `input_state` (Optional) | Rules keyed by a shaped pattern symbol or shapeless ingredient index. |
| `input_state.<selector>` | Pattern symbol or zero-based ingredient index mapped to an input rule. |
| `input_state.<selector>.components` (Optional) | Exact component values required on this input; default empty. |
| `input_state.<selector>.predicates` (Optional) | Registered component predicates required on this input; default empty. |
| `input_state.<selector>.preserve` (Optional) | State destination: result or remainder. Omit to consume only pristine or explicitly required state. |

Each rule accepts `components`, `predicates`, and `preserve`. Undefined selectors, unsupported fields or destinations, and multiple result carriers fail recipe loading.

## Required state

`components` compares complete registered component values. `predicates` uses registered component predicates. Both use the schemas described under [Ingredients and Components](https://movblock.mov/ntm-next/26.3/wiki/ingredients-and-components.md). A rule's requirements add to the claims of its ingredient; each changed component must be [claimed](https://movblock.mov/ntm-next/26.3/wiki/ingredients-and-components.md#changed-component-state) or preserved.

For an ingot named `Required`, set the rule on its shaped symbol or shapeless index:

```json
"input_state": {
  "I": {
    "components": {"minecraft:custom_name": {"text": "Required"}}
  }
}
```

## Result carrier

`"preserve": "result"` copies the selected input's component changes to the output. Exactly one input occurrence supplies that state, and `result.count` must be 1. Shaped cropping and mirroring retain the symbol binding; shapeless assignment selects the stack attached to the declared ingredient index.

Result component fields may add values. Matching refuses an override that replaces a changed value carried by the actual input. An override that contradicts an exact preserved component requirement fails recipe loading.

## Crafting remainder

`"preserve": "remainder"` requires the input's actual crafting remainder to retain its changed state. NTM crafting tools gain their usual one point of wear. An item without a crafting remainder never matches this rule. The Combinator Funnel discards remainders and refuses modified inputs bound to this rule.

Shipped recipe `data/hbm/recipe/ball_dynamite.json`; ingredient `3` accepts either Laboratory Glassware item:

```json
{
  "type": "hbm:crafting_shapeless",
  "ingredients": [
    "#c:dusts/saltpeter",
    "minecraft:sugar",
    "minecraft:sand",
    "#hbm:tools/chemistry_set"
  ],
  "input_state": {
    "3": {
      "preserve": "remainder"
    }
  },
  "result": {
    "count": 2,
    "id": "hbm:ball_dynamite"
  }
}
```

Component requirements still apply: an explicit zero-damage demand accepts only an undamaged input.
