# Shredder

Requires one count-1 item input and one output position.

Rows with fluids or a nonzero `duration` or `power` fail to load. An input without a row produces scrap when the stack has no component changes; a changed stack that no row [accepts](https://movblock.mov/ntm-next/26.3/wiki/ingredients-and-components.md#changed-component-state) stays in the input slot.

The output position contains one fixed stack or a [weighted list](https://movblock.mov/ntm-next/26.3/wiki/recipes/items.md#item-outputs) whose nonempty entries share one item and its components; entries may differ in count, and an empty entry yields no output. Every weight is positive and at least one entry is nonempty. A [chance output](https://movblock.mov/ntm-next/26.3/wiki/recipes/items.md#item-outputs) is such a list. A cut starts only when the output slot fits the largest count.

## Fields

| Field | Meaning and default | Range |
| - | - | - |
| `type` | Selects the `hbm:shredder` recipe format. | |
| `name` (Optional) | Internal lookup name; defaults to the last segment of the recipe resource path. | |
| `input_items` | Ordered counted item inputs; defaults to an empty list. | |
| `input_items.ingredient` | Item ID, item tag, or loader ingredient object. | |
| `input_items.count` (Optional) | Items required from one stack; default 1. The item stack limit bounds a usable count. | `[1, i32::MAX]` |
| `input_items.components` (Optional) | Exact item-component values. | |
| `input_items.predicates` (Optional) | Item-component predicates. | |
| `output_items` | Fixed or weighted item-output positions; defaults to an empty list. | |
| `output_items.item ID` | Fixed output: String form for one item. | |
| `output_items.id` | Item ID in a stack object. | |
| `output_items.count` (Optional) | Stack size; default 1. | `[1, 99]` |
| `output_items.components` (Optional) | Item-component values. | |
| `output_items.chance` (Optional) | Output chance; omit for a guaranteed output. Some machines roll each item of the stack separately. | Rounds to weight `[1, 999]` of 1000 |
| `output_items.data` | Weighted choice: Stack object or an empty object for no output. | |
| `output_items.weight` | Relative selection weight; a positive total selects an output. | `[0, i32::MAX]` each; $\sum_i w_i \le \texttt{i32::MAX}$ |
| `order` (Optional) | Sort position within the recipe table; lower values first, default 2147483647. | `i32` |

## Example

Source path: `data/hbm/recipe/shredder/shredder.dust.json`

```json
{
  "type": "hbm:shredder",
  "input_items": [
    {
      "ingredient": "hbm:dust"
    }
  ],
  "order": 1,
  "output_items": [
    "hbm:dust"
  ]
}
```

Source path: `data/hbm/recipe/shredder/shredder.raw_materials_aluminium.json`; one chunk of cryolite with weight 2, two with weight 1:

```json
{
  "type": "hbm:shredder",
  "input_items": [
    {
      "ingredient": "#c:raw_materials/aluminum"
    }
  ],
  "order": 22016,
  "output_items": [
    [
      {
        "data": {
          "id": "hbm:chunk_ore_cryolite"
        },
        "weight": 2
      },
      {
        "data": {
          "count": 2,
          "id": "hbm:chunk_ore_cryolite"
        },
        "weight": 1
      }
    ]
  ]
}
```
