package net.minecraft.world.level.levelgen.surfacebuilders;

import com.mojang.datafixers.kinds.Applicative;
import com.mojang.datafixers.kinds.App;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.world.level.block.state.BlockState;
import com.mojang.serialization.Codec;

public class SurfaceBuilderBaseConfiguration implements SurfaceBuilderConfiguration {
    public static final Codec<SurfaceBuilderBaseConfiguration> CODEC;
    private final BlockState topMaterial;
    private final BlockState underMaterial;
    private final BlockState underwaterMaterial;
    
    public SurfaceBuilderBaseConfiguration(final BlockState cfj1, final BlockState cfj2, final BlockState cfj3) {
        this.topMaterial = cfj1;
        this.underMaterial = cfj2;
        this.underwaterMaterial = cfj3;
    }
    
    @Override
    public BlockState getTopMaterial() {
        return this.topMaterial;
    }
    
    @Override
    public BlockState getUnderMaterial() {
        return this.underMaterial;
    }
    
    public BlockState getUnderwaterMaterial() {
        return this.underwaterMaterial;
    }
    
    static {
        CODEC = RecordCodecBuilder.create(instance -> ((RecordCodecBuilder.Instance)instance).group((App)BlockState.CODEC.fieldOf("top_material").forGetter(cvx -> cvx.topMaterial), (App)BlockState.CODEC.fieldOf("under_material").forGetter(cvx -> cvx.underMaterial), (App)BlockState.CODEC.fieldOf("underwater_material").forGetter(cvx -> cvx.underwaterMaterial)).apply(instance, SurfaceBuilderBaseConfiguration::new));
    }
}
