# Fallout transmutation

Fallout block replacement rules.

File: `data/hbm/hbm/fallout_table/default.json`. Override `hbm:default` to replace the table.

## Example:

```json
{
  "rules": [
    {
      "targets": "#minecraft:mineable/pickaxe",
      "max_distance_percent": 50.0,
      "restrict_depth": true,
      "primary": [{"state": {"Name": "hbm:sellafield_slaked", "Properties": {"shade": "0"}}, "weight": 1}]
    }
  ]
}
```

A fallout cloud walks each column of its radius from the top down. For each block, the rules are tried in list order and the first that converts it wins; three `restrict_depth` conversions, or three solid blocks no rule converted, end the column.

## Fields

| Field | Meaning and default | Range |
| - | - | - |
| `rules` | Ordered replacement rules; the first matching conversion wins. | |
| `rules.targets` (Optional) | Block ID, block tag, or ID list; default every block. | |
| `rules.state` (Optional) | Vanilla state-property predicate. | |
| `rules.must_be_opaque` (Optional) | Restricts matches to occluding blocks; default false. | |
| `rules.restrict_depth` (Optional) | Counts a conversion toward the column stop; default false. | |
| `rules.primary` (Optional) | Weighted outcomes when chance succeeds; default empty. | |
| `rules.secondary` (Optional) | Weighted outcomes when chance fails; default empty. | |
| `rules.primary[].state` | Block state placed by a primary outcome. | |
| `rules.primary[].weight` | Relative selection weight; positive total at most `i32::MAX`. | `[1, i32::MAX]` |
| `rules.secondary[].state` | Block state placed by a secondary outcome. | |
| `rules.secondary[].weight` | Relative selection weight; positive total at most `i32::MAX`. | `[1, i32::MAX]` |
| `rules.chance` (Optional) | Probability of drawing from primary; default 1.0. | `[0, 1]` for a useful probability |
| `rules.min_distance_percent` (Optional) | Inner distance bound; default 0. | `[0, 100]` for a useful distance |
| `rules.max_distance_percent` (Optional) | Outer distance bound; default 100; at least min_distance_percent. | `[0, 100]` for a useful distance |
| `rules.falloff_start` (Optional) | Fraction of the outer bound where conversions thin out; default 0.9. | `[0, 1]` for a useful fraction |
| `rules.preserve` (Optional) | State property names copied from the replaced block; default empty. | |

## Outcomes and conversion limits

> **until NTM 1.0.1**
>
> Weighted selection favors earlier outcomes. With two outcomes of weight 1, the first is always selected.

> **since NTM 1.0.1**
>
> Each outcome is selected with probability proportional to its weight.

Keep each outcome list's total weight at most `i32::MAX`.

A matching rule converts nothing, and later rules are tried, when its outcome is `hbm:sellafield_slaked` or `hbm:sellafield_bedrock` and the current block is the same block with an equal or higher `shade`, when it would replace `hbm:sellafield_bedrock` with another block, or when it would place a block other than `hbm:sellafield_bedrock` at the world's minimum Y.

The shipped rules use `#minecraft:mineable/axe` for wood, `#minecraft:mineable/pickaxe` for rock and metal, and `#minecraft:mineable/shovel` for sand and soil.
