geforkt von Mirrors/FastAsyncWorldEdit
Added flag to //smooth to only use "natural" blocks
Dieser Commit ist enthalten in:
Ursprung
c99d64cfa0
Commit
2b94ddf7ed
@ -2378,12 +2378,12 @@ public class EditSession {
|
||||
* maximal height
|
||||
* @return height of highest block found or 'minY'
|
||||
*/
|
||||
public int getHighestTerrainBlock(int x, int z, int minY, int maxY) {
|
||||
public int getHighestTerrainBlock(int x, int z, int minY, int maxY, boolean naturalOnly) {
|
||||
for (int y = maxY; y >= minY; --y) {
|
||||
Vector pt = new Vector(x, y, z);
|
||||
int id = getBlockType(pt);
|
||||
|
||||
if (!BlockType.canPassThrough(id) /*id == 1 // stone
|
||||
if (naturalOnly ?
|
||||
id == 1 // stone
|
||||
|| id == 2 // grass
|
||||
|| id == 3 // dirt
|
||||
|| id == 7 // bedrock
|
||||
@ -2400,8 +2400,8 @@ public class EditSession {
|
||||
|| id == 16 // gold ore
|
||||
|| id == 56 // diamond ore
|
||||
|| id == 73 // redstone ore
|
||||
|| id == 74 // redstone ore (active)*/
|
||||
) {
|
||||
|| id == 74 // redstone ore (active)
|
||||
: !BlockType.canPassThrough(id)) {
|
||||
return y;
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class HeightMap {
|
||||
* @param region
|
||||
*/
|
||||
|
||||
public HeightMap(EditSession session, Region region) {
|
||||
public HeightMap(EditSession session, Region region, boolean naturalOnly) {
|
||||
this.session = session;
|
||||
this.region = region;
|
||||
|
||||
@ -60,7 +60,7 @@ public class HeightMap {
|
||||
data = new int[width * height];
|
||||
for (int z = 0; z < height; ++z) {
|
||||
for (int x = 0; x < width; ++x) {
|
||||
data[z * width + x] = session.getHighestTerrainBlock(x + minX, z + minZ, minY, maxY);
|
||||
data[z * width + x] = session.getHighestTerrainBlock(x + minX, z + minZ, minY, maxY, naturalOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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.");
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -96,8 +96,12 @@ commands:
|
||||
permissions: 'worldedit.generation.pumpkins'
|
||||
/pyramid:
|
||||
description: Generate a filled pyramid
|
||||
usage: /<command> <block> <range> <height> [inverted]
|
||||
permissions: 'worldedit.generation.sphere'
|
||||
usage: /<command> <block> <range>
|
||||
permissions: 'worldedit.generation.pyramid'
|
||||
/hpyramid:
|
||||
description: Generate a hollow pyramid
|
||||
usage: /<command> <block> <range>
|
||||
permissions: 'worldedit.generation.pyramid'
|
||||
/undo:
|
||||
description: Undoes the last action
|
||||
usage: /<command> [times]
|
||||
@ -165,13 +169,13 @@ commands:
|
||||
usage: /<command> <block>
|
||||
permissions: 'worldedit.region.walls'
|
||||
/faces:
|
||||
description: Build the walls, ceiling, and roof of a selection
|
||||
description: Build the walls, ceiling, and floor of a selection
|
||||
usage: /<command> <block>
|
||||
aliases: ['/outline']
|
||||
permissions: 'worldedit.region.faces'
|
||||
/smooth:
|
||||
description: Smooth the elevation in the selection
|
||||
usage: /<command> [iterations]
|
||||
usage: /<command> [-n] [iterations]
|
||||
permissions: 'worldedit.region.smooth'
|
||||
/move:
|
||||
description: Move the contents of the selection
|
||||
@ -201,25 +205,29 @@ commands:
|
||||
description: Shift the selection area
|
||||
usage: /<command> <amount> [direction]
|
||||
permissions: 'worldedit.selection.shift'
|
||||
/chunk:
|
||||
description: Set the selection to your current chunk
|
||||
usage: /<command>
|
||||
permissions: 'worldedit.selection.chunk'
|
||||
/expand:
|
||||
description: Expand the selection area
|
||||
usage: /<command> <amount> [reverse-amount] <direction>
|
||||
permissions: 'worldedit.selection.expand'
|
||||
/sel:
|
||||
description: Choose a region selector
|
||||
usage: /<command> [type]
|
||||
aliases: [',']
|
||||
/chunk:
|
||||
description: Set the selection to your current chunk. The -s flag extends your current selection to the encompassed chunks.
|
||||
usage: /<command> [-s]
|
||||
permissions: 'worldedit.selection.chunk'
|
||||
/contract:
|
||||
description: Contract the selection area
|
||||
usage: /<command> <amount> [reverse-amount] [direction]
|
||||
permissions: 'worldedit.selection.contract'
|
||||
/pos1:
|
||||
description: Set position 1
|
||||
usage: /<command>
|
||||
usage: /<command> [coordinates]
|
||||
permissions: 'worldedit.selection.pos'
|
||||
/pos2:
|
||||
description: Set position 2
|
||||
usage: /<command>
|
||||
usage: /<command> [coordinates]
|
||||
permissions: 'worldedit.selection.pos'
|
||||
/hpos1:
|
||||
description: Set position 1 to targeted block
|
||||
@ -249,10 +257,6 @@ commands:
|
||||
description: Get the distribution of blocks in the selection
|
||||
usage: /<command> [-c]
|
||||
permissions: 'worldedit.analysis.distr'
|
||||
/sel:
|
||||
description: Choose a region selector
|
||||
usage: /<command> [type]
|
||||
aliases: [',']
|
||||
snapshot:
|
||||
description: Snapshot commands
|
||||
usage: /<command>
|
||||
@ -270,9 +274,13 @@ commands:
|
||||
description: Set the brush mask
|
||||
usage: /<command> [mask]
|
||||
permissions: 'worldedit.brush.options.mask'
|
||||
range:
|
||||
description: Set the brush range
|
||||
usage: /<command> [pattern]
|
||||
permissions: 'worldedit.brush.options.range'
|
||||
/:
|
||||
description: Toggle the super pickaxe pickaxe function
|
||||
usage: /<command>
|
||||
usage: /<command> [on|off]
|
||||
aliases: [',']
|
||||
permissions: 'worldedit.superpickaxe'
|
||||
superpickaxe:
|
||||
@ -287,10 +295,6 @@ commands:
|
||||
usage: /<command> [pattern]
|
||||
aliases: ['material', 'fill']
|
||||
permissions: 'worldedit.brush.options.material'
|
||||
range:
|
||||
description: Set the brush range
|
||||
usage: /<command> [pattern]
|
||||
permissions: 'worldedit.brush.options.range'
|
||||
info:
|
||||
description: Block information tool
|
||||
usage: /<command>
|
||||
@ -323,6 +327,10 @@ commands:
|
||||
description: Floating tree remover tool
|
||||
usage: /<command>
|
||||
permissions: 'worldedit.tool.deltree'
|
||||
farwand:
|
||||
description: Wand at a distance tool
|
||||
usage: /<command>
|
||||
permissions: 'worldedit.tool.farwand'
|
||||
remove:
|
||||
description: Remove all entities of a type
|
||||
usage: /<command> <type> <radius>
|
||||
@ -372,6 +380,10 @@ commands:
|
||||
description: Thaws the area
|
||||
usage: /<command> [radius]
|
||||
permissions: 'worldedit.thaw'
|
||||
green:
|
||||
description: Greens the area
|
||||
usage: /<command> [radius]
|
||||
permissions: 'worldedit.green'
|
||||
ex:
|
||||
description: Extinguish nearby fire
|
||||
usage: /<command> [radius]
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren