aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMyles <mylesandmore9@gmail.com>2022-11-27 20:50:45 -0600
committerMyles <mylesandmore9@gmail.com>2022-11-27 20:50:45 -0600
commitbc78a63afcfe4545de8c89673d99bf8b4dd926bf (patch)
tree4d88d558b2aa9490ace3765d54f502e23974749c /src/main
parent5c9b629dced16347ee5ba24c70fa0d9bd5509502 (diff)
downloadTumble-bc78a63afcfe4545de8c89673d99bf8b4dd926bf.tar.gz
Tumble-bc78a63afcfe4545de8c89673d99bf8b4dd926bf.tar.bz2
Tumble-bc78a63afcfe4545de8c89673d99bf8b4dd926bf.zip
add cyl support in generator
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/MylesAndMore/tumble/api/Generator.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main/java/com/MylesAndMore/tumble/api/Generator.java b/src/main/java/com/MylesAndMore/tumble/api/Generator.java
index 99850e9..632627d 100644
--- a/src/main/java/com/MylesAndMore/tumble/api/Generator.java
+++ b/src/main/java/com/MylesAndMore/tumble/api/Generator.java
@@ -5,7 +5,7 @@ import org.bukkit.Material;
import org.bukkit.World;
public class Generator {
- public static void generateLayer(Location center, int radius, Material material) {
+ public static void generateLayer(Location center, int radius, int height, Material material) {
int Cx = center.getBlockX();
int Cy = center.getBlockY();
int Cz = center.getBlockZ();
@@ -13,11 +13,13 @@ public class Generator {
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);
+ for (int y = Cy; y < Cy + height; y++) {
+ 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, y, z);
+ world.getBlockAt(x, y, z).setType(material);
+ }
}
}
}