diff --git a/src/generated/resources/data/naturesaura/forge/biome_modifier/aura_bloom.json b/src/generated/resources/data/naturesaura/forge/biome_modifier/aura_bloom.json new file mode 100644 index 00000000..5b2133ae --- /dev/null +++ b/src/generated/resources/data/naturesaura/forge/biome_modifier/aura_bloom.json @@ -0,0 +1,6 @@ +{ + "type": "forge:add_features", + "biomes": "#minecraft:is_overworld", + "features": "naturesaura:aura_bloom", + "step": "vegetal_decoration" +} \ No newline at end of file diff --git a/src/generated/resources/data/naturesaura/forge/biome_modifier/aura_cactus.json b/src/generated/resources/data/naturesaura/forge/biome_modifier/aura_cactus.json new file mode 100644 index 00000000..7a8b4048 --- /dev/null +++ b/src/generated/resources/data/naturesaura/forge/biome_modifier/aura_cactus.json @@ -0,0 +1,6 @@ +{ + "type": "forge:add_features", + "biomes": "#forge:is_sandy", + "features": "naturesaura:aura_cactus", + "step": "vegetal_decoration" +} \ No newline at end of file diff --git a/src/generated/resources/data/naturesaura/forge/biome_modifier/aura_mushroom.json b/src/generated/resources/data/naturesaura/forge/biome_modifier/aura_mushroom.json new file mode 100644 index 00000000..b2ac9789 --- /dev/null +++ b/src/generated/resources/data/naturesaura/forge/biome_modifier/aura_mushroom.json @@ -0,0 +1,6 @@ +{ + "type": "forge:add_features", + "biomes": "#forge:is_mushroom", + "features": "naturesaura:aura_mushroom", + "step": "vegetal_decoration" +} \ No newline at end of file diff --git a/src/generated/resources/data/naturesaura/forge/biome_modifier/crimson_aura_mushroom.json b/src/generated/resources/data/naturesaura/forge/biome_modifier/crimson_aura_mushroom.json new file mode 100644 index 00000000..e3a0f533 --- /dev/null +++ b/src/generated/resources/data/naturesaura/forge/biome_modifier/crimson_aura_mushroom.json @@ -0,0 +1,6 @@ +{ + "type": "forge:add_features", + "biomes": "#minecraft:is_nether", + "features": "naturesaura:crimson_aura_mushroom", + "step": "vegetal_decoration" +} \ No newline at end of file diff --git a/src/generated/resources/data/naturesaura/forge/biome_modifier/warped_aura_mushroom.json b/src/generated/resources/data/naturesaura/forge/biome_modifier/warped_aura_mushroom.json new file mode 100644 index 00000000..b3aad564 --- /dev/null +++ b/src/generated/resources/data/naturesaura/forge/biome_modifier/warped_aura_mushroom.json @@ -0,0 +1,6 @@ +{ + "type": "forge:add_features", + "biomes": "#minecraft:is_nether", + "features": "naturesaura:warped_aura_mushroom", + "step": "vegetal_decoration" +} \ No newline at end of file diff --git a/src/main/java/de/ellpeck/naturesaura/data/BiomeModifiers.java b/src/main/java/de/ellpeck/naturesaura/data/BiomeModifiers.java new file mode 100644 index 00000000..8b0deff4 --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/data/BiomeModifiers.java @@ -0,0 +1,60 @@ +package de.ellpeck.naturesaura.data; + +import de.ellpeck.naturesaura.NaturesAura; +import de.ellpeck.naturesaura.gen.ModFeatures; +import net.minecraft.core.HolderGetter; +import net.minecraft.core.HolderSet; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.worldgen.BootstapContext; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.BiomeTags; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.levelgen.GenerationStep; +import net.minecraft.world.level.levelgen.placement.PlacedFeature; +import net.minecraftforge.common.Tags; +import net.minecraftforge.common.world.BiomeModifier; +import net.minecraftforge.common.world.ForgeBiomeModifiers; +import net.minecraftforge.registries.ForgeRegistries; + +public class BiomeModifiers { + public static ResourceKey AURA_BLOOM = createKey("aura_bloom"); + public static ResourceKey AURA_CACTUS = createKey("aura_cactus"); + public static ResourceKey WARPED_AURA_MUSHROOM = createKey("warped_aura_mushroom"); + public static ResourceKey CRIMSON_AURA_MUSHROOM = createKey("crimson_aura_mushroom"); + public static ResourceKey AURA_MUSHROOM = createKey("aura_mushroom"); + + private static ResourceKey createKey(String id) { + return ResourceKey.create(ForgeRegistries.Keys.BIOME_MODIFIERS, new ResourceLocation(NaturesAura.MOD_ID, id)); + } + + public static void bootstrap(BootstapContext context) { + HolderGetter biomeGetter = context.lookup(Registries.BIOME); + HolderGetter placedGetter = context.lookup(Registries.PLACED_FEATURE); + + context.register(AURA_BLOOM, new ForgeBiomeModifiers.AddFeaturesBiomeModifier( + biomeGetter.getOrThrow(BiomeTags.IS_OVERWORLD), + HolderSet.direct(placedGetter.getOrThrow(ModFeatures.Placed.AURA_BLOOM)), + GenerationStep.Decoration.VEGETAL_DECORATION)); + + context.register(AURA_CACTUS, new ForgeBiomeModifiers.AddFeaturesBiomeModifier( + biomeGetter.getOrThrow(Tags.Biomes.IS_SANDY), + HolderSet.direct(placedGetter.getOrThrow(ModFeatures.Placed.AURA_CACTUS)), + GenerationStep.Decoration.VEGETAL_DECORATION)); + + context.register(AURA_MUSHROOM, new ForgeBiomeModifiers.AddFeaturesBiomeModifier( + biomeGetter.getOrThrow(Tags.Biomes.IS_MUSHROOM), + HolderSet.direct(placedGetter.getOrThrow(ModFeatures.Placed.AURA_MUSHROOM)), + GenerationStep.Decoration.VEGETAL_DECORATION)); + + context.register(CRIMSON_AURA_MUSHROOM, new ForgeBiomeModifiers.AddFeaturesBiomeModifier( + biomeGetter.getOrThrow(BiomeTags.IS_NETHER), + HolderSet.direct(placedGetter.getOrThrow(ModFeatures.Placed.CRIMSON_AURA_MUSHROOM)), + GenerationStep.Decoration.VEGETAL_DECORATION)); + + context.register(WARPED_AURA_MUSHROOM, new ForgeBiomeModifiers.AddFeaturesBiomeModifier( + biomeGetter.getOrThrow(BiomeTags.IS_NETHER), + HolderSet.direct(placedGetter.getOrThrow(ModFeatures.Placed.WARPED_AURA_MUSHROOM)), + GenerationStep.Decoration.VEGETAL_DECORATION)); + } +} diff --git a/src/main/java/de/ellpeck/naturesaura/data/ModData.java b/src/main/java/de/ellpeck/naturesaura/data/ModData.java index 21edd0bc..bfe94347 100644 --- a/src/main/java/de/ellpeck/naturesaura/data/ModData.java +++ b/src/main/java/de/ellpeck/naturesaura/data/ModData.java @@ -43,9 +43,7 @@ public final class ModData { final RegistrySetBuilder registryBuilder = new RegistrySetBuilder(); registryBuilder.add(Registries.CONFIGURED_FEATURE, ModFeatures.Configured::bootstrap); registryBuilder.add(Registries.PLACED_FEATURE, ModFeatures.Placed::bootstrap); - registryBuilder.add(ForgeRegistries.Keys.BIOME_MODIFIERS, context -> { - - }); + registryBuilder.add(ForgeRegistries.Keys.BIOME_MODIFIERS, BiomeModifiers::bootstrap); // We need the BIOME registry to be present, so we can use a biome tag, doesn't matter that it's empty registryBuilder.add(Registries.BIOME, context -> { }); diff --git a/src/main/resources/data/naturesaura/forge/biome_modifier_fixme/aura_bloom.json b/src/main/resources/data/naturesaura/forge/biome_modifier_fixme/aura_bloom.json deleted file mode 100644 index a290296f..00000000 --- a/src/main/resources/data/naturesaura/forge/biome_modifier_fixme/aura_bloom.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type": "forge:add_features", - "biomes": "#forge:is_overworld", - "features": "naturesaura:aura_bloom", - "step": "vegetal_decoration" -} \ No newline at end of file diff --git a/src/main/resources/data/naturesaura/forge/biome_modifier_fixme/aura_cactus.json b/src/main/resources/data/naturesaura/forge/biome_modifier_fixme/aura_cactus.json deleted file mode 100644 index 951d92ac..00000000 --- a/src/main/resources/data/naturesaura/forge/biome_modifier_fixme/aura_cactus.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type": "forge:add_features", - "biomes": "#forge:is_sandy", - "features": "naturesaura:aura_cactus", - "step": "vegetal_decoration" -} \ No newline at end of file diff --git a/src/main/resources/data/naturesaura/forge/biome_modifier_fixme/aura_mushroom.json b/src/main/resources/data/naturesaura/forge/biome_modifier_fixme/aura_mushroom.json deleted file mode 100644 index 15f85f32..00000000 --- a/src/main/resources/data/naturesaura/forge/biome_modifier_fixme/aura_mushroom.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type": "forge:add_features", - "biomes": "#forge:is_mushroom", - "features": "naturesaura:aura_mushroom", - "step": "vegetal_decoration" -} \ No newline at end of file diff --git a/src/main/resources/data/naturesaura/forge/biome_modifier_fixme/crimson_aura_mushroom.json b/src/main/resources/data/naturesaura/forge/biome_modifier_fixme/crimson_aura_mushroom.json deleted file mode 100644 index 60e81816..00000000 --- a/src/main/resources/data/naturesaura/forge/biome_modifier_fixme/crimson_aura_mushroom.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type": "forge:add_features", - "biomes": "#minecraft:is_nether", - "features": "naturesaura:crimson_aura_mushroom", - "step": "vegetal_decoration" -} \ No newline at end of file diff --git a/src/main/resources/data/naturesaura/forge/biome_modifier_fixme/warped_aura_mushroom.json b/src/main/resources/data/naturesaura/forge/biome_modifier_fixme/warped_aura_mushroom.json deleted file mode 100644 index 94ecf74f..00000000 --- a/src/main/resources/data/naturesaura/forge/biome_modifier_fixme/warped_aura_mushroom.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type": "forge:add_features", - "biomes": "#minecraft:is_nether", - "features": "naturesaura:warped_aura_mushroom", - "step": "vegetal_decoration" -} \ No newline at end of file