Advertisement
jayhillx

ModFeatures

Dec 9th, 2020
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.30 KB | None | 0 0
  1. import net.minecraft.block.BlockState;
  2. import net.minecraft.util.registry.Registry;
  3. import net.minecraft.util.registry.WorldGenRegistries;
  4. import net.minecraft.world.gen.Heightmap;
  5. import net.minecraft.world.gen.blockplacer.SimpleBlockPlacer;
  6. import net.minecraft.world.gen.blockstateprovider.SimpleBlockStateProvider;
  7. import net.minecraft.world.gen.feature.*;
  8. import net.minecraft.world.gen.foliageplacer.BlobFoliagePlacer;
  9. import net.minecraft.world.gen.foliageplacer.FancyFoliagePlacer;
  10. import net.minecraft.world.gen.placement.AtSurfaceWithExtraConfig;
  11. import net.minecraft.world.gen.placement.Placement;
  12. import net.minecraft.world.gen.trunkplacer.FancyTrunkPlacer;
  13. import net.minecraft.world.gen.trunkplacer.StraightTrunkPlacer;
  14.  
  15. import java.util.OptionalInt;
  16.  
  17. public class ModFeatures {
  18.  
  19. //Trees
  20. 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()));
  21. 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()));
  22. 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()));
  23.  
  24. //Fancy Trees
  25. 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()));
  26. 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()));
  27. 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()));
  28.  
  29. //Plants
  30. public static final BlockState STRAWBERRY_BUSH = ModBlocks.STRAWBERRY_BUSH.get().getDefaultState();
  31. public static final BlockClusterFeatureConfig STRAWBERRY_BUSH_CONFIG = (new BlockClusterFeatureConfig.Builder(new SimpleBlockStateProvider(STRAWBERRY_BUSH), new SimpleBlockPlacer())).tries(32).build();
  32.  
  33. //Flowers
  34. public static final BlockState LAVENDER = ModBlocks.LAVENDER.get().getDefaultState();
  35. public static final BlockState WHITE_DAISY_BUSH = ModBlocks.WHITE_DAISY_BUSH.get().getDefaultState();
  36. public static final BlockState PINK_DAISY_BUSH = ModBlocks.PINK_DAISY_BUSH.get().getDefaultState();
  37. public static final BlockClusterFeatureConfig LAVENDER_CONFIG = (new BlockClusterFeatureConfig.Builder(new SimpleBlockStateProvider(LAVENDER), new SimpleBlockPlacer())).tries(16).build();
  38. public static final BlockClusterFeatureConfig WHITE_DAISY_BUSH_CONFIG = (new BlockClusterFeatureConfig.Builder(new SimpleBlockStateProvider(WHITE_DAISY_BUSH), new SimpleBlockPlacer())).tries(16).build();
  39. public static final BlockClusterFeatureConfig PINK_DAISY_BUSH_CONFIG = (new BlockClusterFeatureConfig.Builder(new SimpleBlockStateProvider(PINK_DAISY_BUSH), new SimpleBlockPlacer())).tries(16).build();
  40.  
  41.  
  42. //Configure
  43. 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))));
  44. 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))));
  45. 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))));
  46. 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))));
  47. 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))));
  48. 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))));
  49.  
  50. private static <FC extends IFeatureConfig> ConfiguredFeature<FC, ?> register(String key, ConfiguredFeature<FC, ?> configuredFeature) {
  51. return Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, key, configuredFeature);
  52. }
  53. }
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement