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

import net.minecraft.world.level.block.Blocks;
import java.util.function.Function;
import com.mojang.datafixers.Dynamic;
import net.minecraft.world.level.block.state.BlockState;

public class SurfaceBuilderBaseConfiguration implements SurfaceBuilderConfiguration {
    private final BlockState topMaterial;
    private final BlockState underMaterial;
    private final BlockState underwaterMaterial;
    
    public SurfaceBuilderBaseConfiguration(final BlockState byj1, final BlockState byj2, final BlockState byj3) {
        this.topMaterial = byj1;
        this.underMaterial = byj2;
        this.underwaterMaterial = byj3;
    }
    
    @Override
    public BlockState getTopMaterial() {
        return this.topMaterial;
    }
    
    @Override
    public BlockState getUnderMaterial() {
        return this.underMaterial;
    }
    
    public BlockState getUnderwaterMaterial() {
        return this.underwaterMaterial;
    }
    
    public static SurfaceBuilderBaseConfiguration deserialize(final Dynamic<?> dynamic) {
        final BlockState byj2 = dynamic.get("top_material").map((Function)BlockState::deserialize).orElse(Blocks.AIR.defaultBlockState());
        final BlockState byj3 = dynamic.get("under_material").map((Function)BlockState::deserialize).orElse(Blocks.AIR.defaultBlockState());
        final BlockState byj4 = dynamic.get("underwater_material").map((Function)BlockState::deserialize).orElse(Blocks.AIR.defaultBlockState());
        return new SurfaceBuilderBaseConfiguration(byj2, byj3, byj4);
    }
}
