| 1 | package net.minecraft.data.worldgen.features;
|
| 2 |
|
| 3 | import java.util.List;
|
| 4 | import net.minecraft.core.Direction;
|
| 5 | import net.minecraft.core.Holder;
|
| 6 | import net.minecraft.core.HolderGetter;
|
| 7 | import net.minecraft.core.HolderSet;
|
| 8 | import net.minecraft.core.registries.Registries;
|
| 9 | import net.minecraft.data.worldgen.BlockStateProviders;
|
| 10 | import net.minecraft.data.worldgen.BootstrapContext;
|
| 11 | import net.minecraft.data.worldgen.ProcessorLists;
|
| 12 | import net.minecraft.data.worldgen.placement.PlacementUtils;
|
| 13 | import net.minecraft.resources.Identifier;
|
| 14 | import net.minecraft.resources.ResourceKey;
|
| 15 | import net.minecraft.tags.BlockTags;
|
| 16 | import net.minecraft.util.random.WeightedList;
|
| 17 | import net.minecraft.util.valueproviders.ClampedInt;
|
| 18 | import net.minecraft.util.valueproviders.ClampedNormalFloat;
|
| 19 | import net.minecraft.util.valueproviders.ConstantFloat;
|
| 20 | import net.minecraft.util.valueproviders.ConstantInt;
|
| 21 | import net.minecraft.util.valueproviders.IntProvider;
|
| 22 | import net.minecraft.util.valueproviders.UniformFloat;
|
| 23 | import net.minecraft.util.valueproviders.UniformInt;
|
| 24 | import net.minecraft.util.valueproviders.WeightedListInt;
|
| 25 | import net.minecraft.world.level.block.Block;
|
| 26 | import net.minecraft.world.level.block.Blocks;
|
| 27 | import net.minecraft.world.level.block.MultifaceSpreadeableBlock;
|
| 28 | import net.minecraft.world.level.block.SculkShriekerBlock;
|
| 29 | import net.minecraft.world.level.block.SmallDripleafBlock;
|
| 30 | import net.minecraft.world.level.block.state.BlockState;
|
| 31 | import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
| 32 | import net.minecraft.world.level.levelgen.GeodeBlockSettings;
|
| 33 | import net.minecraft.world.level.levelgen.GeodeCrackSettings;
|
| 34 | import net.minecraft.world.level.levelgen.GeodeLayerSettings;
|
| 35 | import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate;
|
| 36 | import net.minecraft.world.level.levelgen.feature.BlockColumnFeature;
|
| 37 | import net.minecraft.world.level.levelgen.feature.Feature;
|
| 38 | import net.minecraft.world.level.levelgen.feature.FossilFeature;
|
| 39 | import net.minecraft.world.level.levelgen.feature.GeodeFeature;
|
| 40 | import net.minecraft.world.level.levelgen.feature.LargeDripstoneFeature;
|
| 41 | import net.minecraft.world.level.levelgen.feature.MonsterRoomFeature;
|
| 42 | import net.minecraft.world.level.levelgen.feature.MultifaceGrowthFeature;
|
| 43 | import net.minecraft.world.level.levelgen.feature.OverlayFeature;
|
| 44 | import net.minecraft.world.level.levelgen.feature.RandomBooleanSelectorFeature;
|
| 45 | import net.minecraft.world.level.levelgen.feature.RootSystemFeature;
|
| 46 | import net.minecraft.world.level.levelgen.feature.SculkPatchFeature;
|
| 47 | import net.minecraft.world.level.levelgen.feature.SequenceFeature;
|
| 48 | import net.minecraft.world.level.levelgen.feature.SimpleBlockFeature;
|
| 49 | import net.minecraft.world.level.levelgen.feature.SimpleRandomSelectorFeature;
|
| 50 | import net.minecraft.world.level.levelgen.feature.SpeleothemClusterFeature;
|
| 51 | import net.minecraft.world.level.levelgen.feature.SpeleothemFeature;
|
| 52 | import net.minecraft.world.level.levelgen.feature.UnderwaterMagmaFeature;
|
| 53 | import net.minecraft.world.level.levelgen.feature.VegetationPatchFeature;
|
| 54 | import net.minecraft.world.level.levelgen.feature.WaterloggedVegetationPatchFeature;
|
| 55 | import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider;
|
| 56 | import net.minecraft.world.level.levelgen.feature.stateproviders.WeightedStateProvider;
|
| 57 | import net.minecraft.world.level.levelgen.placement.BlockPredicateFilter;
|
| 58 | import net.minecraft.world.level.levelgen.placement.CaveSurface;
|
| 59 | import net.minecraft.world.level.levelgen.placement.CountPlacement;
|
| 60 | import net.minecraft.world.level.levelgen.placement.EnvironmentScanPlacement;
|
| 61 | import net.minecraft.world.level.levelgen.placement.OffsetPlacement;
|
| 62 | import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
| 63 | import net.minecraft.world.level.levelgen.placement.RandomChancePlacement;
|
| 64 | import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorList;
|
| 65 |
|
| 66 | public class CaveFeatures {
|
| 67 | public static final ResourceKey<Feature> MONSTER_ROOM = FeatureUtils.createKey("monster_room");
|
| 68 | public static final ResourceKey<Feature> FOSSIL_COAL = FeatureUtils.createKey("fossil_coal");
|
| 69 | public static final ResourceKey<Feature> FOSSIL_DIAMONDS = FeatureUtils.createKey("fossil_diamonds");
|
| 70 | public static final ResourceKey<Feature> DRIPSTONE_CLUSTER = FeatureUtils.createKey("dripstone_cluster");
|
| 71 | public static final ResourceKey<Feature> SULFUR_SPIKE_CLUSTER = FeatureUtils.createKey("sulfur_spike_cluster");
|
| 72 | public static final ResourceKey<Feature> LARGE_DRIPSTONE = FeatureUtils.createKey("large_dripstone");
|
| 73 | public static final ResourceKey<Feature> POINTED_DRIPSTONE = FeatureUtils.createKey("pointed_dripstone");
|
| 74 | public static final ResourceKey<Feature> SULFUR_SPIKE = FeatureUtils.createKey("sulfur_spike");
|
| 75 | public static final ResourceKey<Feature> UNDERWATER_MAGMA = FeatureUtils.createKey("underwater_magma");
|
| 76 | public static final ResourceKey<Feature> GLOW_LICHEN = FeatureUtils.createKey("glow_lichen");
|
| 77 | public static final ResourceKey<Feature> ROOTED_AZALEA_TREE = FeatureUtils.createKey("rooted_azalea_tree");
|
| 78 | public static final ResourceKey<Feature> ROOTED_SULFUR_SPRING = FeatureUtils.createKey("rooted_sulfur_spring");
|
| 79 | public static final ResourceKey<Feature> CAVE_VINE = FeatureUtils.createKey("cave_vine");
|
| 80 | public static final ResourceKey<Feature> CAVE_VINE_IN_MOSS = FeatureUtils.createKey("cave_vine_in_moss");
|
| 81 | public static final ResourceKey<Feature> MOSS_VEGETATION = FeatureUtils.createKey("moss_vegetation");
|
| 82 | public static final ResourceKey<Feature> MOSS_PATCH = FeatureUtils.createKey("moss_patch");
|
| 83 | public static final ResourceKey<Feature> MOSS_PATCH_BONEMEAL = FeatureUtils.createKey("moss_patch_bonemeal");
|
| 84 | public static final ResourceKey<Feature> DRIPLEAF = FeatureUtils.createKey("dripleaf");
|
| 85 | public static final ResourceKey<Feature> CLAY_WITH_DRIPLEAVES = FeatureUtils.createKey("clay_with_dripleaves");
|
| 86 | public static final ResourceKey<Feature> CLAY_POOL_WITH_DRIPLEAVES = FeatureUtils.createKey("clay_pool_with_dripleaves");
|
| 87 | public static final ResourceKey<Feature> LUSH_CAVES_CLAY = FeatureUtils.createKey("lush_caves_clay");
|
| 88 | public static final ResourceKey<Feature> MOSS_PATCH_CEILING = FeatureUtils.createKey("moss_patch_ceiling");
|
| 89 | public static final ResourceKey<Feature> SPORE_BLOSSOM = FeatureUtils.createKey("spore_blossom");
|
| 90 | public static final ResourceKey<Feature> AMETHYST_GEODE = FeatureUtils.createKey("amethyst_geode");
|
| 91 | public static final ResourceKey<Feature> SCULK_PATCH_DEEP_DARK = FeatureUtils.createKey("sculk_patch_deep_dark");
|
| 92 | public static final ResourceKey<Feature> SCULK_PATCH_ANCIENT_CITY = FeatureUtils.createKey("sculk_patch_ancient_city");
|
| 93 | public static final ResourceKey<Feature> SCULK_VEIN = FeatureUtils.createKey("sculk_vein");
|
| 94 |
|
| 95 | private static Holder<PlacedFeature> makeDripleaf(final Direction direction) {
|
| 96 | return PlacementUtils.inlinePlaced(
|
| 97 | new BlockColumnFeature(
|
| 98 | List.of(
|
| 99 | BlockColumnFeature.layer(
|
| 100 | new WeightedListInt(WeightedList.<IntProvider>builder().add(UniformInt.of(0, 4), 2).add(ConstantInt.of(0), 1).build()),
|
| 101 | BlockStateProvider.of(Blocks.BIG_DRIPLEAF_STEM.defaultBlockState().setValue(BlockStateProperties.HORIZONTAL_FACING, direction))
|
| 102 | ),
|
| 103 | BlockColumnFeature.layer(
|
| 104 | ConstantInt.of(1), BlockStateProvider.of(Blocks.BIG_DRIPLEAF.defaultBlockState().setValue(BlockStateProperties.HORIZONTAL_FACING, direction))
|
| 105 | )
|
| 106 | ),
|
| 107 | Direction.UP,
|
| 108 | BlockPredicate.ONLY_IN_AIR_OR_WATER_PREDICATE,
|
| 109 | true
|
| 110 | )
|
| 111 | );
|
| 112 | }
|
| 113 |
|
| 114 | private static Holder<PlacedFeature> makeSmallDripleaf() {
|
| 115 | return PlacementUtils.inlinePlaced(
|
| 116 | new SimpleBlockFeature(
|
| 117 | new WeightedStateProvider(
|
| 118 | WeightedList.<BlockState>builder()
|
| 119 | .add(Blocks.SMALL_DRIPLEAF.defaultBlockState().setValue(SmallDripleafBlock.FACING, Direction.EAST), 1)
|
| 120 | .add(Blocks.SMALL_DRIPLEAF.defaultBlockState().setValue(SmallDripleafBlock.FACING, Direction.WEST), 1)
|
| 121 | .add(Blocks.SMALL_DRIPLEAF.defaultBlockState().setValue(SmallDripleafBlock.FACING, Direction.NORTH), 1)
|
| 122 | .add(Blocks.SMALL_DRIPLEAF.defaultBlockState().setValue(SmallDripleafBlock.FACING, Direction.SOUTH), 1)
|
| 123 | )
|
| 124 | )
|
| 125 | );
|
| 126 | }
|
| 127 |
|
| 128 | public static void bootstrap(final BootstrapContext<Feature> context) {
|
| 129 | HolderGetter<Block> blocks = context.lookup(Registries.BLOCK);
|
| 130 | HolderGetter<BlockStateProvider> blockStateProviders = context.lookup(Registries.BLOCK_STATE_PROVIDER);
|
| 131 | HolderGetter<Feature> configuredFeatures = context.lookup(Registries.FEATURE);
|
| 132 | HolderGetter<StructureProcessorList> processorLists = context.lookup(Registries.PROCESSOR_LIST);
|
| 133 | context.register(MONSTER_ROOM, new MonsterRoomFeature());
|
| 134 | List<Identifier> fossilStructures = List.of(
|
| 135 | Identifier.withDefaultNamespace("fossil/spine_1"),
|
| 136 | Identifier.withDefaultNamespace("fossil/spine_2"),
|
| 137 | Identifier.withDefaultNamespace("fossil/spine_3"),
|
| 138 | Identifier.withDefaultNamespace("fossil/spine_4"),
|
| 139 | Identifier.withDefaultNamespace("fossil/skull_1"),
|
| 140 | Identifier.withDefaultNamespace("fossil/skull_2"),
|
| 141 | Identifier.withDefaultNamespace("fossil/skull_3"),
|
| 142 | Identifier.withDefaultNamespace("fossil/skull_4")
|
| 143 | );
|
| 144 | List<Identifier> fossilCoalStructures = List.of(
|
| 145 | Identifier.withDefaultNamespace("fossil/spine_1_coal"),
|
| 146 | Identifier.withDefaultNamespace("fossil/spine_2_coal"),
|
| 147 | Identifier.withDefaultNamespace("fossil/spine_3_coal"),
|
| 148 | Identifier.withDefaultNamespace("fossil/spine_4_coal"),
|
| 149 | Identifier.withDefaultNamespace("fossil/skull_1_coal"),
|
| 150 | Identifier.withDefaultNamespace("fossil/skull_2_coal"),
|
| 151 | Identifier.withDefaultNamespace("fossil/skull_3_coal"),
|
| 152 | Identifier.withDefaultNamespace("fossil/skull_4_coal")
|
| 153 | );
|
| 154 | Holder<StructureProcessorList> fossilRot = processorLists.getOrThrow(ProcessorLists.FOSSIL_ROT);
|
| 155 | context.register(FOSSIL_COAL, new FossilFeature(fossilStructures, fossilCoalStructures, fossilRot, processorLists.getOrThrow(ProcessorLists.FOSSIL_COAL), 4));
|
| 156 | context.register(
|
| 157 | FOSSIL_DIAMONDS, new FossilFeature(fossilStructures, fossilCoalStructures, fossilRot, processorLists.getOrThrow(ProcessorLists.FOSSIL_DIAMONDS), 4)
|
| 158 | );
|
| 159 | context.register(
|
| 160 | DRIPSTONE_CLUSTER,
|
| 161 | new SpeleothemClusterFeature(
|
| 162 | Blocks.DRIPSTONE_BLOCK.defaultBlockState(),
|
| 163 | Blocks.POINTED_DRIPSTONE.defaultBlockState(),
|
| 164 | blocks.getOrThrow(BlockTags.DRIPSTONE_REPLACEABLE),
|
| 165 | 12,
|
| 166 | UniformInt.of(3, 6),
|
| 167 | UniformInt.of(2, 8),
|
| 168 | 1,
|
| 169 | 3,
|
| 170 | UniformInt.of(2, 4),
|
| 171 | UniformFloat.of(0.3F, 0.7F),
|
| 172 | ClampedNormalFloat.of(0.1F, 0.3F, 0.1F, 0.9F),
|
| 173 | 0.1F,
|
| 174 | 3,
|
| 175 | 8
|
| 176 | )
|
| 177 | );
|
| 178 | context.register(
|
| 179 | LARGE_DRIPSTONE,
|
| 180 | new LargeDripstoneFeature(
|
| 181 | blocks.getOrThrow(BlockTags.DRIPSTONE_REPLACEABLE),
|
| 182 | 30,
|
| 183 | ClampedInt.of(UniformInt.of(3, 19), 3, 16),
|
| 184 | UniformFloat.of(0.4F, 2.0F),
|
| 185 | 0.33F,
|
| 186 | UniformFloat.of(0.3F, 0.9F),
|
| 187 | UniformFloat.of(0.4F, 1.0F),
|
| 188 | UniformFloat.of(0.0F, 0.3F),
|
| 189 | 4,
|
| 190 | 0.6F
|
| 191 | )
|
| 192 | );
|
| 193 | context.register(
|
| 194 | POINTED_DRIPSTONE,
|
| 195 | new SimpleRandomSelectorFeature(
|
| 196 | HolderSet.direct(
|
| 197 | PlacementUtils.inlinePlaced(
|
| 198 | new SpeleothemFeature(
|
| 199 | Blocks.DRIPSTONE_BLOCK.defaultBlockState(),
|
| 200 | Blocks.POINTED_DRIPSTONE.defaultBlockState(),
|
| 201 | blocks.getOrThrow(BlockTags.DRIPSTONE_REPLACEABLE),
|
| 202 | 0.2F,
|
| 203 | 0.7F,
|
| 204 | 0.5F,
|
| 205 | 0.5F
|
| 206 | ),
|
| 207 | EnvironmentScanPlacement.scanningFor(Direction.DOWN, BlockPredicate.solid(), BlockPredicate.ONLY_IN_AIR_OR_WATER_PREDICATE, 12),
|
| 208 | OffsetPlacement.vertical(ConstantInt.of(1))
|
| 209 | ),
|
| 210 | PlacementUtils.inlinePlaced(
|
| 211 | new SpeleothemFeature(
|
| 212 | Blocks.DRIPSTONE_BLOCK.defaultBlockState(),
|
| 213 | Blocks.POINTED_DRIPSTONE.defaultBlockState(),
|
| 214 | blocks.getOrThrow(BlockTags.DRIPSTONE_REPLACEABLE),
|
| 215 | 0.2F,
|
| 216 | 0.7F,
|
| 217 | 0.5F,
|
| 218 | 0.5F
|
| 219 | ),
|
| 220 | EnvironmentScanPlacement.scanningFor(Direction.UP, BlockPredicate.solid(), BlockPredicate.ONLY_IN_AIR_OR_WATER_PREDICATE, 12),
|
| 221 | OffsetPlacement.vertical(ConstantInt.of(-1))
|
| 222 | )
|
| 223 | )
|
| 224 | )
|
| 225 | );
|
| 226 | context.register(
|
| 227 | SULFUR_SPIKE_CLUSTER,
|
| 228 | new SpeleothemClusterFeature(
|
| 229 | Blocks.SULFUR.defaultBlockState(),
|
| 230 | Blocks.SULFUR_SPIKE.defaultBlockState(),
|
| 231 | blocks.getOrThrow(BlockTags.SULFUR_SPIKE_REPLACEABLE),
|
| 232 | 12,
|
| 233 | UniformInt.of(1, 4),
|
| 234 | UniformInt.of(2, 8),
|
| 235 | 1,
|
| 236 | 3,
|
| 237 | UniformInt.of(2, 4),
|
| 238 | UniformFloat.of(0.3F, 0.7F),
|
| 239 | ConstantFloat.ZERO,
|
| 240 | 0.1F,
|
| 241 | 3,
|
| 242 | 8
|
| 243 | )
|
| 244 | );
|
| 245 | context.register(
|
| 246 | SULFUR_SPIKE,
|
| 247 | new SimpleRandomSelectorFeature(
|
| 248 | HolderSet.direct(
|
| 249 | PlacementUtils.inlinePlaced(
|
| 250 | new SpeleothemFeature(
|
| 251 | Blocks.SULFUR.defaultBlockState(),
|
| 252 | Blocks.SULFUR_SPIKE.defaultBlockState(),
|
| 253 | blocks.getOrThrow(BlockTags.SULFUR_SPIKE_REPLACEABLE),
|
| 254 | 0.2F,
|
| 255 | 0.7F,
|
| 256 | 0.5F,
|
| 257 | 0.5F
|
| 258 | ),
|
| 259 | EnvironmentScanPlacement.scanningFor(Direction.DOWN, BlockPredicate.solid(), BlockPredicate.ONLY_IN_AIR_OR_WATER_PREDICATE, 12),
|
| 260 | OffsetPlacement.vertical(ConstantInt.of(1))
|
| 261 | ),
|
| 262 | PlacementUtils.inlinePlaced(
|
| 263 | new SpeleothemFeature(
|
| 264 | Blocks.SULFUR.defaultBlockState(),
|
| 265 | Blocks.SULFUR_SPIKE.defaultBlockState(),
|
| 266 | blocks.getOrThrow(BlockTags.SULFUR_SPIKE_REPLACEABLE),
|
| 267 | 0.2F,
|
| 268 | 0.7F,
|
| 269 | 0.5F,
|
| 270 | 0.5F
|
| 271 | ),
|
| 272 | EnvironmentScanPlacement.scanningFor(Direction.UP, BlockPredicate.solid(), BlockPredicate.ONLY_IN_AIR_OR_WATER_PREDICATE, 12),
|
| 273 | OffsetPlacement.vertical(ConstantInt.of(-1))
|
| 274 | )
|
| 275 | )
|
| 276 | )
|
| 277 | );
|
| 278 | context.register(UNDERWATER_MAGMA, new UnderwaterMagmaFeature(5, 1, 0.5F));
|
| 279 | MultifaceSpreadeableBlock glowLichenBlock = (MultifaceSpreadeableBlock)Blocks.GLOW_LICHEN;
|
| 280 | context.register(
|
| 281 | GLOW_LICHEN,
|
| 282 | new MultifaceGrowthFeature(
|
| 283 | glowLichenBlock,
|
| 284 | 20,
|
| 285 | false,
|
| 286 | true,
|
| 287 | true,
|
| 288 | 0.5F,
|
| 289 | HolderSet.direct(
|
| 290 | Block::builtInRegistryHolder,
|
| 291 | Blocks.STONE,
|
| 292 | Blocks.ANDESITE,
|
| 293 | Blocks.DIORITE,
|
| 294 | Blocks.GRANITE,
|
| 295 | Blocks.DRIPSTONE_BLOCK,
|
| 296 | Blocks.CALCITE,
|
| 297 | Blocks.TUFF,
|
| 298 | Blocks.DEEPSLATE,
|
| 299 | Blocks.SULFUR,
|
| 300 | Blocks.CINNABAR
|
| 301 | )
|
| 302 | )
|
| 303 | );
|
| 304 | context.register(
|
| 305 | ROOTED_AZALEA_TREE,
|
| 306 | new RootSystemFeature(
|
| 307 | PlacementUtils.inlinePlaced(configuredFeatures.getOrThrow(TreeFeatures.AZALEA_TREE)),
|
| 308 | 3,
|
| 309 | 0,
|
| 310 | 0,
|
| 311 | 3,
|
| 312 | blocks.getOrThrow(BlockTags.AZALEA_ROOT_REPLACEABLE),
|
| 313 | BlockStateProvider.holderOf(Blocks.ROOTED_DIRT),
|
| 314 | 20,
|
| 315 | 100,
|
| 316 | 3,
|
| 317 | 2,
|
| 318 | BlockStateProvider.holderOf(Blocks.HANGING_ROOTS),
|
| 319 | 20,
|
| 320 | 2,
|
| 321 | BlockPredicate.allOf(
|
| 322 | BlockPredicate.anyOf(BlockPredicate.ONLY_IN_AIR_PREDICATE, BlockPredicate.matchesTag(BlockTags.REPLACEABLE_BY_TREES)),
|
| 323 | BlockPredicate.matchesTag(Direction.DOWN, BlockTags.AZALEA_GROWS_ON)
|
| 324 | )
|
| 325 | )
|
| 326 | );
|
| 327 | context.register(
|
| 328 | ROOTED_SULFUR_SPRING,
|
| 329 | new RootSystemFeature(
|
| 330 | PlacementUtils.inlinePlaced(configuredFeatures.getOrThrow(MiscOverworldFeatures.SULFUR_SPRING)),
|
| 331 | 5,
|
| 332 | 8,
|
| 333 | 2,
|
| 334 | 3,
|
| 335 | blocks.getOrThrow(BlockTags.AZALEA_ROOT_REPLACEABLE),
|
| 336 | BlockStateProvider.holderOf(Blocks.SULFUR),
|
| 337 | 20,
|
| 338 | 184,
|
| 339 | 1,
|
| 340 | 1,
|
| 341 | BlockStateProvider.holderOf(Blocks.SULFUR),
|
| 342 | 1,
|
| 343 | 1,
|
| 344 | BlockPredicate.ONLY_IN_AIR_PREDICATE
|
| 345 | )
|
| 346 | );
|
| 347 | Holder<BlockStateProvider> caveVinesBodyProvider = blockStateProviders.getOrThrow(BlockStateProviders.CAVE_VINES_BODY);
|
| 348 | Holder<BlockStateProvider> caveVinesHeadProvider = blockStateProviders.getOrThrow(BlockStateProviders.CAVE_VINES_HEAD);
|
| 349 | context.register(
|
| 350 | CAVE_VINE,
|
| 351 | new BlockColumnFeature(
|
| 352 | List.of(
|
| 353 | BlockColumnFeature.layer(
|
| 354 | new WeightedListInt(WeightedList.<IntProvider>builder().add(UniformInt.of(0, 19), 2).add(UniformInt.of(0, 2), 3).add(UniformInt.of(0, 6), 10).build()),
|
| 355 | caveVinesBodyProvider
|
| 356 | ),
|
| 357 | BlockColumnFeature.layer(ConstantInt.of(1), caveVinesHeadProvider)
|
| 358 | ),
|
| 359 | Direction.DOWN,
|
| 360 | BlockPredicate.ONLY_IN_AIR_PREDICATE,
|
| 361 | true
|
| 362 | )
|
| 363 | );
|
| 364 | context.register(
|
| 365 | CAVE_VINE_IN_MOSS,
|
| 366 | new BlockColumnFeature(
|
| 367 | List.of(
|
| 368 | BlockColumnFeature.layer(
|
| 369 | new WeightedListInt(WeightedList.<IntProvider>builder().add(UniformInt.of(0, 3), 5).add(UniformInt.of(1, 7), 1).build()), caveVinesBodyProvider
|
| 370 | ),
|
| 371 | BlockColumnFeature.layer(ConstantInt.of(1), caveVinesHeadProvider)
|
| 372 | ),
|
| 373 | Direction.DOWN,
|
| 374 | BlockPredicate.ONLY_IN_AIR_PREDICATE,
|
| 375 | true
|
| 376 | )
|
| 377 | );
|
| 378 | context.register(
|
| 379 | MOSS_VEGETATION,
|
| 380 | new SimpleBlockFeature(
|
| 381 | new WeightedStateProvider(
|
| 382 | WeightedList.<BlockState>builder()
|
| 383 | .add(Blocks.FLOWERING_AZALEA.defaultBlockState(), 4)
|
| 384 | .add(Blocks.AZALEA.defaultBlockState(), 7)
|
| 385 | .add(Blocks.MOSS_CARPET.defaultBlockState(), 25)
|
| 386 | .add(Blocks.SHORT_GRASS.defaultBlockState(), 50)
|
| 387 | .add(Blocks.TALL_GRASS.defaultBlockState(), 10)
|
| 388 | )
|
| 389 | )
|
| 390 | );
|
| 391 | context.register(
|
| 392 | MOSS_PATCH,
|
| 393 | new VegetationPatchFeature(
|
| 394 | blocks.getOrThrow(BlockTags.MOSS_REPLACEABLE),
|
| 395 | BlockStateProvider.holderOf(Blocks.MOSS_BLOCK),
|
| 396 | PlacementUtils.inlinePlaced(configuredFeatures.getOrThrow(MOSS_VEGETATION)),
|
| 397 | CaveSurface.FLOOR,
|
| 398 | ConstantInt.of(1),
|
| 399 | 0.0F,
|
| 400 | 5,
|
| 401 | 0.8F,
|
| 402 | UniformInt.of(4, 7),
|
| 403 | 0.3F
|
| 404 | )
|
| 405 | );
|
| 406 | context.register(
|
| 407 | MOSS_PATCH_BONEMEAL,
|
| 408 | new VegetationPatchFeature(
|
| 409 | blocks.getOrThrow(BlockTags.MOSS_REPLACEABLE),
|
| 410 | BlockStateProvider.holderOf(Blocks.MOSS_BLOCK),
|
| 411 | PlacementUtils.inlinePlaced(configuredFeatures.getOrThrow(MOSS_VEGETATION)),
|
| 412 | CaveSurface.FLOOR,
|
| 413 | ConstantInt.of(1),
|
| 414 | 0.0F,
|
| 415 | 5,
|
| 416 | 0.6F,
|
| 417 | UniformInt.of(1, 2),
|
| 418 | 0.75F
|
| 419 | )
|
| 420 | );
|
| 421 | context.register(
|
| 422 | DRIPLEAF,
|
| 423 | new SimpleRandomSelectorFeature(
|
| 424 | HolderSet.direct(
|
| 425 | makeSmallDripleaf(), makeDripleaf(Direction.EAST), makeDripleaf(Direction.WEST), makeDripleaf(Direction.SOUTH), makeDripleaf(Direction.NORTH)
|
| 426 | )
|
| 427 | )
|
| 428 | );
|
| 429 | context.register(
|
| 430 | CLAY_WITH_DRIPLEAVES,
|
| 431 | new VegetationPatchFeature(
|
| 432 | blocks.getOrThrow(BlockTags.LUSH_GROUND_REPLACEABLE),
|
| 433 | BlockStateProvider.holderOf(Blocks.CLAY),
|
| 434 | PlacementUtils.inlinePlaced(configuredFeatures.getOrThrow(DRIPLEAF)),
|
| 435 | CaveSurface.FLOOR,
|
| 436 | ConstantInt.of(3),
|
| 437 | 0.8F,
|
| 438 | 2,
|
| 439 | 0.05F,
|
| 440 | UniformInt.of(4, 7),
|
| 441 | 0.7F
|
| 442 | )
|
| 443 | );
|
| 444 | context.register(
|
| 445 | CLAY_POOL_WITH_DRIPLEAVES,
|
| 446 | new WaterloggedVegetationPatchFeature(
|
| 447 | blocks.getOrThrow(BlockTags.LUSH_GROUND_REPLACEABLE),
|
| 448 | BlockStateProvider.holderOf(Blocks.CLAY),
|
| 449 | PlacementUtils.inlinePlaced(configuredFeatures.getOrThrow(DRIPLEAF)),
|
| 450 | CaveSurface.FLOOR,
|
| 451 | ConstantInt.of(3),
|
| 452 | 0.8F,
|
| 453 | 5,
|
| 454 | 0.1F,
|
| 455 | UniformInt.of(4, 7),
|
| 456 | 0.7F
|
| 457 | )
|
| 458 | );
|
| 459 | context.register(
|
| 460 | LUSH_CAVES_CLAY,
|
| 461 | new RandomBooleanSelectorFeature(
|
| 462 | PlacementUtils.inlinePlaced(configuredFeatures.getOrThrow(CLAY_WITH_DRIPLEAVES)),
|
| 463 | PlacementUtils.inlinePlaced(configuredFeatures.getOrThrow(CLAY_POOL_WITH_DRIPLEAVES))
|
| 464 | )
|
| 465 | );
|
| 466 | context.register(
|
| 467 | MOSS_PATCH_CEILING,
|
| 468 | new VegetationPatchFeature(
|
| 469 | blocks.getOrThrow(BlockTags.MOSS_REPLACEABLE),
|
| 470 | BlockStateProvider.holderOf(Blocks.MOSS_BLOCK),
|
| 471 | PlacementUtils.inlinePlaced(configuredFeatures.getOrThrow(CAVE_VINE_IN_MOSS)),
|
| 472 | CaveSurface.CEILING,
|
| 473 | UniformInt.of(1, 2),
|
| 474 | 0.0F,
|
| 475 | 5,
|
| 476 | 0.08F,
|
| 477 | UniformInt.of(4, 7),
|
| 478 | 0.3F
|
| 479 | )
|
| 480 | );
|
| 481 | context.register(SPORE_BLOSSOM, new SimpleBlockFeature(BlockStateProvider.of(Blocks.SPORE_BLOSSOM)));
|
| 482 | context.register(
|
| 483 | AMETHYST_GEODE,
|
| 484 | new GeodeFeature(
|
| 485 | new GeodeBlockSettings(
|
| 486 | BlockStateProvider.holderOf(Blocks.AIR),
|
| 487 | BlockStateProvider.holderOf(Blocks.AMETHYST_BLOCK),
|
| 488 | BlockStateProvider.holderOf(Blocks.BUDDING_AMETHYST),
|
| 489 | BlockStateProvider.holderOf(Blocks.CALCITE),
|
| 490 | BlockStateProvider.holderOf(Blocks.SMOOTH_BASALT),
|
| 491 | List.of(
|
| 492 | Blocks.SMALL_AMETHYST_BUD.defaultBlockState(),
|
| 493 | Blocks.MEDIUM_AMETHYST_BUD.defaultBlockState(),
|
| 494 | Blocks.LARGE_AMETHYST_BUD.defaultBlockState(),
|
| 495 | Blocks.AMETHYST_CLUSTER.defaultBlockState()
|
| 496 | ),
|
| 497 | blocks.getOrThrow(BlockTags.FEATURES_CANNOT_REPLACE),
|
| 498 | blocks.getOrThrow(BlockTags.GEODE_INVALID_BLOCKS)
|
| 499 | ),
|
| 500 | new GeodeLayerSettings(1.7, 2.2, 3.2, 4.2),
|
| 501 | new GeodeCrackSettings(0.95, 2.0, 2),
|
| 502 | 0.35,
|
| 503 | 0.083,
|
| 504 | true,
|
| 505 | UniformInt.of(4, 6),
|
| 506 | UniformInt.of(3, 4),
|
| 507 | UniformInt.of(1, 2),
|
| 508 | -16,
|
| 509 | 16,
|
| 510 | 0.05,
|
| 511 | 1
|
| 512 | )
|
| 513 | );
|
| 514 | Holder<PlacedFeature> sculkPatchCatalyst = PlacementUtils.inlinePlaced(
|
| 515 | new SimpleBlockFeature(BlockStateProvider.of(Blocks.SCULK_CATALYST)),
|
| 516 | new RandomChancePlacement(0.5F),
|
| 517 | BlockPredicateFilter.forPredicate(BlockPredicate.hasSturdyFace(Direction.DOWN, Direction.UP))
|
| 518 | );
|
| 519 | context.register(
|
| 520 | SCULK_PATCH_DEEP_DARK, new SequenceFeature(HolderSet.direct(PlacementUtils.inlinePlaced(new SculkPatchFeature(10, 32, 64, 0, 1)), sculkPatchCatalyst))
|
| 521 | );
|
| 522 | Holder<PlacedFeature> sculkPatchShriekers = PlacementUtils.inlinePlaced(
|
| 523 | new SimpleBlockFeature(BlockStateProvider.of(Blocks.SCULK_SHRIEKER.defaultBlockState().setValue(SculkShriekerBlock.CAN_SUMMON, true))),
|
| 524 | CountPlacement.of(UniformInt.of(1, 3)),
|
| 525 | OffsetPlacement.of(UniformInt.of(-2, 2), UniformInt.of(-2, 2)),
|
| 526 | BlockPredicateFilter.forPredicate(BlockPredicate.allOf(BlockPredicate.ONLY_IN_AIR_PREDICATE, BlockPredicate.hasSturdyFace(Direction.DOWN, Direction.UP)))
|
| 527 | );
|
| 528 | context.register(
|
| 529 | SCULK_PATCH_ANCIENT_CITY,
|
| 530 | new SequenceFeature(
|
| 531 | HolderSet.direct(
|
| 532 | PlacementUtils.inlinePlaced(new SculkPatchFeature(10, 32, 64, 0, 1)),
|
| 533 | PlacementUtils.inlinePlaced(new OverlayFeature(HolderSet.direct(sculkPatchCatalyst, sculkPatchShriekers)))
|
| 534 | )
|
| 535 | )
|
| 536 | );
|
| 537 | MultifaceSpreadeableBlock sculkVeinBlock = (MultifaceSpreadeableBlock)Blocks.SCULK_VEIN;
|
| 538 | context.register(
|
| 539 | SCULK_VEIN,
|
| 540 | new MultifaceGrowthFeature(
|
| 541 | sculkVeinBlock,
|
| 542 | 20,
|
| 543 | true,
|
| 544 | true,
|
| 545 | true,
|
| 546 | 1.0F,
|
| 547 | HolderSet.direct(
|
| 548 | Block::builtInRegistryHolder,
|
| 549 | Blocks.STONE,
|
| 550 | Blocks.ANDESITE,
|
| 551 | Blocks.DIORITE,
|
| 552 | Blocks.GRANITE,
|
| 553 | Blocks.DRIPSTONE_BLOCK,
|
| 554 | Blocks.CALCITE,
|
| 555 | Blocks.TUFF,
|
| 556 | Blocks.DEEPSLATE
|
| 557 | )
|
| 558 | )
|
| 559 | );
|
| 560 | }
|
| 561 | }
|
| 562 |
|