Skip to content

Commit

Permalink
add datagen
Browse files Browse the repository at this point in the history
  • Loading branch information
TelepathicGrunt committed Nov 2, 2024
1 parent 8e7d21c commit 6c5b148
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/worldgen/biomemodifier.md
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,19 @@ There may be times when a biome modifier needs to target a biome that is not alw

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

1 comment on commit 6c5b148

@neoforged-pages-deployments
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploying with Cloudflare Pages

Name Result
Last commit: 6c5b148ce668558ade2ee49a75ec001073dffffb
Status: ✅ Deploy successful!
Preview URL: https://83dca30b.neoforged-docs-previews.pages.dev
PR Preview URL: https://pr-189.neoforged-docs-previews.pages.dev

Please sign in to comment.