From bc78a63afcfe4545de8c89673d99bf8b4dd926bf Mon Sep 17 00:00:00 2001 From: Myles Date: Sun, 27 Nov 2022 20:50:45 -0600 Subject: add cyl support in generator --- src/main/java/com/MylesAndMore/tumble/api/Generator.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/main/java/com') 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); + } } } } -- cgit v1.2.3