All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fastasyncworldedit.core.function.mask.SimplexMask Maven / Gradle / Ivy

Go to download

Blazingly fast Minecraft world manipulation for artists, builders and everyone else.

There is a newer version: 2.9.2
Show newest version
package com.fastasyncworldedit.core.function.mask;

import com.fastasyncworldedit.core.math.random.SimplexNoise;
import com.sk89q.worldedit.function.mask.AbstractMask;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;

public class SimplexMask extends AbstractMask {

    private final double min;
    private final double max;
    private final double scale;

    public SimplexMask(double scale, double min, double max) {
        this.scale = scale;
        this.min = min;
        this.max = max;
    }

    @Override
    public boolean test(BlockVector3 vector) {
        double value = SimplexNoise.noise(vector.getBlockX() * scale, vector.getBlockY() * scale, vector.getBlockZ() * scale);
        return value >= min && value <= max;
    }

    @Override
    public Mask copy() {
        // The mask is not mutable. There is no need to clone it.
        return this;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy