Setup for placed features.
This commit is contained in:
@ -0,0 +1,35 @@
|
|||||||
|
package dev.micle.wildflowers_backport.worldgen;
|
||||||
|
|
||||||
|
import dev.micle.wildflowers_backport.WildflowersBackport;
|
||||||
|
import net.minecraft.core.Holder;
|
||||||
|
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.levelgen.feature.ConfiguredFeature;
|
||||||
|
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||||
|
import net.minecraft.world.level.levelgen.placement.PlacementModifier;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ModPlacedFeatures {
|
||||||
|
public static final ResourceKey<PlacedFeature> WILDFLOWERS_MEADOW = registerKey("wildflowers_meadow");
|
||||||
|
public static final ResourceKey<PlacedFeature> WILDFLOWERS_BIRCH_FOREST = registerKey("wildflowers_birch_forest");
|
||||||
|
|
||||||
|
public static void bootstrap(BootstapContext<PlacedFeature> context) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ResourceKey<PlacedFeature> registerKey(String name) {
|
||||||
|
return ResourceKey.create(Registries.PLACED_FEATURE, ResourceLocation.fromNamespaceAndPath(WildflowersBackport.MOD_ID, name));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void register(
|
||||||
|
BootstapContext<PlacedFeature> context,
|
||||||
|
ResourceKey<PlacedFeature> key,
|
||||||
|
Holder<ConfiguredFeature<?, ?>> featureHolder,
|
||||||
|
List<PlacementModifier> modifiers
|
||||||
|
) {
|
||||||
|
context.register(key, new PlacedFeature(featureHolder, List.copyOf(modifiers)));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user