Added flag to //smooth to only use "natural" blocks

This commit is contained in:
zml2008
2011-08-17 00:33:46 -07:00
parent c99d64cfa0
commit 2b94ddf7ed
6 changed files with 47 additions and 31 deletions

View File

@ -171,6 +171,7 @@ public class BrushCommands {
@Command(
aliases = {"smooth"},
usage = "[size] [iterations]",
flags = "n",
desc = "Choose the terrain softener brush",
min = 0,
max = 2
@ -193,9 +194,9 @@ public class BrushCommands {
BrushTool tool = session.getBrushTool(player.getItemInHand());
tool.setSize(radius);
tool.setBrush(new SmoothBrush(iterations), "worldedit.brush.smooth");
tool.setBrush(new SmoothBrush(iterations, args.hasFlag('n')), "worldedit.brush.smooth");
player.print(String.format("Smooth brush equipped (%.0f x %dx).",
player.print(String.format("Smooth brush equipped (%.0f x %dx, using " + (args.hasFlag('n') ? "natural blocks only" : "any block") + ").",
radius, iterations));
}

View File

@ -186,6 +186,7 @@ public class RegionCommands {
@Command(
aliases = {"/smooth"},
usage = "[iterations]",
flags = "n",
desc = "Smooth the elevation in the selection",
min = 0,
max = 1
@ -201,7 +202,7 @@ public class RegionCommands {
iterations = args.getInteger(0);
}
HeightMap heightMap = new HeightMap(editSession, session.getSelection(player.getWorld()));
HeightMap heightMap = new HeightMap(editSession, session.getSelection(player.getWorld()), args.hasFlag('n'));
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
int affected = heightMap.applyFilter(filter, iterations);
player.print("Terrain's height map smoothed. " + affected + " block(s) changed.");