/* * Decompiled with CFR 0.152. */ 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.features.AquaticFeatures; import net.minecraft.data.worldgen.features.CaveFeatures; import net.minecraft.data.worldgen.features.EndFeatures; import net.minecraft.data.worldgen.features.MiscOverworldFeatures; import net.minecraft.data.worldgen.features.NetherFeatures; import net.minecraft.data.worldgen.features.OreFeatures; import net.minecraft.data.worldgen.features.PileFeatures; import net.minecraft.data.worldgen.features.TreeFeatures; import net.minecraft.data.worldgen.features.VegetationFeatures; import net.minecraft.data.worldgen.placement.PlacementUtils; import net.minecraft.resources.Identifier; import net.minecraft.resources.ResourceKey; 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> context) { AquaticFeatures.bootstrap(context); CaveFeatures.bootstrap(context); EndFeatures.bootstrap(context); MiscOverworldFeatures.bootstrap(context); NetherFeatures.bootstrap(context); OreFeatures.bootstrap(context); PileFeatures.bootstrap(context); TreeFeatures.bootstrap(context); VegetationFeatures.bootstrap(context); } private static BlockPredicate simplePatchPredicate(List allowedOn) { BlockPredicate predicate = !allowedOn.isEmpty() ? BlockPredicate.allOf(BlockPredicate.ONLY_IN_AIR_PREDICATE, BlockPredicate.matchesBlocks(Direction.DOWN.getUnitVec3i(), allowedOn)) : BlockPredicate.ONLY_IN_AIR_PREDICATE; return predicate; } public static RandomPatchConfiguration simpleRandomPatchConfiguration(int tries, Holder feature) { return new RandomPatchConfiguration(tries, 7, 3, feature); } public static > RandomPatchConfiguration simplePatchConfiguration(F feature, FC config, List allowedOn, int tries) { return FeatureUtils.simpleRandomPatchConfiguration(tries, PlacementUtils.filtered(feature, config, FeatureUtils.simplePatchPredicate(allowedOn))); } public static > RandomPatchConfiguration simplePatchConfiguration(F feature, FC config, List allowedOn) { return FeatureUtils.simplePatchConfiguration(feature, config, allowedOn, 96); } public static > RandomPatchConfiguration simplePatchConfiguration(F feature, FC config) { return FeatureUtils.simplePatchConfiguration(feature, config, List.of(), 96); } public static ResourceKey> createKey(String name) { return ResourceKey.create(Registries.CONFIGURED_FEATURE, Identifier.withDefaultNamespace(name)); } public static void register(BootstrapContext> context, ResourceKey> id, Feature feature) { FeatureUtils.register(context, id, feature, FeatureConfiguration.NONE); } public static > void register(BootstrapContext> context, ResourceKey> id, F feature, FC config) { context.register(id, new ConfiguredFeature(feature, config)); } }