Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import net.minecraft.block.BlockState;
- import net.minecraft.util.registry.Registry;
- import net.minecraft.util.registry.WorldGenRegistries;
- import net.minecraft.world.gen.Heightmap;
- import net.minecraft.world.gen.blockplacer.SimpleBlockPlacer;
- import net.minecraft.world.gen.blockstateprovider.SimpleBlockStateProvider;
- import net.minecraft.world.gen.feature.*;
- import net.minecraft.world.gen.foliageplacer.BlobFoliagePlacer;
- import net.minecraft.world.gen.foliageplacer.FancyFoliagePlacer;
- import net.minecraft.world.gen.placement.AtSurfaceWithExtraConfig;
- import net.minecraft.world.gen.placement.Placement;
- import net.minecraft.world.gen.trunkplacer.FancyTrunkPlacer;
- import net.minecraft.world.gen.trunkplacer.StraightTrunkPlacer;
- import java.util.OptionalInt;
- public class ModFeatures {
- //Trees
- public static final ConfiguredFeature<BaseTreeFeatureConfig, ?> LAVENDER_BLOSSOM_TREE = register("strawberry_blossom_tree", Feature.TREE.withConfiguration((new BaseTreeFeatureConfig.Builder(new SimpleBlockStateProvider(ModBlocks.LAVENDER_LOG.get().getDefaultState()), new SimpleBlockStateProvider(ModBlocks.LAVENDER_BLOSSOM_LEAVES.get().getDefaultState()), new BlobFoliagePlacer(FeatureSpread.func_242252_a(2), FeatureSpread.func_242252_a(0), 3), new StraightTrunkPlacer(4, 2, 0), new TwoLayerFeature(1, 0, 1))).setIgnoreVines().build()));
- public static final ConfiguredFeature<BaseTreeFeatureConfig, ?> STRAWBERRY_BLOSSOM_TREE = register("strawberry_blossom_tree", Feature.TREE.withConfiguration((new BaseTreeFeatureConfig.Builder(new SimpleBlockStateProvider(ModBlocks.STRAWBERRY_LOG.get().getDefaultState()), new SimpleBlockStateProvider(ModBlocks.STRAWBERRY_BLOSSOM_LEAVES.get().getDefaultState()), new BlobFoliagePlacer(FeatureSpread.func_242252_a(2), FeatureSpread.func_242252_a(0), 3), new StraightTrunkPlacer(4, 2, 0), new TwoLayerFeature(1, 0, 1))).setIgnoreVines().build()));
- public static final ConfiguredFeature<BaseTreeFeatureConfig, ?> SWEET_BLOSSOM_TREE = register("strawberry_blossom_tree", Feature.TREE.withConfiguration((new BaseTreeFeatureConfig.Builder(new SimpleBlockStateProvider(ModBlocks.STRAWBERRY_LOG.get().getDefaultState()), new SimpleBlockStateProvider(ModBlocks.SWEET_BLOSSOM_LEAVES.get().getDefaultState()), new BlobFoliagePlacer(FeatureSpread.func_242252_a(2), FeatureSpread.func_242252_a(0), 3), new StraightTrunkPlacer(4, 2, 0), new TwoLayerFeature(1, 0, 1))).setIgnoreVines().build()));
- //Fancy Trees
- public static final ConfiguredFeature<BaseTreeFeatureConfig, ?> FANCY_LAVENDER_BLOSSOM_TREE = register("fancy_strawberry_blossom_tree", Feature.TREE.withConfiguration((new BaseTreeFeatureConfig.Builder(new SimpleBlockStateProvider(ModBlocks.LAVENDER_LOG.get().getDefaultState()), new SimpleBlockStateProvider(ModBlocks.LAVENDER_BLOSSOM_LEAVES.get().getDefaultState()), new FancyFoliagePlacer(FeatureSpread.func_242252_a(2), FeatureSpread.func_242252_a(4), 4), new FancyTrunkPlacer(3, 11, 0), new TwoLayerFeature(0, 0, 0, OptionalInt.of(4)))).setIgnoreVines().func_236702_a_(Heightmap.Type.MOTION_BLOCKING).build()));
- public static final ConfiguredFeature<BaseTreeFeatureConfig, ?> FANCY_STRAWBERRY_BLOSSOM_TREE = register("fancy_strawberry_blossom_tree", Feature.TREE.withConfiguration((new BaseTreeFeatureConfig.Builder(new SimpleBlockStateProvider(ModBlocks.STRAWBERRY_LOG.get().getDefaultState()), new SimpleBlockStateProvider(ModBlocks.STRAWBERRY_BLOSSOM_LEAVES.get().getDefaultState()), new FancyFoliagePlacer(FeatureSpread.func_242252_a(2), FeatureSpread.func_242252_a(4), 4), new FancyTrunkPlacer(3, 11, 0), new TwoLayerFeature(0, 0, 0, OptionalInt.of(4)))).setIgnoreVines().func_236702_a_(Heightmap.Type.MOTION_BLOCKING).build()));
- public static final ConfiguredFeature<BaseTreeFeatureConfig, ?> FANCY_SWEET_BLOSSOM_TREE = register("fancy_strawberry_blossom_tree", Feature.TREE.withConfiguration((new BaseTreeFeatureConfig.Builder(new SimpleBlockStateProvider(ModBlocks.STRAWBERRY_LOG.get().getDefaultState()), new SimpleBlockStateProvider(ModBlocks.SWEET_BLOSSOM_LEAVES.get().getDefaultState()), new FancyFoliagePlacer(FeatureSpread.func_242252_a(2), FeatureSpread.func_242252_a(4), 4), new FancyTrunkPlacer(3, 11, 0), new TwoLayerFeature(0, 0, 0, OptionalInt.of(4)))).setIgnoreVines().func_236702_a_(Heightmap.Type.MOTION_BLOCKING).build()));
- //Plants
- public static final BlockState STRAWBERRY_BUSH = ModBlocks.STRAWBERRY_BUSH.get().getDefaultState();
- public static final BlockClusterFeatureConfig STRAWBERRY_BUSH_CONFIG = (new BlockClusterFeatureConfig.Builder(new SimpleBlockStateProvider(STRAWBERRY_BUSH), new SimpleBlockPlacer())).tries(32).build();
- //Flowers
- public static final BlockState LAVENDER = ModBlocks.LAVENDER.get().getDefaultState();
- public static final BlockState WHITE_DAISY_BUSH = ModBlocks.WHITE_DAISY_BUSH.get().getDefaultState();
- public static final BlockState PINK_DAISY_BUSH = ModBlocks.PINK_DAISY_BUSH.get().getDefaultState();
- public static final BlockClusterFeatureConfig LAVENDER_CONFIG = (new BlockClusterFeatureConfig.Builder(new SimpleBlockStateProvider(LAVENDER), new SimpleBlockPlacer())).tries(16).build();
- public static final BlockClusterFeatureConfig WHITE_DAISY_BUSH_CONFIG = (new BlockClusterFeatureConfig.Builder(new SimpleBlockStateProvider(WHITE_DAISY_BUSH), new SimpleBlockPlacer())).tries(16).build();
- public static final BlockClusterFeatureConfig PINK_DAISY_BUSH_CONFIG = (new BlockClusterFeatureConfig.Builder(new SimpleBlockStateProvider(PINK_DAISY_BUSH), new SimpleBlockPlacer())).tries(16).build();
- //Configure
- public static final ConfiguredFeature<?, ?> TREES_STRAWBERRY = register("trees_strawberry", STRAWBERRY_BLOSSOM_TREE.withPlacement(Features.Placements.HEIGHTMAP_PLACEMENT).withPlacement(Placement.COUNT_EXTRA.configure(new AtSurfaceWithExtraConfig(1, 0F, 0))));
- public static final ConfiguredFeature<?, ?> TREES_FANCY_STRAWBERRY = register("trees_fancy_strawberry", STRAWBERRY_BLOSSOM_TREE.withPlacement(Features.Placements.HEIGHTMAP_PLACEMENT).withPlacement(Placement.COUNT_EXTRA.configure(new AtSurfaceWithExtraConfig(1, 0F, 0))));
- public static final ConfiguredFeature<?, ?> TREES_SWEET = register("trees_sweet", SWEET_BLOSSOM_TREE.withPlacement(Features.Placements.HEIGHTMAP_PLACEMENT).withPlacement(Placement.COUNT_EXTRA.configure(new AtSurfaceWithExtraConfig(1, 0F, 0))));
- public static final ConfiguredFeature<?, ?> TREES_FANCY_SWEET = register("trees_fancy_sweet", FANCY_SWEET_BLOSSOM_TREE.withPlacement(Features.Placements.HEIGHTMAP_PLACEMENT).withPlacement(Placement.COUNT_EXTRA.configure(new AtSurfaceWithExtraConfig(1, 0F, 0))));
- public static final ConfiguredFeature<?, ?> TREES_LAVENDER = register("trees_lavender", LAVENDER_BLOSSOM_TREE.withPlacement(Features.Placements.HEIGHTMAP_PLACEMENT).withPlacement(Placement.COUNT_EXTRA.configure(new AtSurfaceWithExtraConfig(1, 0F, 0))));
- public static final ConfiguredFeature<?, ?> TREES_FANCY_LAVENDER = register("trees_fancy_lavender", FANCY_LAVENDER_BLOSSOM_TREE.withPlacement(Features.Placements.HEIGHTMAP_PLACEMENT).withPlacement(Placement.COUNT_EXTRA.configure(new AtSurfaceWithExtraConfig(1, 0F, 0))));
- private static <FC extends IFeatureConfig> ConfiguredFeature<FC, ?> register(String key, ConfiguredFeature<FC, ?> configuredFeature) {
- return Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, key, configuredFeature);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement