mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-05 20:36:42 +00:00
Remove the 'natural only' smooth brush feature due to inaccuracies.
This commit is contained in:
@ -158,27 +158,23 @@ public class BrushCommands {
|
||||
@Command(
|
||||
aliases = { "smooth" },
|
||||
usage = "[size] [iterations]",
|
||||
flags = "n",
|
||||
desc = "Choose the terrain softener brush",
|
||||
help =
|
||||
"Chooses the terrain softener brush.\n" +
|
||||
"The -n flag makes it only consider naturally occurring blocks.",
|
||||
"Chooses the terrain softener brush.",
|
||||
min = 0,
|
||||
max = 2
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.smooth")
|
||||
public void smoothBrush(Player player, LocalSession session, EditSession editSession,
|
||||
@Optional("2") double radius, @Optional("4") int iterations, @Switch('n')
|
||||
boolean naturalBlocksOnly) throws WorldEditException {
|
||||
@Optional("2") double radius, @Optional("4") int iterations) throws WorldEditException {
|
||||
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
|
||||
BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
|
||||
tool.setSize(radius);
|
||||
tool.setBrush(new SmoothBrush(iterations, naturalBlocksOnly), "worldedit.brush.smooth");
|
||||
tool.setBrush(new SmoothBrush(iterations), "worldedit.brush.smooth");
|
||||
|
||||
player.print(String.format("Smooth brush equipped (%.0f x %dx, using " + (naturalBlocksOnly ? "natural blocks only" : "any block") + ").",
|
||||
radius, iterations));
|
||||
player.print(String.format("Smooth brush equipped (%.0f x %dx, using any block).", radius, iterations));
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
@ -234,18 +234,16 @@ public class RegionCommands {
|
||||
@Command(
|
||||
aliases = { "/smooth" },
|
||||
usage = "[iterations]",
|
||||
flags = "n",
|
||||
desc = "Smooth the elevation in the selection",
|
||||
help =
|
||||
"Smooths the elevation in the selection.\n" +
|
||||
"The -n flag makes it only consider naturally occuring blocks.",
|
||||
"Smooths the elevation in the selection.",
|
||||
min = 0,
|
||||
max = 1
|
||||
)
|
||||
@CommandPermissions("worldedit.region.smooth")
|
||||
@Logging(REGION)
|
||||
public void smooth(Player player, EditSession editSession, @Selection Region region, @Optional("1") int iterations, @Switch('n') boolean affectNatural) throws WorldEditException {
|
||||
HeightMap heightMap = new HeightMap(editSession, region, affectNatural);
|
||||
public void smooth(Player player, EditSession editSession, @Selection Region region, @Optional("1") int iterations) throws WorldEditException {
|
||||
HeightMap heightMap = new HeightMap(editSession, region);
|
||||
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.");
|
||||
|
@ -33,15 +33,9 @@ import com.sk89q.worldedit.util.Location;
|
||||
public class SmoothBrush implements Brush {
|
||||
|
||||
private int iterations;
|
||||
private boolean naturalOnly;
|
||||
|
||||
public SmoothBrush(int iterations) {
|
||||
this(iterations, false);
|
||||
}
|
||||
|
||||
public SmoothBrush(int iterations, boolean naturalOnly) {
|
||||
this.iterations = iterations;
|
||||
this.naturalOnly = naturalOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -49,7 +43,7 @@ public class SmoothBrush implements Brush {
|
||||
Location min = new Location(editSession.getWorld(), position.subtract(size, size, size));
|
||||
Vector max = position.add(size, size + 10, size);
|
||||
Region region = new CuboidRegion(editSession.getWorld(), min.toVector(), max);
|
||||
HeightMap heightMap = new HeightMap(editSession, region, naturalOnly);
|
||||
HeightMap heightMap = new HeightMap(editSession, region);
|
||||
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
|
||||
heightMap.applyFilter(filter, iterations);
|
||||
}
|
||||
|
Reference in New Issue
Block a user