# hbmspace:substitute

Surface rule replacing chosen results of another rule.

The rule runs `rule` and replaces a result equal to a `from` state with its `to` state; other results pass unchanged. A repeated `from` uses its last entry.

## Fields

| Field | Meaning and default |
| - | - |
| `type` | `hbmspace:substitute`. |
| `rule` | Material rule of any type. |
| `replacements` | List of state replacements. |
| `replacements.from` | Exact state to replace. |
| `replacements.from.id` | Registered block ID. |
| `replacements.from.properties` (Optional) | Block-state property names and string values. |
| `replacements.to` | Replacement state. |
| `replacements.to.id` | Registered block ID. |
| `replacements.to.properties` (Optional) | Block-state property names and string values. |

## Example

From `data/hbmspace/worldgen/noise_settings/duna.json`:

```json
{
  "type": "hbmspace:substitute",
  "replacements": [
    {
      "from": "minecraft:terracotta",
      "to": "hbmspace:duna_rock"
    },
    {
      "from": "minecraft:orange_terracotta",
      "to": "minecraft:red_terracotta"
    },
    {
      "from": "minecraft:yellow_terracotta",
      "to": "minecraft:red_terracotta"
    },
    {
      "from": "minecraft:brown_terracotta",
      "to": "minecraft:red_terracotta"
    },
    {
      "from": "minecraft:white_terracotta",
      "to": "minecraft:red_terracotta"
    },
    {
      "from": "minecraft:light_gray_terracotta",
      "to": "minecraft:red_terracotta"
    }
  ],
  "rule": {
    "type": "minecraft:bandlands"
  }
}
```
