Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mysticsbiomes.core.init;
- import com.mysticsbiomes.core.MysticsBiomes;
- import net.minecraft.core.Holder;
- import net.minecraft.data.BuiltinRegistries;
- import net.minecraft.data.worldgen.placement.VegetationPlacements;
- import net.minecraft.util.random.SimpleWeightedRandomList;
- import net.minecraft.util.valueproviders.ConstantInt;
- import net.minecraft.util.valueproviders.UniformInt;
- import net.minecraft.world.level.block.Blocks;
- import net.minecraft.world.level.block.state.BlockState;
- import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
- import net.minecraft.world.level.levelgen.feature.Feature;
- import net.minecraft.world.level.levelgen.feature.configurations.*;
- import net.minecraft.world.level.levelgen.feature.featuresize.TwoLayersFeatureSize;
- import net.minecraft.world.level.levelgen.feature.foliageplacers.RandomSpreadFoliagePlacer;
- import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider;
- import net.minecraft.world.level.levelgen.feature.stateproviders.WeightedStateProvider;
- import net.minecraft.world.level.levelgen.feature.trunkplacers.BendingTrunkPlacer;
- import net.minecraft.world.level.levelgen.placement.*;
- import java.util.List;
- import static net.minecraft.data.worldgen.placement.PlacementUtils.*;
- public class MysticFeatures {
- public static final Holder<ConfiguredFeature<?, ?>> JACARANDA_TREE = register("jacaranda_tree", Feature.TREE, (new TreeConfiguration.TreeConfigurationBuilder(BlockStateProvider.simple(MysticBlocks.JACARANDA_LOG.get()), new BendingTrunkPlacer(4, 2, 0, 2,UniformInt.of(1, 1)), new WeightedStateProvider(SimpleWeightedRandomList.<BlockState>builder().add(MysticBlocks.JACARANDA_BLOSSOMS.get().defaultBlockState(), 2).add(MysticBlocks.JACARANDA_LEAVES.get().defaultBlockState(), 4)), new RandomSpreadFoliagePlacer(ConstantInt.of(3), ConstantInt.of(0), ConstantInt.of(2), 32), new TwoLayersFeatureSize(1, 0, 1))).build());
- public static final Holder<ConfiguredFeature<?, ?>> LAVENDER = register("lavender", Feature.RANDOM_PATCH, (new RandomPatchConfiguration(182, 9, 9, onlyWhenEmpty(Feature.SIMPLE_BLOCK, new SimpleBlockConfiguration(BlockStateProvider.simple(MysticBlocks.LAVENDER.get()))))));
- public static final Holder<ConfiguredFeature<?, ?>> GRASS = register("grass", Feature.RANDOM_PATCH, (new RandomPatchConfiguration(222, 7, 7, onlyWhenEmpty(Feature.SIMPLE_BLOCK, new SimpleBlockConfiguration(BlockStateProvider.simple(Blocks.GRASS))))));
- /** What's placed in the world generation. */
- public static final Holder<PlacedFeature> TREES_JACARANDA = register("trees_jacaranda", JACARANDA_TREE, VegetationPlacements.treePlacement(RarityFilter.onAverageOnceEvery(4)));
- public static final Holder<PlacedFeature> FLOWERS_LAVENDER = register("flowers_lavender", LAVENDER, VegetationPlacements.worldSurfaceSquaredWithCount(18));
- public static final Holder<PlacedFeature> FOLIAGE_GRASS = register("foliage_grass", GRASS);
- private static <FC extends FeatureConfiguration, F extends Feature<FC>> Holder<ConfiguredFeature<?, ?>> register(String name, F feature, FC config) {
- return BuiltinRegistries.register(BuiltinRegistries.CONFIGURED_FEATURE, MysticsBiomes.modLoc(name), new ConfiguredFeature<>(feature, config));
- }
- private static Holder<PlacedFeature> register(String name, Holder<? extends ConfiguredFeature<?, ?>> configuredFeature, List<PlacementModifier> modifiers) {
- return BuiltinRegistries.register(BuiltinRegistries.PLACED_FEATURE, MysticsBiomes.modLoc(name), new PlacedFeature(Holder.hackyErase(configuredFeature), modifiers));
- }
- private static Holder<PlacedFeature> register(String name, Holder<? extends ConfiguredFeature<?, ?>> configuredFeature, PlacementModifier... modifiers) {
- return register(name, configuredFeature, List.of(modifiers));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement