// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.builtin.hytalegenerator.density.nodes;

import com.hypixel.hytale.builtin.hytalegenerator.framework.math.Calculator;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.hypixel.hytale.builtin.hytalegenerator.density.Density;

public class SmoothFloorDensity extends Density
{
    private double limit;
    private double smoothRange;
    @Nullable
    private Density input;
    
    public SmoothFloorDensity(final double limit, final double smoothRange, final Density input) {
        if (smoothRange < 0.0) {
            throw new IllegalArgumentException();
        }
        this.limit = limit;
        this.smoothRange = smoothRange;
        this.input = input;
    }
    
    @Override
    public double process(@Nonnull final Context context) {
        if (this.input == null) {
            return 0.0;
        }
        return Calculator.smoothMax(this.smoothRange, this.input.process(context), this.limit);
    }
    
    @Override
    public void setInputs(@Nonnull final Density[] inputs) {
        if (inputs.length == 0) {
            this.input = null;
        }
        this.input = inputs[0];
    }
}
