From 6c5b148ce668558ade2ee49a75ec001073dffffb Mon Sep 17 00:00:00 2001 From: TelepathicGrunt <40846040+TelepathicGrunt@users.noreply.github.com> Date: Sat, 2 Nov 2024 17:46:54 -0400 Subject: [PATCH] add datagen --- docs/worldgen/biomemodifier.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/worldgen/biomemodifier.md b/docs/worldgen/biomemodifier.md index 0b6db5d9..c8ec56a2 100644 --- a/docs/worldgen/biomemodifier.md +++ b/docs/worldgen/biomemodifier.md @@ -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 subclass +// Assume we have some example TagKey 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