Skip to content

Commit

Permalink
Mention how to target unregistered biomes (#189)
Browse files Browse the repository at this point in the history
Co-authored-by: IchHabeHunger54 <[email protected]>
  • Loading branch information
TelepathicGrunt and IchHabeHunger54 authored Nov 16, 2024
1 parent 7fe01bd commit 26aac82
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions docs/worldgen/biomemodifier.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ Biome Modifiers are a data-driven system that allows for changing many aspects o
- [Applying Biome Modifiers](#applying-biome-modifiers)
- [Built-in Neoforge Biome Modifiers](#built-in-biome-modifiers)
- [Datagenning Biome Modifiers](#datagenning-biome-modifiers)
- [Targeting Biomes That May Not Exist](#targeting-biomes-that-may-not-exist)


- Modders who want to do custom or complex biome modifications:
- [Applying Biome Modifiers](#applying-biome-modifiers)
- [Creating Custom Biome Modifiers](#creating-custom-biome-modifiers)
- [Datagenning Biome Modifiers](#datagenning-biome-modifiers)
- [Targeting Biomes That May Not Exist](#targeting-biomes-that-may-not-exist)


## Applying Biome Modifiers
Expand Down Expand Up @@ -677,6 +679,37 @@ This will then result in the following JSON being created:
}
```

## Targeting Biomes That May Not Exist

There may be times when a biome modifier needs to target a biome that is not always present in the game. If a biome modifier targets the unregistered biome directly, it will crash on world loading. The way to work around this is to create a biome tag and add the target biome as an optional tag entry by setting required to false for the entry. An example is below:

```json5
{
"replace": false,
"values": [
{
"id": "minecraft:pale_garden",
"required": false
}
]
}
```

Using that biome tag for a biome modifier will now not crash if the biome is not registered. A use case for this is the Pale Garden biome in 1.21.3. That biome is only created when you turn on the Winter Drop datapack in-game. Otherwise, the biome does not exist in the biome registry at all. Another use case can be to target modded biomes while still functioning when the mods adding these biomes are not present.

To datagen optional entries for biome tags, the datagen code would look something along these lines:

```json5
// In a TagsProvider<Biome> subclass
// Assume we have some example TagKey<Biome> OPTIONAL_BIOMES_TAG
@Override
protected void addTags(HolderLookup.Provider registries) {
this.tag(OPTIONAL_BIOMES_TAG)
// Must be a ResourceLocation representing the registry object
.addOptional(WinterDropBiomes.PALE_GARDEN.location());
}
```

[datareg]: ../concepts/registries.md#datapack-registries
[staticreg]: ../concepts/registries.md#methods-for-registering
[datapacks]: ../resources/index.md#data
Expand Down

0 comments on commit 26aac82

Please sign in to comment.