package net.minecraft.world.level.levelgen.feature.configurations;

import java.util.function.BiFunction;
import com.mojang.datafixers.kinds.App;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.WeightedConfiguredFeature;
import java.util.List;
import com.mojang.serialization.Codec;

public class RandomFeatureConfiguration implements FeatureConfiguration {
    public static final Codec<RandomFeatureConfiguration> CODEC;
    public final List<WeightedConfiguredFeature<?>> features;
    public final ConfiguredFeature<?, ?> defaultFeature;
    
    public RandomFeatureConfiguration(final List<WeightedConfiguredFeature<?>> list, final ConfiguredFeature<?, ?> ckb) {
        this.features = list;
        this.defaultFeature = ckb;
    }
    
    static {
        CODEC = RecordCodecBuilder.create(instance -> instance.apply2((BiFunction)RandomFeatureConfiguration::new, (App)WeightedConfiguredFeature.CODEC.listOf().fieldOf("features").forGetter(cof -> cof.features), (App)ConfiguredFeature.CODEC.fieldOf("default").forGetter(cof -> cof.defaultFeature)));
    }
}
