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

package com.hypixel.hytale.procedurallib.condition;

import javax.annotation.Nonnull;
import java.util.Random;

public class HeightCondition implements ICoordinateRndCondition
{
    protected final IHeightThresholdInterpreter interpreter;
    
    public HeightCondition(final IHeightThresholdInterpreter interpreter) {
        this.interpreter = interpreter;
    }
    
    @Override
    public boolean eval(final int seed, final int x, final int z, final int y, @Nonnull final Random random) {
        final double threshold = this.interpreter.getThreshold(seed, x, z, y);
        return threshold > 0.0 && (threshold >= 1.0 || threshold > random.nextDouble());
    }
    
    @Nonnull
    @Override
    public String toString() {
        return "HeightCondition{interpreter=" + String.valueOf(this.interpreter);
    }
}
