From 143d998a9d6df2ce69594e90e88cc9e9be8c48a1 Mon Sep 17 00:00:00 2001 From: Myles Date: Sun, 11 Dec 2022 16:32:32 -0600 Subject: add new layer types and gen types --- .../com/MylesAndMore/tumble/api/Generator.java | 51 ++++++++++++---------- 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'src/main/java/com/MylesAndMore/tumble/api/Generator.java') diff --git a/src/main/java/com/MylesAndMore/tumble/api/Generator.java b/src/main/java/com/MylesAndMore/tumble/api/Generator.java index d66352a..0a35767 100644 --- a/src/main/java/com/MylesAndMore/tumble/api/Generator.java +++ b/src/main/java/com/MylesAndMore/tumble/api/Generator.java @@ -44,6 +44,33 @@ public class Generator { return blocks; } + /** + * Generates a cubiod (literally just a ripoff fill command) + * @param firstPos The first Location to fill (first three coords in a fill command) + * @param secondPos The second Location to fill to (second three coords) + * @param material The Material to fill + */ + public static List generateCuboid(Location firstPos, Location secondPos, Material material) { + World world = firstPos.getWorld(); + List blocks = new ArrayList<>(); + int fX = firstPos.getBlockX(); + int fY = firstPos.getBlockY(); + int fZ = firstPos.getBlockZ(); + int sX = secondPos.getBlockX(); + int sY = secondPos.getBlockY(); + int sZ = secondPos.getBlockZ(); + + for (int x = fX; x <= sX; x++) { + for (int y = fY; y <= sY; y++) { + for (int z = fZ; z <= sZ; z++) { + world.getBlockAt(x, y, z).setType(material); + blocks.add(world.getBlockAt(x, y, z)); + } + } + } + return blocks; + } + /** * Generates clumps in a pre-generated layer. * @param blockList A list of block Locations that this method is allowed to edit @@ -87,28 +114,4 @@ public class Generator { blocks.remove(aBlock); } } - - /** - * Generates a cubiod (literally just a ripoff fill command) - * @param firstPos The first Location to fill (first three coords in a fill command) - * @param secondPos The second Location to fill to (second three coords) - * @param material The Material to fill - */ - public static void generateCuboid(Location firstPos, Location secondPos, Material material) { - World world = firstPos.getWorld(); - int fX = firstPos.getBlockX(); - int fY = firstPos.getBlockY(); - int fZ = firstPos.getBlockZ(); - int sX = secondPos.getBlockX(); - int sY = secondPos.getBlockY(); - int sZ = secondPos.getBlockZ(); - - for (int x = fX; x <= sX; x++) { - for (int y = fY; y <= sY; y++) { - for (int z = fZ; z <= sZ; z++) { - world.getBlockAt(x, y, z).setType(material); - } - } - } - } } -- cgit v1.2.3