# Radiation profiles

Split item radiation into channels and add hazards by tag or item.

File: `data/<namespace>/leafia/radiation_profile/<path>.json`. The registry loads with the world and syncs to clients. Profiles apply after NTM's code hazards and [`hbm:hazard`](https://movblock.mov/ntm-next/26.3/wiki/hazards-and-radiation/item-hazards.md) bindings, before the hazard tables publish.

## Fields

| Field | Meaning and default | Range |
| - | - | - |
| `targets` | Item ID, `#namespace:tag`, or item-ID list. | |
| `radiation` (Optional) | Radiation spectrum replacing the target's first `hbm:radiation` entry; applies while [`enable_rad_classification`](https://movblock.mov/ntm-next/26.3/wiki/cursed/settings/hazard_config.md) is `true`. | |
| `radiation.alpha` (Optional) | Level of the `leafia:alpha` entry; default 0. | `[0, f64::MAX]` |
| `radiation.beta` (Optional) | Level of the `leafia:beta` entry; default 0. | `[0, f64::MAX]` |
| `radiation.xray` (Optional) | Level of the `leafia:xray` entry; default 0. | `[0, f64::MAX]` |
| `radiation.gamma` (Optional) | Level of the `leafia:gamma` entry; default 0. | `[0, f64::MAX]` |
| `radiation.neutrons` (Optional) | Level of the `leafia:neutrons` entry; default 0. | `[0, f64::MAX]` |
| `radiation.radon` (Optional) | Level of the `leafia:radon` entry; default 0. | `[0, f64::MAX]` |
| `radiation.activation` (Optional) | Level of a replacement `hbm:radiation` entry; default 0. | `[0, f64::MAX]` |
| `additions` (Optional) | Hazard entries appended to the target's data, after the spectrum; default empty. | |
| `additions.type` | Registered hazard behavior. | |
| `additions.level` | Base intensity interpreted by that hazard type. | finite `f64` |
| `base_tag` (Optional) | Item tag ID without `#`. A tag target without hazard data starts from this tag's data, as it was before any profile applied. | |
| `mutex` (Optional) | Replaces the data's mutex bits. | `i32` |

Unknown fields are ignored. A profile with neither an applicable `radiation` nor `additions` changes nothing.

## Application

A profile copies the target's hazard data, keeping its mutex and priority. With an applicable `radiation`, it removes the first `hbm:radiation` entry and adds one entry for each nonzero channel. Each channel entry reads the stack's `minecraft:custom_data` keys `<channel>_abs`, an absolute level, and `<channel>_mod`, a multiplier. `additions` follow, then `mutex` if present.

A tag target without data starts from `base_tag`'s data, or from new data with mutex 1. An item target without data starts from new data with mutex 0. NTM then folds an item's hazard data as described in [Item hazards](https://movblock.mov/ntm-next/26.3/wiki/hazards-and-radiation/item-hazards.md): data whose mutex bits overlap bits already taken is skipped.

Two profiles naming the same tag, or the same item among item targets, stop the world from loading. To neutralize a shipped profile, override its resource ID with the same `targets` and no `radiation` or `additions`.

Shipped profiles use the IDs `leafia:tag/<tag-namespace>/<tag-path>` and `leafia:item/<item-namespace>/<item-path>`. The resource ID has no other effect.

## Examples

`data/leafia/leafia/radiation_profile/tag/c/crystals/francium.json`:

```json
{"additions": [{"type": "leafia:alkaline", "level": 6.0}], "radiation": {"alpha": 1500000.0, "gamma": 14000000.0}, "targets": "#c:crystals/francium"}
```

`data/leafia/leafia/radiation_profile/tag/c/crystals/neptunium.json` inherits from the canonical isotope tag:

```json
{"base_tag": "c:crystals/neptunium_237", "radiation": {"alpha": 25.0}, "targets": "#c:crystals/neptunium"}
```
