# DFC crate recipes

Converts items in a Tungsten Crate struck by DFC beams.

Each time a DFC beam delivers energy to a Tungsten Crate, every slot whose item matches a row may convert. The chance rises with the delivered energy: conversion requires energy above 0.9 × `required_flux` and succeeds when $0.001 > n \times u \times 0.9 \times \mathrm{required\_flux} / E$, with stack count `n`, delivered energy `E` and a uniform random $u \in [0, 1)$. The result count is multiplied by the stack count and must fit the item's stack limit. The [`leafia_dfc`](https://movblock.mov/ntm-next/wiki/cursed/recipe-conditions.md) flag does not gate these conversions.

A row has exactly one item input with count 1, no fluids, and one deterministic item output of any count. `duration` and `power` are accepted and unused.

## Fields

| Field | Meaning and default | Range |
| - | - | - |
| `type` | Selects the `leafia:dfc` 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` |
| `required_flux` | Beam energy that a conversion requires. | `[1, i64::MAX]` |

## Example

Source path: `data/leafia/recipe/dfc/balefire.json`

```json
{
  "type": "leafia:dfc",
  "input_items": [{"ingredient": "hbm:powder_balefire"}],
  "order": 2304,
  "output_items": ["hbm:egg_balefire_shard"],
  "required_flux": 60000000
}
```
