| 1 | package net.minecraft.data.worldgen.features;
|
| 2 |
|
| 3 | import java.util.List;
|
| 4 | import net.minecraft.core.CompositeDirection;
|
| 5 | import net.minecraft.core.Direction;
|
| 6 | import net.minecraft.core.Holder;
|
| 7 | import net.minecraft.core.HolderGetter;
|
| 8 | import net.minecraft.core.HolderSet;
|
| 9 | import net.minecraft.core.registries.Registries;
|
| 10 | import net.minecraft.data.worldgen.BlockStateProviders;
|
| 11 | import net.minecraft.data.worldgen.BootstrapContext;
|
| 12 | import net.minecraft.data.worldgen.placement.PlacementUtils;
|
| 13 | import net.minecraft.data.worldgen.placement.TreePlacements;
|
| 14 | import net.minecraft.resources.ResourceKey;
|
| 15 | import net.minecraft.tags.BlockTags;
|
| 16 | import net.minecraft.util.random.Weighted;
|
| 17 | import net.minecraft.util.random.WeightedList;
|
| 18 | import net.minecraft.util.valueproviders.BiasedToBottomInt;
|
| 19 | import net.minecraft.util.valueproviders.ConstantInt;
|
| 20 | import net.minecraft.util.valueproviders.IntProvider;
|
| 21 | import net.minecraft.util.valueproviders.UniformInt;
|
| 22 | import net.minecraft.util.valueproviders.WeightedListInt;
|
| 23 | import net.minecraft.world.level.block.Block;
|
| 24 | import net.minecraft.world.level.block.Blocks;
|
| 25 | import net.minecraft.world.level.block.FlowerBedBlock;
|
| 26 | import net.minecraft.world.level.block.LeafLitterBlock;
|
| 27 | import net.minecraft.world.level.block.SweetBerryBushBlock;
|
| 28 | import net.minecraft.world.level.block.state.BlockState;
|
| 29 | import net.minecraft.world.level.block.state.properties.EnumProperty;
|
| 30 | import net.minecraft.world.level.block.state.properties.IntegerProperty;
|
| 31 | import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate;
|
| 32 | import net.minecraft.world.level.levelgen.feature.BambooFeature;
|
| 33 | import net.minecraft.world.level.levelgen.feature.BlockColumnFeature;
|
| 34 | import net.minecraft.world.level.levelgen.feature.Feature;
|
| 35 | import net.minecraft.world.level.levelgen.feature.RandomBooleanSelectorFeature;
|
| 36 | import net.minecraft.world.level.levelgen.feature.RandomSelectorFeature;
|
| 37 | import net.minecraft.world.level.levelgen.feature.SimpleBlockFeature;
|
| 38 | import net.minecraft.world.level.levelgen.feature.SimpleRandomSelectorFeature;
|
| 39 | import net.minecraft.world.level.levelgen.feature.VegetationPatchFeature;
|
| 40 | import net.minecraft.world.level.levelgen.feature.VinesFeature;
|
| 41 | import net.minecraft.world.level.levelgen.feature.WeightedPlacedFeature;
|
| 42 | import net.minecraft.world.level.levelgen.feature.WeightedRandomSelectorFeature;
|
| 43 | import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider;
|
| 44 | import net.minecraft.world.level.levelgen.feature.stateproviders.WeightedStateProvider;
|
| 45 | import net.minecraft.world.level.levelgen.placement.BlockPredicateFilter;
|
| 46 | import net.minecraft.world.level.levelgen.placement.CaveSurface;
|
| 47 | import net.minecraft.world.level.levelgen.placement.CountPlacement;
|
| 48 | import net.minecraft.world.level.levelgen.placement.OffsetPlacement;
|
| 49 | import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
| 50 | import net.minecraft.world.level.material.Fluids;
|
| 51 |
|
| 52 | public class VegetationFeatures {
|
| 53 | public static final ResourceKey<Feature> BAMBOO_NO_PODZOL = FeatureUtils.createKey("bamboo_no_podzol");
|
| 54 | public static final ResourceKey<Feature> BAMBOO_SOME_PODZOL = FeatureUtils.createKey("bamboo_some_podzol");
|
| 55 | public static final ResourceKey<Feature> VINES = FeatureUtils.createKey("vines");
|
| 56 | public static final ResourceKey<Feature> BROWN_MUSHROOM = FeatureUtils.createKey("brown_mushroom");
|
| 57 | public static final ResourceKey<Feature> RED_MUSHROOM = FeatureUtils.createKey("red_mushroom");
|
| 58 | public static final ResourceKey<Feature> SUNFLOWER = FeatureUtils.createKey("sunflower");
|
| 59 | public static final ResourceKey<Feature> PUMPKIN = FeatureUtils.createKey("pumpkin");
|
| 60 | public static final ResourceKey<Feature> BERRY_BUSH = FeatureUtils.createKey("berry_bush");
|
| 61 | public static final ResourceKey<Feature> TAIGA_GRASS = FeatureUtils.createKey("taiga_grass");
|
| 62 | public static final ResourceKey<Feature> GRASS = FeatureUtils.createKey("grass");
|
| 63 | public static final ResourceKey<Feature> GRASS_JUNGLE = FeatureUtils.createKey("grass_jungle");
|
| 64 | public static final ResourceKey<Feature> DEAD_BUSH = FeatureUtils.createKey("dead_bush");
|
| 65 | public static final ResourceKey<Feature> DRY_GRASS = FeatureUtils.createKey("dry_grass");
|
| 66 | public static final ResourceKey<Feature> MELON = FeatureUtils.createKey("melon");
|
| 67 | public static final ResourceKey<Feature> WATERLILY = FeatureUtils.createKey("waterlily");
|
| 68 | public static final ResourceKey<Feature> TALL_GRASS = FeatureUtils.createKey("tall_grass");
|
| 69 | public static final ResourceKey<Feature> LARGE_FERN = FeatureUtils.createKey("large_fern");
|
| 70 | public static final ResourceKey<Feature> BUSH = FeatureUtils.createKey("bush");
|
| 71 | public static final ResourceKey<Feature> RED_SHRUB = FeatureUtils.createKey("red_shrub");
|
| 72 | public static final ResourceKey<Feature> LEAF_LITTER = FeatureUtils.createKey("leaf_litter");
|
| 73 | public static final ResourceKey<Feature> FIREFLY_BUSH = FeatureUtils.createKey("firefly_bush");
|
| 74 | public static final ResourceKey<Feature> CACTUS = FeatureUtils.createKey("cactus");
|
| 75 | public static final ResourceKey<Feature> SUGAR_CANE = FeatureUtils.createKey("sugar_cane");
|
| 76 | public static final ResourceKey<Feature> FLOWER_DEFAULT = FeatureUtils.createKey("flower_default");
|
| 77 | public static final ResourceKey<Feature> FLOWER_FLOWER_FOREST = FeatureUtils.createKey("flower_flower_forest");
|
| 78 | public static final ResourceKey<Feature> FLOWER_SWAMP = FeatureUtils.createKey("flower_swamp");
|
| 79 | public static final ResourceKey<Feature> FLOWER_PLAIN = FeatureUtils.createKey("flower_plain");
|
| 80 | public static final ResourceKey<Feature> FLOWER_MEADOW = FeatureUtils.createKey("flower_meadow");
|
| 81 | public static final ResourceKey<Feature> FLOWER_CHERRY = FeatureUtils.createKey("flower_cherry");
|
| 82 | public static final ResourceKey<Feature> FLOWER_PALE_GARDEN = FeatureUtils.createKey("flower_pale_garden");
|
| 83 | public static final ResourceKey<Feature> WILDFLOWER = FeatureUtils.createKey("wildflower");
|
| 84 | public static final ResourceKey<Feature> FOREST_FLOWERS = FeatureUtils.createKey("forest_flowers");
|
| 85 | public static final ResourceKey<Feature> PALE_FOREST_FLOWER = FeatureUtils.createKey("pale_forest_flower");
|
| 86 | public static final ResourceKey<Feature> DARK_FOREST_VEGETATION = FeatureUtils.createKey("dark_forest_vegetation");
|
| 87 | public static final ResourceKey<Feature> PALE_GARDEN_VEGETATION = FeatureUtils.createKey("pale_garden_vegetation");
|
| 88 | public static final ResourceKey<Feature> PALE_MOSS_VEGETATION = FeatureUtils.createKey("pale_moss_vegetation");
|
| 89 | public static final ResourceKey<Feature> PALE_MOSS_PATCH = FeatureUtils.createKey("pale_moss_patch");
|
| 90 | public static final ResourceKey<Feature> PALE_MOSS_PATCH_BONEMEAL = FeatureUtils.createKey("pale_moss_patch_bonemeal");
|
| 91 | public static final ResourceKey<Feature> TREES_FLOWER_FOREST = FeatureUtils.createKey("trees_flower_forest");
|
| 92 | public static final ResourceKey<Feature> MEADOW_TREES = FeatureUtils.createKey("meadow_trees");
|
| 93 | public static final ResourceKey<Feature> TREES_TAIGA = FeatureUtils.createKey("trees_taiga");
|
| 94 | public static final ResourceKey<Feature> TREES_BADLANDS = FeatureUtils.createKey("trees_badlands");
|
| 95 | public static final ResourceKey<Feature> TREES_GROVE = FeatureUtils.createKey("trees_grove");
|
| 96 | public static final ResourceKey<Feature> TREES_SAVANNA = FeatureUtils.createKey("trees_savanna");
|
| 97 | public static final ResourceKey<Feature> TREES_SNOWY = FeatureUtils.createKey("trees_snowy");
|
| 98 | public static final ResourceKey<Feature> TREES_BIRCH = FeatureUtils.createKey("trees_birch");
|
| 99 | public static final ResourceKey<Feature> BIRCH_TALL = FeatureUtils.createKey("birch_tall");
|
| 100 | public static final ResourceKey<Feature> TREES_WINDSWEPT_HILLS = FeatureUtils.createKey("trees_windswept_hills");
|
| 101 | public static final ResourceKey<Feature> TREES_WATER = FeatureUtils.createKey("trees_water");
|
| 102 | public static final ResourceKey<Feature> TREES_BIRCH_AND_OAK_LEAF_LITTER = FeatureUtils.createKey("trees_birch_and_oak_leaf_litter");
|
| 103 | public static final ResourceKey<Feature> TREES_PLAINS = FeatureUtils.createKey("trees_plains");
|
| 104 | public static final ResourceKey<Feature> TREES_SPARSE_JUNGLE = FeatureUtils.createKey("trees_sparse_jungle");
|
| 105 | public static final ResourceKey<Feature> TREES_OLD_GROWTH_SPRUCE_TAIGA = FeatureUtils.createKey("trees_old_growth_spruce_taiga");
|
| 106 | public static final ResourceKey<Feature> TREES_OLD_GROWTH_PINE_TAIGA = FeatureUtils.createKey("trees_old_growth_pine_taiga");
|
| 107 | public static final ResourceKey<Feature> TREES_JUNGLE = FeatureUtils.createKey("trees_jungle");
|
| 108 | public static final ResourceKey<Feature> TREES_DAPPLED_FOREST = FeatureUtils.createKey("trees_dappled_forest");
|
| 109 | public static final ResourceKey<Feature> BAMBOO_VEGETATION = FeatureUtils.createKey("bamboo_vegetation");
|
| 110 | public static final ResourceKey<Feature> MUSHROOM_ISLAND_VEGETATION = FeatureUtils.createKey("mushroom_island_vegetation");
|
| 111 | public static final ResourceKey<Feature> MANGROVE_VEGETATION = FeatureUtils.createKey("mangrove_vegetation");
|
| 112 | private static final float FALLEN_TREE_ONE_IN_CHANCE = 80.0F;
|
| 113 |
|
| 114 | public static void bootstrap(final BootstrapContext<Feature> context) {
|
| 115 | HolderGetter<Block> blocks = context.lookup(Registries.BLOCK);
|
| 116 | HolderGetter<Feature> configuredFeatures = context.lookup(Registries.FEATURE);
|
| 117 | HolderGetter<BlockStateProvider> blockStateProviders = context.lookup(Registries.BLOCK_STATE_PROVIDER);
|
| 118 | Holder<Feature> hugeBrownMushroom = configuredFeatures.getOrThrow(TreeFeatures.HUGE_BROWN_MUSHROOM);
|
| 119 | Holder<Feature> hugeRedMushroom = configuredFeatures.getOrThrow(TreeFeatures.HUGE_RED_MUSHROOM);
|
| 120 | Holder<Feature> fancyOakBees005 = configuredFeatures.getOrThrow(TreeFeatures.FANCY_OAK_BEES_005);
|
| 121 | Holder<Feature> oakBees005 = configuredFeatures.getOrThrow(TreeFeatures.OAK_BEES_005);
|
| 122 | Holder<Feature> grassJungle = configuredFeatures.getOrThrow(GRASS_JUNGLE);
|
| 123 | HolderGetter<PlacedFeature> placedFeatures = context.lookup(Registries.PLACED_FEATURE);
|
| 124 | Holder<PlacedFeature> paleOakChecked = placedFeatures.getOrThrow(TreePlacements.PALE_OAK_CHECKED);
|
| 125 | Holder<PlacedFeature> paleOakCreakingChecked = placedFeatures.getOrThrow(TreePlacements.PALE_OAK_CREAKING_CHECKED);
|
| 126 | Holder<PlacedFeature> fancyOakChecked = placedFeatures.getOrThrow(TreePlacements.FANCY_OAK_CHECKED);
|
| 127 | Holder<PlacedFeature> birchBees002 = placedFeatures.getOrThrow(TreePlacements.BIRCH_BEES_002);
|
| 128 | Holder<PlacedFeature> fancyOakBees002 = placedFeatures.getOrThrow(TreePlacements.FANCY_OAK_BEES_002);
|
| 129 | Holder<PlacedFeature> fancyOakBees = placedFeatures.getOrThrow(TreePlacements.FANCY_OAK_BEES);
|
| 130 | Holder<PlacedFeature> pineChecked = placedFeatures.getOrThrow(TreePlacements.PINE_CHECKED);
|
| 131 | Holder<PlacedFeature> spruceChecked = placedFeatures.getOrThrow(TreePlacements.SPRUCE_CHECKED);
|
| 132 | Holder<PlacedFeature> pineOnSnow = placedFeatures.getOrThrow(TreePlacements.PINE_ON_SNOW);
|
| 133 | Holder<PlacedFeature> acaciaChecked = placedFeatures.getOrThrow(TreePlacements.ACACIA_CHECKED);
|
| 134 | Holder<PlacedFeature> superBirchBees0002 = placedFeatures.getOrThrow(TreePlacements.SUPER_BIRCH_BEES_0002);
|
| 135 | Holder<PlacedFeature> birchBees0002Placed = placedFeatures.getOrThrow(TreePlacements.BIRCH_BEES_0002_PLACED);
|
| 136 | Holder<PlacedFeature> birchBees0002LeafLitter = placedFeatures.getOrThrow(TreePlacements.BIRCH_BEES_0002_LEAF_LITTER);
|
| 137 | Holder<PlacedFeature> fancyOakBees0002LeafLitter = placedFeatures.getOrThrow(TreePlacements.FANCY_OAK_BEES_0002_LEAF_LITTER);
|
| 138 | Holder<PlacedFeature> jungleBush = placedFeatures.getOrThrow(TreePlacements.JUNGLE_BUSH);
|
| 139 | Holder<PlacedFeature> megaSpruceChecked = placedFeatures.getOrThrow(TreePlacements.MEGA_SPRUCE_CHECKED);
|
| 140 | Holder<PlacedFeature> megaPineChecked = placedFeatures.getOrThrow(TreePlacements.MEGA_PINE_CHECKED);
|
| 141 | Holder<PlacedFeature> megaJungleTreeChecked = placedFeatures.getOrThrow(TreePlacements.MEGA_JUNGLE_TREE_CHECKED);
|
| 142 | Holder<PlacedFeature> tallMangroveChecked = placedFeatures.getOrThrow(TreePlacements.TALL_MANGROVE_CHECKED);
|
| 143 | Holder<PlacedFeature> oakChecked = placedFeatures.getOrThrow(TreePlacements.OAK_CHECKED);
|
| 144 | Holder<PlacedFeature> oakBees002 = placedFeatures.getOrThrow(TreePlacements.OAK_BEES_002);
|
| 145 | Holder<PlacedFeature> superBirchBees = placedFeatures.getOrThrow(TreePlacements.SUPER_BIRCH_BEES);
|
| 146 | Holder<PlacedFeature> spruceOnSnow = placedFeatures.getOrThrow(TreePlacements.SPRUCE_ON_SNOW);
|
| 147 | Holder<PlacedFeature> oakBees0002LeafLitter = placedFeatures.getOrThrow(TreePlacements.OAK_BEES_0002_LEAF_LITTER);
|
| 148 | Holder<PlacedFeature> jungleTreeChecked = placedFeatures.getOrThrow(TreePlacements.JUNGLE_TREE_CHECKED);
|
| 149 | Holder<PlacedFeature> mangroveChecked = placedFeatures.getOrThrow(TreePlacements.MANGROVE_CHECKED);
|
| 150 | Holder<PlacedFeature> oakLeafLitter = placedFeatures.getOrThrow(TreePlacements.OAK_LEAF_LITTER);
|
| 151 | Holder<PlacedFeature> darkOakLeafLitter = placedFeatures.getOrThrow(TreePlacements.DARK_OAK_LEAF_LITTER);
|
| 152 | Holder<PlacedFeature> birchLeafLitter = placedFeatures.getOrThrow(TreePlacements.BIRCH_LEAF_LITTER);
|
| 153 | Holder<PlacedFeature> fancyOakLeafLitter = placedFeatures.getOrThrow(TreePlacements.FANCY_OAK_LEAF_LITTER);
|
| 154 | Holder<PlacedFeature> redPoplarLeafLitter = placedFeatures.getOrThrow(TreePlacements.RED_POPLAR_LEAF_LITTER);
|
| 155 | Holder<PlacedFeature> orangePoplarLeafLitter = placedFeatures.getOrThrow(TreePlacements.ORANGE_POPLAR_LEAF_LITTER);
|
| 156 | Holder<PlacedFeature> yellowPoplarLeafLitter = placedFeatures.getOrThrow(TreePlacements.YELLOW_POPLAR_LEAF_LITTER);
|
| 157 | Holder<PlacedFeature> fallenOak = placedFeatures.getOrThrow(TreePlacements.FALLEN_OAK_TREE);
|
| 158 | Holder<PlacedFeature> fallenBirch = placedFeatures.getOrThrow(TreePlacements.FALLEN_BIRCH_TREE);
|
| 159 | Holder<PlacedFeature> fallenSuperBirch = placedFeatures.getOrThrow(TreePlacements.FALLEN_SUPER_BIRCH_TREE);
|
| 160 | Holder<PlacedFeature> fallenJungle = placedFeatures.getOrThrow(TreePlacements.FALLEN_JUNGLE_TREE);
|
| 161 | Holder<PlacedFeature> fallenSpruce = placedFeatures.getOrThrow(TreePlacements.FALLEN_SPRUCE_TREE);
|
| 162 | Holder<PlacedFeature> fallenPoplar = placedFeatures.getOrThrow(TreePlacements.FALLEN_POPLAR_TREE);
|
| 163 | context.register(BAMBOO_NO_PODZOL, new BambooFeature(0.0F));
|
| 164 | context.register(BAMBOO_SOME_PODZOL, new BambooFeature(0.2F));
|
| 165 | context.register(VINES, new VinesFeature());
|
| 166 | context.register(BROWN_MUSHROOM, new SimpleBlockFeature(BlockStateProvider.of(Blocks.BROWN_MUSHROOM)));
|
| 167 | context.register(RED_MUSHROOM, new SimpleBlockFeature(BlockStateProvider.of(Blocks.RED_MUSHROOM)));
|
| 168 | context.register(SUNFLOWER, new SimpleBlockFeature(BlockStateProvider.of(Blocks.SUNFLOWER)));
|
| 169 | context.register(PUMPKIN, new SimpleBlockFeature(BlockStateProvider.of(Blocks.PUMPKIN)));
|
| 170 | context.register(BERRY_BUSH, new SimpleBlockFeature(BlockStateProvider.of(Blocks.SWEET_BERRY_BUSH.defaultBlockState().setValue(SweetBerryBushBlock.AGE, 3))));
|
| 171 | context.register(
|
| 172 | TAIGA_GRASS,
|
| 173 | new SimpleBlockFeature(
|
| 174 | new WeightedStateProvider(WeightedList.<BlockState>builder().add(Blocks.SHORT_GRASS.defaultBlockState(), 1).add(Blocks.FERN.defaultBlockState(), 4))
|
| 175 | )
|
| 176 | );
|
| 177 | context.register(GRASS, new SimpleBlockFeature(BlockStateProvider.of(Blocks.SHORT_GRASS)));
|
| 178 | context.register(LEAF_LITTER, new SimpleBlockFeature(new WeightedStateProvider(leafLitterPatchBuilder(1, 3))));
|
| 179 | context.register(
|
| 180 | GRASS_JUNGLE,
|
| 181 | new SimpleBlockFeature(
|
| 182 | new WeightedStateProvider(WeightedList.<BlockState>builder().add(Blocks.SHORT_GRASS.defaultBlockState(), 3).add(Blocks.FERN.defaultBlockState(), 1))
|
| 183 | )
|
| 184 | );
|
| 185 | context.register(DEAD_BUSH, new SimpleBlockFeature(BlockStateProvider.of(Blocks.DEAD_BUSH)));
|
| 186 | context.register(
|
| 187 | DRY_GRASS,
|
| 188 | new SimpleBlockFeature(
|
| 189 | new WeightedStateProvider(
|
| 190 | WeightedList.<BlockState>builder().add(Blocks.SHORT_DRY_GRASS.defaultBlockState(), 1).add(Blocks.TALL_DRY_GRASS.defaultBlockState(), 1)
|
| 191 | )
|
| 192 | )
|
| 193 | );
|
| 194 | context.register(MELON, new SimpleBlockFeature(BlockStateProvider.of(Blocks.MELON)));
|
| 195 | context.register(WATERLILY, new SimpleBlockFeature(BlockStateProvider.of(Blocks.LILY_PAD)));
|
| 196 | context.register(TALL_GRASS, new SimpleBlockFeature(BlockStateProvider.of(Blocks.TALL_GRASS)));
|
| 197 | context.register(LARGE_FERN, new SimpleBlockFeature(BlockStateProvider.of(Blocks.LARGE_FERN)));
|
| 198 | context.register(BUSH, new SimpleBlockFeature(BlockStateProvider.of(Blocks.BUSH)));
|
| 199 | context.register(RED_SHRUB, new SimpleBlockFeature(BlockStateProvider.of(Blocks.RED_SHRUB)));
|
| 200 | context.register(
|
| 201 | CACTUS,
|
| 202 | new BlockColumnFeature(
|
| 203 | List.of(
|
| 204 | BlockColumnFeature.layer(BiasedToBottomInt.of(1, 3), BlockStateProvider.of(Blocks.CACTUS)),
|
| 205 | BlockColumnFeature.layer(
|
| 206 | new WeightedListInt(WeightedList.<IntProvider>builder().add(ConstantInt.of(0), 3).add(ConstantInt.of(1), 1).build()),
|
| 207 | BlockStateProvider.of(Blocks.CACTUS_FLOWER)
|
| 208 | )
|
| 209 | ),
|
| 210 | Direction.UP,
|
| 211 | BlockPredicate.ONLY_IN_AIR_PREDICATE,
|
| 212 | false
|
| 213 | )
|
| 214 | );
|
| 215 | context.register(SUGAR_CANE, BlockColumnFeature.simple(BiasedToBottomInt.of(2, 4), BlockStateProvider.of(Blocks.SUGAR_CANE)));
|
| 216 | context.register(FIREFLY_BUSH, new SimpleBlockFeature(BlockStateProvider.of(Blocks.FIREFLY_BUSH)));
|
| 217 | BlockStateProvider provider = new WeightedStateProvider(
|
| 218 | WeightedList.<BlockState>builder().add(Blocks.POPPY.defaultBlockState(), 2).add(Blocks.DANDELION.defaultBlockState(), 1)
|
| 219 | );
|
| 220 | context.register(FLOWER_DEFAULT, new SimpleBlockFeature(provider));
|
| 221 | context.register(FLOWER_FLOWER_FOREST, new SimpleBlockFeature(blockStateProviders.getOrThrow(BlockStateProviders.FLOWER_FLOWER_FOREST)));
|
| 222 | context.register(FLOWER_SWAMP, new SimpleBlockFeature(BlockStateProvider.of(Blocks.BLUE_ORCHID)));
|
| 223 | context.register(FLOWER_PLAIN, new SimpleBlockFeature(blockStateProviders.getOrThrow(BlockStateProviders.FLOWER_PLAIN)));
|
| 224 | context.register(FLOWER_MEADOW, new SimpleBlockFeature(blockStateProviders.getOrThrow(BlockStateProviders.FLOWER_MEADOW)));
|
| 225 | context.register(FLOWER_CHERRY, new SimpleBlockFeature(new WeightedStateProvider(flowerBedPatchBuilder(Blocks.PINK_PETALS))));
|
| 226 | context.register(WILDFLOWER, new SimpleBlockFeature(new WeightedStateProvider(flowerBedPatchBuilder(Blocks.WILDFLOWERS))));
|
| 227 | context.register(FLOWER_PALE_GARDEN, new SimpleBlockFeature(BlockStateProvider.holderOf(Blocks.CLOSED_EYEBLOSSOM), true));
|
| 228 | context.register(
|
| 229 | FOREST_FLOWERS,
|
| 230 | new SimpleRandomSelectorFeature(
|
| 231 | HolderSet.direct(
|
| 232 | PlacementUtils.inlinePlaced(
|
| 233 | new SimpleBlockFeature(BlockStateProvider.of(Blocks.LILAC)),
|
| 234 | CountPlacement.of(96),
|
| 235 | OffsetPlacement.ofTriangle(7, 3),
|
| 236 | BlockPredicateFilter.forPredicate(BlockPredicate.ONLY_IN_AIR_PREDICATE)
|
| 237 | ),
|
| 238 | PlacementUtils.inlinePlaced(
|
| 239 | new SimpleBlockFeature(BlockStateProvider.of(Blocks.ROSE_BUSH)),
|
| 240 | CountPlacement.of(96),
|
| 241 | OffsetPlacement.ofTriangle(7, 3),
|
| 242 | BlockPredicateFilter.forPredicate(BlockPredicate.ONLY_IN_AIR_PREDICATE)
|
| 243 | ),
|
| 244 | PlacementUtils.inlinePlaced(
|
| 245 | new SimpleBlockFeature(BlockStateProvider.of(Blocks.PEONY)),
|
| 246 | CountPlacement.of(96),
|
| 247 | OffsetPlacement.ofTriangle(7, 3),
|
| 248 | BlockPredicateFilter.forPredicate(BlockPredicate.ONLY_IN_AIR_PREDICATE)
|
| 249 | ),
|
| 250 | PlacementUtils.inlinePlaced(
|
| 251 | new SimpleBlockFeature(BlockStateProvider.of(Blocks.LILY_OF_THE_VALLEY)),
|
| 252 | CountPlacement.of(96),
|
| 253 | OffsetPlacement.ofTriangle(7, 3),
|
| 254 | BlockPredicateFilter.forPredicate(BlockPredicate.ONLY_IN_AIR_PREDICATE)
|
| 255 | )
|
| 256 | )
|
| 257 | )
|
| 258 | );
|
| 259 | context.register(PALE_FOREST_FLOWER, new SimpleBlockFeature(BlockStateProvider.holderOf(Blocks.CLOSED_EYEBLOSSOM), true));
|
| 260 | context.register(
|
| 261 | DARK_FOREST_VEGETATION,
|
| 262 | new RandomSelectorFeature(
|
| 263 | List.of(
|
| 264 | new WeightedPlacedFeature(PlacementUtils.inlinePlaced(hugeBrownMushroom), 0.025F),
|
| 265 | new WeightedPlacedFeature(PlacementUtils.inlinePlaced(hugeRedMushroom), 0.05F),
|
| 266 | new WeightedPlacedFeature(darkOakLeafLitter, 0.6666667F),
|
| 267 | new WeightedPlacedFeature(fallenBirch, 0.0025F),
|
| 268 | new WeightedPlacedFeature(birchLeafLitter, 0.2F),
|
| 269 | new WeightedPlacedFeature(fallenOak, 0.0125F),
|
| 270 | new WeightedPlacedFeature(fancyOakLeafLitter, 0.1F)
|
| 271 | ),
|
| 272 | oakLeafLitter
|
| 273 | )
|
| 274 | );
|
| 275 | context.register(
|
| 276 | TREES_DAPPLED_FOREST,
|
| 277 | new WeightedRandomSelectorFeature(
|
| 278 | WeightedList.of(
|
| 279 | new Weighted<>(redPoplarLeafLitter, 200),
|
| 280 | new Weighted<>(orangePoplarLeafLitter, 240),
|
| 281 | new Weighted<>(yellowPoplarLeafLitter, 90),
|
| 282 | new Weighted<>(spruceChecked, 27),
|
| 283 | new Weighted<>(fallenPoplar, 120)
|
| 284 | )
|
| 285 | )
|
| 286 | );
|
| 287 | context.register(
|
| 288 | PALE_GARDEN_VEGETATION,
|
| 289 | new RandomSelectorFeature(List.of(new WeightedPlacedFeature(paleOakCreakingChecked, 0.1F), new WeightedPlacedFeature(paleOakChecked, 0.9F)), paleOakChecked)
|
| 290 | );
|
| 291 | context.register(
|
| 292 | PALE_MOSS_VEGETATION,
|
| 293 | new SimpleBlockFeature(
|
| 294 | new WeightedStateProvider(
|
| 295 | WeightedList.<BlockState>builder()
|
| 296 | .add(Blocks.PALE_MOSS_CARPET.defaultBlockState(), 25)
|
| 297 | .add(Blocks.SHORT_GRASS.defaultBlockState(), 25)
|
| 298 | .add(Blocks.TALL_GRASS.defaultBlockState(), 10)
|
| 299 | )
|
| 300 | )
|
| 301 | );
|
| 302 | context.register(
|
| 303 | PALE_MOSS_PATCH,
|
| 304 | new VegetationPatchFeature(
|
| 305 | blocks.getOrThrow(BlockTags.MOSS_REPLACEABLE),
|
| 306 | BlockStateProvider.holderOf(Blocks.PALE_MOSS_BLOCK),
|
| 307 | PlacementUtils.inlinePlaced(configuredFeatures.getOrThrow(PALE_MOSS_VEGETATION)),
|
| 308 | CaveSurface.FLOOR,
|
| 309 | ConstantInt.of(1),
|
| 310 | 0.0F,
|
| 311 | 5,
|
| 312 | 0.3F,
|
| 313 | UniformInt.of(2, 4),
|
| 314 | 0.75F
|
| 315 | )
|
| 316 | );
|
| 317 | context.register(
|
| 318 | PALE_MOSS_PATCH_BONEMEAL,
|
| 319 | new VegetationPatchFeature(
|
| 320 | blocks.getOrThrow(BlockTags.MOSS_REPLACEABLE),
|
| 321 | BlockStateProvider.holderOf(Blocks.PALE_MOSS_BLOCK),
|
| 322 | PlacementUtils.inlinePlaced(configuredFeatures.getOrThrow(PALE_MOSS_VEGETATION)),
|
| 323 | CaveSurface.FLOOR,
|
| 324 | ConstantInt.of(1),
|
| 325 | 0.0F,
|
| 326 | 5,
|
| 327 | 0.6F,
|
| 328 | UniformInt.of(1, 2),
|
| 329 | 0.75F
|
| 330 | )
|
| 331 | );
|
| 332 | context.register(
|
| 333 | TREES_FLOWER_FOREST,
|
| 334 | new RandomSelectorFeature(
|
| 335 | List.of(new WeightedPlacedFeature(fallenBirch, 0.0025F), new WeightedPlacedFeature(birchBees002, 0.2F), new WeightedPlacedFeature(fancyOakBees002, 0.1F)),
|
| 336 | oakBees002
|
| 337 | )
|
| 338 | );
|
| 339 | context.register(MEADOW_TREES, new RandomSelectorFeature(List.of(new WeightedPlacedFeature(fancyOakBees, 0.5F)), superBirchBees));
|
| 340 | context.register(
|
| 341 | TREES_TAIGA,
|
| 342 | new RandomSelectorFeature(List.of(new WeightedPlacedFeature(pineChecked, 0.33333334F), new WeightedPlacedFeature(fallenSpruce, 0.0125F)), spruceChecked)
|
| 343 | );
|
| 344 | context.register(TREES_BADLANDS, new RandomSelectorFeature(List.of(new WeightedPlacedFeature(fallenOak, 0.0125F)), oakLeafLitter));
|
| 345 | context.register(TREES_GROVE, new RandomSelectorFeature(List.of(new WeightedPlacedFeature(pineOnSnow, 0.33333334F)), spruceOnSnow));
|
| 346 | context.register(
|
| 347 | TREES_SAVANNA, new RandomSelectorFeature(List.of(new WeightedPlacedFeature(acaciaChecked, 0.8F), new WeightedPlacedFeature(fallenOak, 0.0125F)), oakChecked)
|
| 348 | );
|
| 349 | context.register(TREES_SNOWY, new RandomSelectorFeature(List.of(new WeightedPlacedFeature(fallenSpruce, 0.0125F)), spruceChecked));
|
| 350 | context.register(TREES_BIRCH, new RandomSelectorFeature(List.of(new WeightedPlacedFeature(fallenBirch, 0.0125F)), birchBees0002Placed));
|
| 351 | context.register(
|
| 352 | BIRCH_TALL,
|
| 353 | new RandomSelectorFeature(
|
| 354 | List.of(
|
| 355 | new WeightedPlacedFeature(fallenSuperBirch, 0.00625F),
|
| 356 | new WeightedPlacedFeature(superBirchBees0002, 0.5F),
|
| 357 | new WeightedPlacedFeature(fallenBirch, 0.0125F)
|
| 358 | ),
|
| 359 | birchBees0002Placed
|
| 360 | )
|
| 361 | );
|
| 362 | context.register(
|
| 363 | TREES_WINDSWEPT_HILLS,
|
| 364 | new RandomSelectorFeature(
|
| 365 | List.of(
|
| 366 | new WeightedPlacedFeature(fallenSpruce, 0.008325F),
|
| 367 | new WeightedPlacedFeature(spruceChecked, 0.666F),
|
| 368 | new WeightedPlacedFeature(fancyOakChecked, 0.1F),
|
| 369 | new WeightedPlacedFeature(fallenOak, 0.0125F)
|
| 370 | ),
|
| 371 | oakChecked
|
| 372 | )
|
| 373 | );
|
| 374 | context.register(TREES_WATER, new RandomSelectorFeature(List.of(new WeightedPlacedFeature(fancyOakChecked, 0.1F)), oakChecked));
|
| 375 | context.register(
|
| 376 | TREES_BIRCH_AND_OAK_LEAF_LITTER,
|
| 377 | new RandomSelectorFeature(
|
| 378 | List.of(
|
| 379 | new WeightedPlacedFeature(fallenBirch, 0.0025F),
|
| 380 | new WeightedPlacedFeature(birchBees0002LeafLitter, 0.2F),
|
| 381 | new WeightedPlacedFeature(fancyOakBees0002LeafLitter, 0.1F),
|
| 382 | new WeightedPlacedFeature(fallenOak, 0.0125F)
|
| 383 | ),
|
| 384 | oakBees0002LeafLitter
|
| 385 | )
|
| 386 | );
|
| 387 | context.register(
|
| 388 | TREES_PLAINS,
|
| 389 | new RandomSelectorFeature(
|
| 390 | List.of(new WeightedPlacedFeature(PlacementUtils.inlinePlaced(fancyOakBees005), 0.33333334F), new WeightedPlacedFeature(fallenOak, 0.0125F)),
|
| 391 | PlacementUtils.inlinePlaced(oakBees005)
|
| 392 | )
|
| 393 | );
|
| 394 | context.register(
|
| 395 | TREES_SPARSE_JUNGLE,
|
| 396 | new RandomSelectorFeature(
|
| 397 | List.of(new WeightedPlacedFeature(fancyOakChecked, 0.1F), new WeightedPlacedFeature(jungleBush, 0.5F), new WeightedPlacedFeature(fallenJungle, 0.0125F)),
|
| 398 | jungleTreeChecked
|
| 399 | )
|
| 400 | );
|
| 401 | context.register(
|
| 402 | TREES_OLD_GROWTH_SPRUCE_TAIGA,
|
| 403 | new RandomSelectorFeature(
|
| 404 | List.of(
|
| 405 | new WeightedPlacedFeature(megaSpruceChecked, 0.33333334F),
|
| 406 | new WeightedPlacedFeature(pineChecked, 0.33333334F),
|
| 407 | new WeightedPlacedFeature(fallenSpruce, 0.0125F)
|
| 408 | ),
|
| 409 | spruceChecked
|
| 410 | )
|
| 411 | );
|
| 412 | context.register(
|
| 413 | TREES_OLD_GROWTH_PINE_TAIGA,
|
| 414 | new RandomSelectorFeature(
|
| 415 | List.of(
|
| 416 | new WeightedPlacedFeature(megaSpruceChecked, 0.025641026F),
|
| 417 | new WeightedPlacedFeature(megaPineChecked, 0.30769232F),
|
| 418 | new WeightedPlacedFeature(pineChecked, 0.33333334F),
|
| 419 | new WeightedPlacedFeature(fallenSpruce, 0.0125F)
|
| 420 | ),
|
| 421 | spruceChecked
|
| 422 | )
|
| 423 | );
|
| 424 | context.register(
|
| 425 | TREES_JUNGLE,
|
| 426 | new RandomSelectorFeature(
|
| 427 | List.of(
|
| 428 | new WeightedPlacedFeature(fancyOakChecked, 0.1F),
|
| 429 | new WeightedPlacedFeature(jungleBush, 0.5F),
|
| 430 | new WeightedPlacedFeature(megaJungleTreeChecked, 0.33333334F),
|
| 431 | new WeightedPlacedFeature(fallenJungle, 0.0125F)
|
| 432 | ),
|
| 433 | jungleTreeChecked
|
| 434 | )
|
| 435 | );
|
| 436 | context.register(
|
| 437 | BAMBOO_VEGETATION,
|
| 438 | new RandomSelectorFeature(
|
| 439 | List.of(
|
| 440 | new WeightedPlacedFeature(fancyOakChecked, 0.05F), new WeightedPlacedFeature(jungleBush, 0.15F), new WeightedPlacedFeature(megaJungleTreeChecked, 0.7F)
|
| 441 | ),
|
| 442 | PlacementUtils.inlinePlaced(
|
| 443 | grassJungle,
|
| 444 | CountPlacement.of(32),
|
| 445 | OffsetPlacement.ofTriangle(7, 3),
|
| 446 | BlockPredicateFilter.forPredicate(
|
| 447 | BlockPredicate.allOf(BlockPredicate.ONLY_IN_AIR_PREDICATE, BlockPredicate.not(BlockPredicate.matchesBlocks(Direction.DOWN, Blocks.PODZOL)))
|
| 448 | )
|
| 449 | )
|
| 450 | )
|
| 451 | );
|
| 452 | context.register(
|
| 453 | MUSHROOM_ISLAND_VEGETATION, new RandomBooleanSelectorFeature(PlacementUtils.inlinePlaced(hugeRedMushroom), PlacementUtils.inlinePlaced(hugeBrownMushroom))
|
| 454 | );
|
| 455 | context.register(MANGROVE_VEGETATION, new RandomSelectorFeature(List.of(new WeightedPlacedFeature(tallMangroveChecked, 0.85F)), mangroveChecked));
|
| 456 | }
|
| 457 |
|
| 458 | private static WeightedList.Builder<BlockState> flowerBedPatchBuilder(final Block flowerBedBlock) {
|
| 459 | return segmentedBlockPatchBuilder(flowerBedBlock, 1, 4, FlowerBedBlock.AMOUNT, FlowerBedBlock.FACING);
|
| 460 | }
|
| 461 |
|
| 462 | public static WeightedList.Builder<BlockState> leafLitterPatchBuilder(final int minState, final int maxState) {
|
| 463 | return segmentedBlockPatchBuilder(Blocks.LEAF_LITTER, minState, maxState, LeafLitterBlock.AMOUNT, LeafLitterBlock.FACING);
|
| 464 | }
|
| 465 |
|
| 466 | private static WeightedList.Builder<BlockState> segmentedBlockPatchBuilder(
|
| 467 | final Block block, final int minState, final int maxState, final IntegerProperty amountProperty, final EnumProperty<Direction> directionProperty
|
| 468 | ) {
|
| 469 | WeightedList.Builder<BlockState> segmentedBlockBuild = WeightedList.builder();
|
| 470 |
|
| 471 | for (int amount = minState; amount <= maxState; amount++) {
|
| 472 | for (Direction direction : Direction.Plane.HORIZONTAL) {
|
| 473 | segmentedBlockBuild.add(block.defaultBlockState().setValue(amountProperty, amount).setValue(directionProperty, direction), 1);
|
| 474 | }
|
| 475 | }
|
| 476 |
|
| 477 | return segmentedBlockBuild;
|
| 478 | }
|
| 479 |
|
| 480 | public static BlockPredicateFilter nearWaterPredicate(final Block block) {
|
| 481 | return BlockPredicateFilter.forPredicate(
|
| 482 | BlockPredicate.allOf(
|
| 483 | BlockPredicate.ONLY_IN_AIR_PREDICATE,
|
| 484 | BlockPredicate.wouldSurvive(block),
|
| 485 | BlockPredicate.anyOf(
|
| 486 | BlockPredicate.matchesFluids(CompositeDirection.EAST_DOWN, Fluids.WATER, Fluids.FLOWING_WATER),
|
| 487 | BlockPredicate.matchesFluids(CompositeDirection.WEST_DOWN, Fluids.WATER, Fluids.FLOWING_WATER),
|
| 488 | BlockPredicate.matchesFluids(CompositeDirection.SOUTH_DOWN, Fluids.WATER, Fluids.FLOWING_WATER),
|
| 489 | BlockPredicate.matchesFluids(CompositeDirection.NORTH_DOWN, Fluids.WATER, Fluids.FLOWING_WATER)
|
| 490 | )
|
| 491 | )
|
| 492 | );
|
| 493 | }
|
| 494 | }
|
| 495 |
|