From f910fe4e661ae9698d114df022d8626a4b011db0 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Thu, 17 May 2012 12:16:38 +0200 Subject: [PATCH] Added //generate -c, which offsets the input coordinates from the selection center. --- .../com/sk89q/worldedit/commands/GenerationCommands.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/sk89q/worldedit/commands/GenerationCommands.java b/src/main/java/com/sk89q/worldedit/commands/GenerationCommands.java index f4f3b7bab..c6c53511c 100644 --- a/src/main/java/com/sk89q/worldedit/commands/GenerationCommands.java +++ b/src/main/java/com/sk89q/worldedit/commands/GenerationCommands.java @@ -331,9 +331,10 @@ public class GenerationCommands { " -h to generate a hollow shape\n" + " -r to use raw minecraft coordinates\n" + " -o is like -r, except offset from placement.\n" + + " -c is like -r, except offset selection center.\n" + "If neither -r nor -o is given, the selection is mapped to -1..1\n" + "See also tinyurl.com/wesyntax.", - flags = "hro", + flags = "hroc", min = 1, max = -1 ) @@ -358,6 +359,12 @@ public class GenerationCommands { } else if (args.hasFlag('o')) { zero = session.getPlacementPosition(player); unit = new Vector(1, 1, 1); + } else if (args.hasFlag('c')) { + final Vector min = region.getMinimumPoint(); + final Vector max = region.getMaximumPoint(); + + zero = max.add(min).multiply(0.5); + unit = new Vector(1, 1, 1); } else { final Vector min = region.getMinimumPoint(); final Vector max = region.getMaximumPoint();