# Shaped crafting

Symbol-bound input state in shaped crafting recipes.

**since NTM 1.0.1**

File: `data/<namespace>/recipe/<path>.json`.

`hbm:crafting_shaped` uses the same JSON on Fabric and NeoForge; NTM's bundled shaped crafting recipes use it. Its pattern matches after trimming empty borders and allows horizontal mirroring. [Input-state rules](https://movblock.mov/ntm-next/wiki/recipes/input-state.md) bind to the pattern symbols through either transformation. Inputs accept pristine stacks by default.

## Fields

| Field | Meaning and default | Range |
| - | - | - |
| `type` | Selects the `hbm:crafting_shaped` recipe format. | |
| `pattern` | 1–3 equal-width rows, each at most 3 characters. Spaces represent empty cells; at least one cell must contain an ingredient. | |
| `key` | Maps each pattern symbol to an ingredient; every key symbol must appear in the pattern. | |
| `key.<symbol>` | One non-space character mapped to an ingredient used in the pattern. | |
| `result` | Output stack template. A result carrier requires count 1. | |
| `result.id` | Item ID. | |
| `result.count` (Optional) | Stack size; default 1. | `[1, 99]` |
| `result.components` (Optional) | Item-component values. | |
| `input_state` (Optional) | Input-state rules keyed by pattern symbol; default empty. | |
| `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. | |
| `category` (Optional) | Recipe-book category: `building`, `redstone`, `equipment`, or `misc`; default `misc`. | |
| `group` (Optional) | Recipe-book group string; default empty. | |
| `show_notification` (Optional) | Shows the recipe-unlock notification; default `true`. | |

Each `input_state` selector must name a symbol in `key`. `preserve: result` requires exactly one occurrence of that symbol in the pattern. [Loader conditions](https://movblock.mov/ntm-next/wiki/recipes/conditions.md) can wrap the recipe.

## Example:

Shipped steel-to-desh crate upgrade, `data/hbm/recipe/crate_desh.json`. Four desh plates surround the Steel Crate; the Desh Crate retains that crate's component changes, including its contents, name and lock.

```json
{
  "type": "hbm:crafting_shaped",
  "input_state": {
    "S": {
      "preserve": "result"
    }
  },
  "key": {
    "D": "hbm:plate_desh",
    "S": "hbm:crate_steel"
  },
  "pattern": [
    " D ",
    "DSD",
    " D "
  ],
  "result": {
    "id": "hbm:crate_desh"
  }
}
```
