lundi 3 août 2015

Get a random location with min, max but hollow inside

Currently I have this code.

public static Location getRandomLocation(int min, int max, World w) {
    int x = CommonUtils.randomInt(min, max);
    int y = 255;
    int z = CommonUtils.randomInt(min, max);
    while (w.getBlockAt(x, y, z).getType() == Material.AIR) {
        y--;
    }
    return w.getBlockAt(x, y + 1, z).getLocation();
}

The problem is that it only randomizes a random location at one point here's what I mean: http://ift.tt/1UhDsWO

How would I do it so it would generate around the min point not in just one chunk like this: http://ift.tt/1DmBzn3




Aucun commentaire:

Enregistrer un commentaire