# Electrolysis Machine

## Fluid recipes

The first two output fluids fill the two output tanks, and up to three output positions produce their first entries. Among rows with the same input fluid, the last by `order` applies.

### Fields

| Field | Meaning and default | Range |
| - | - | - |
| `type` | Selects the `hbm:electrolyser_fluid` recipe format. | |
| `name` (Optional) | Internal lookup name; defaults to the last segment of the recipe resource path. | |
| `input_fluids` | Ordered fluid inputs with amount and pressure; defaults to an empty list. | |
| `input_fluids.type` | Registered fluid ID. | |
| `input_fluids.amount` | Amount in mB; use $[1, \mathrm{tank\ capacity}]$ for transfers because machine code casts to int. | `i64` |
| `input_fluids.pressure` (Optional) | Pressure level; default 0. | `i32` |
| `output_items` (Optional) | 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}$ |
| `output_fluids` | Ordered fluid outputs with amount and pressure; defaults to an empty list. | |
| `output_fluids.type` | Registered fluid ID. | |
| `output_fluids.amount` | Amount in mB; use $[1, \mathrm{tank\ capacity}]$ for transfers because machine code casts to int. | `i64` |
| `output_fluids.pressure` (Optional) | Pressure level; default 0. | `i32` |
| `duration` | Process duration in ticks; defaults to 0. | `i32` |
| `order` (Optional) | Sort position within the recipe table; lower values first, default 2147483647. | `i32` |

### Example

Source path: `data/hbm/recipe/electrolyser_fluid/electrolyser.potassiumchloride.json`

```json
{
  "type": "hbm:electrolyser_fluid",
  "duration": 20,
  "input_fluids": [
    {
      "type": "hbm:potassium_chloride",
      "amount": 250
    }
  ],
  "order": 6,
  "output_fluids": [
    {
      "type": "hbm:chlorine",
      "amount": 125
    }
  ],
  "output_items": [
    "hbm:dust"
  ]
}
```

## Metal recipes

The machine consumes one item per operation from the first input position and 100 mB of nitric acid; `count` and `input_fluids` are ignored. Up to six output positions produce their first entries. Each pour buffer holds 10,368 units of one material.

### Fields

| Field | Meaning and default | Range |
| - | - | - |
| `type` | Selects the `hbm:electrolyser_metal` 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` (Optional) | 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}$ |
| `duration` | Process duration in ticks; defaults to 0. | `i32` |
| `order` (Optional) | Sort position within the recipe table; lower values first, default 2147483647. | `i32` |
| `output_material` | Required primary material-stack output. | |
| `output_material.material` | NTM material name. | |
| `output_material.amount` | Quantity in NTM material units. | `i32` |
| `output_material_2` (Optional) | Optional secondary material-stack output. | |
| `output_material_2.material` | NTM material name. | |
| `output_material_2.amount` | Quantity in NTM material units. | `i32` |

### Example

Source path: `data/hbm/recipe/electrolyser_metal/electrolyser_metal.crumbs_light_metal.json`

```json
{
  "type": "hbm:electrolyser_metal",
  "duration": 20,
  "input_items": [
    {
      "components": {
        "hbm:bedrock_ore": {
          "grade": "crumbs"
        }
      },
      "ingredient": "hbm:bedrock_ore"
    }
  ],
  "order": 20,
  "output_material": {
    "amount": 144,
    "material": "iron"
  },
  "output_material_2": {
    "amount": 144,
    "material": "copper"
  }
}
```
