Implemented biome modifiers.
This commit is contained in:
@ -1,10 +1,18 @@
|
||||
package dev.micle.wildflowers_backport.worldgen;
|
||||
|
||||
import dev.micle.wildflowers_backport.WildflowersBackport;
|
||||
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.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.biome.Biomes;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
import net.minecraftforge.common.world.BiomeModifier;
|
||||
import net.minecraftforge.common.world.ForgeBiomeModifiers;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class ModBiomeModifiers {
|
||||
@ -12,7 +20,20 @@ public class ModBiomeModifiers {
|
||||
public static final ResourceKey<BiomeModifier> ADD_WILDFLOWERS_BIRCH_FOREST = registerKey("add_wildflowers_birch_forest");
|
||||
|
||||
public static void bootstrap(BootstapContext<BiomeModifier> context) {
|
||||
HolderGetter<PlacedFeature> placedFeatures = context.lookup(Registries.PLACED_FEATURE);
|
||||
HolderGetter<Biome> biomes = context.lookup(Registries.BIOME);
|
||||
|
||||
context.register(ADD_WILDFLOWERS_MEADOW, new ForgeBiomeModifiers.AddFeaturesBiomeModifier(
|
||||
HolderSet.direct(biomes.getOrThrow(Biomes.MEADOW)),
|
||||
HolderSet.direct(placedFeatures.getOrThrow(ModPlacedFeatures.WILDFLOWERS_MEADOW)),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION
|
||||
));
|
||||
|
||||
context.register(ADD_WILDFLOWERS_BIRCH_FOREST, new ForgeBiomeModifiers.AddFeaturesBiomeModifier(
|
||||
HolderSet.direct(biomes.getOrThrow(Biomes.BIRCH_FOREST), biomes.getOrThrow(Biomes.OLD_GROWTH_BIRCH_FOREST)),
|
||||
HolderSet.direct(placedFeatures.getOrThrow(ModPlacedFeatures.WILDFLOWERS_BIRCH_FOREST)),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION
|
||||
));
|
||||
}
|
||||
|
||||
private static ResourceKey<BiomeModifier> registerKey(String name) {
|
||||
|
||||
Reference in New Issue
Block a user