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

@ -31,9 +31,11 @@ import com.sk89q.worldedit.regions.Region;
public class SmoothBrush implements Brush {
private int iterations;
private boolean naturalOnly;
public SmoothBrush(int iterations) {
public SmoothBrush(int iterations, boolean naturalOnly) {
this.iterations = iterations;
this.naturalOnly = naturalOnly;
}
public void build(EditSession editSession, Vector pos, Pattern mat, double size)
@ -42,7 +44,7 @@ public class SmoothBrush implements Brush {
Vector min = pos.subtract(rad, rad, rad);
Vector max = pos.add(rad, rad + 10, rad);
Region region = new CuboidRegion(min, max);
HeightMap heightMap = new HeightMap(editSession, region);
HeightMap heightMap = new HeightMap(editSession, region, naturalOnly);
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
heightMap.applyFilter(filter, iterations);
}