package net.minecraft.data.worldgen.features; import java.util.List; import net.minecraft.core.Direction; import net.minecraft.core.Holder; import net.minecraft.core.registries.Registries; import net.minecraft.data.worldgen.BootstrapContext; import net.minecraft.data.worldgen.placement.PlacementUtils; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.RandomPatchConfiguration; import net.minecraft.world.level.levelgen.placement.PlacedFeature; public class FeatureUtils { public static void bootstrap(BootstrapContext> p_331696_) { AquaticFeatures.bootstrap(p_331696_); CaveFeatures.bootstrap(p_331696_); EndFeatures.bootstrap(p_331696_); MiscOverworldFeatures.bootstrap(p_331696_); NetherFeatures.bootstrap(p_331696_); OreFeatures.bootstrap(p_331696_); PileFeatures.bootstrap(p_331696_); TreeFeatures.bootstrap(p_331696_); VegetationFeatures.bootstrap(p_331696_); } private static BlockPredicate simplePatchPredicate(List p_195009_) { BlockPredicate blockpredicate; if (!p_195009_.isEmpty()) { blockpredicate = BlockPredicate.allOf(BlockPredicate.ONLY_IN_AIR_PREDICATE, BlockPredicate.matchesBlocks(Direction.DOWN.getUnitVec3i(), p_195009_)); } else { blockpredicate = BlockPredicate.ONLY_IN_AIR_PREDICATE; } return blockpredicate; } public static RandomPatchConfiguration simpleRandomPatchConfiguration(int p_206471_, Holder p_206472_) { return new RandomPatchConfiguration(p_206471_, 7, 3, p_206472_); } public static > RandomPatchConfiguration simplePatchConfiguration( F p_206481_, FC p_206482_, List p_206483_, int p_206484_ ) { return simpleRandomPatchConfiguration(p_206484_, PlacementUtils.filtered(p_206481_, p_206482_, simplePatchPredicate(p_206483_))); } public static > RandomPatchConfiguration simplePatchConfiguration(F p_206477_, FC p_206478_, List p_206479_) { return simplePatchConfiguration(p_206477_, p_206478_, p_206479_, 96); } public static > RandomPatchConfiguration simplePatchConfiguration(F p_206474_, FC p_206475_) { return simplePatchConfiguration(p_206474_, p_206475_, List.of(), 96); } public static ResourceKey> createKey(String p_255643_) { return ResourceKey.create(Registries.CONFIGURED_FEATURE, ResourceLocation.withDefaultNamespace(p_255643_)); } public static void register( BootstrapContext> p_331914_, ResourceKey> p_256555_, Feature p_255921_ ) { register(p_331914_, p_256555_, p_255921_, FeatureConfiguration.NONE); } public static > void register( BootstrapContext> p_330706_, ResourceKey> p_255983_, F p_255949_, FC p_256398_ ) { p_330706_.register(p_255983_, new ConfiguredFeature(p_255949_, p_256398_)); } }