Implemented placed features.
This commit is contained in:
@ -2,13 +2,14 @@ package dev.micle.wildflowers_backport.worldgen;
|
|||||||
|
|
||||||
import dev.micle.wildflowers_backport.WildflowersBackport;
|
import dev.micle.wildflowers_backport.WildflowersBackport;
|
||||||
import net.minecraft.core.Holder;
|
import net.minecraft.core.Holder;
|
||||||
|
import net.minecraft.core.HolderGetter;
|
||||||
import net.minecraft.core.registries.Registries;
|
import net.minecraft.core.registries.Registries;
|
||||||
import net.minecraft.data.worldgen.BootstapContext;
|
import net.minecraft.data.worldgen.BootstapContext;
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.level.levelgen.Heightmap;
|
||||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
import net.minecraft.world.level.levelgen.placement.*;
|
||||||
import net.minecraft.world.level.levelgen.placement.PlacementModifier;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -17,7 +18,22 @@ public class ModPlacedFeatures {
|
|||||||
public static final ResourceKey<PlacedFeature> WILDFLOWERS_BIRCH_FOREST = registerKey("wildflowers_birch_forest");
|
public static final ResourceKey<PlacedFeature> WILDFLOWERS_BIRCH_FOREST = registerKey("wildflowers_birch_forest");
|
||||||
|
|
||||||
public static void bootstrap(BootstapContext<PlacedFeature> context) {
|
public static void bootstrap(BootstapContext<PlacedFeature> context) {
|
||||||
|
HolderGetter<ConfiguredFeature<?, ?>> configuredFeatures = context.lookup(Registries.CONFIGURED_FEATURE);
|
||||||
|
|
||||||
|
register(context, WILDFLOWERS_MEADOW, configuredFeatures.getOrThrow(ModConfiguredFeatures.WILDFLOWERS_MEADOW), List.of(
|
||||||
|
NoiseThresholdCountPlacement.of(-0.8, 5, 10),
|
||||||
|
InSquarePlacement.spread(),
|
||||||
|
HeightmapPlacement.onHeightmap(Heightmap.Types.MOTION_BLOCKING),
|
||||||
|
BiomeFilter.biome()
|
||||||
|
));
|
||||||
|
|
||||||
|
register(context, WILDFLOWERS_BIRCH_FOREST, configuredFeatures.getOrThrow(ModConfiguredFeatures.WILDFLOWERS_BIRCH_FOREST), List.of(
|
||||||
|
CountPlacement.of(3),
|
||||||
|
RarityFilter.onAverageOnceEvery(2),
|
||||||
|
InSquarePlacement.spread(),
|
||||||
|
HeightmapPlacement.onHeightmap(Heightmap.Types.MOTION_BLOCKING),
|
||||||
|
BiomeFilter.biome()
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ResourceKey<PlacedFeature> registerKey(String name) {
|
private static ResourceKey<PlacedFeature> registerKey(String name) {
|
||||||
|
|||||||
Reference in New Issue
Block a user