blob: 99850e9f92c3ae0a8861f3341fc60bebc8b4ef83 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package com.MylesAndMore.tumble.api;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
public class Generator {
public static void generateLayer(Location center, int radius, Material material) {
int Cx = center.getBlockX();
int Cy = center.getBlockY();
int Cz = center.getBlockZ();
World world = center.getWorld();
int rSq = radius * radius;
for (int x = Cx - radius; x <= Cx + radius; x++) {
for (int z = Cz - radius; z <= Cz + radius; z++) {
if ((Cx - x) * (Cx - x) + (Cz - z) * (Cz - z) <= rSq) {
Location block = new Location(world, x, Cy, z);
world.getBlockAt(x, Cy, z).setType(material);
}
}
}
}
}
|