Optional distance for angle patterns/masks
This commit is contained in:
parent
2ec9a92268
commit
4d62867cb6
@ -12,10 +12,12 @@ public class DataAnglePattern extends AbstractPattern {
|
||||
public final Extent extent;
|
||||
public final int maxY;
|
||||
public final double factor = 1d / 255;
|
||||
public final int distance;
|
||||
|
||||
public DataAnglePattern(Extent extent) {
|
||||
public DataAnglePattern(Extent extent, int distance) {
|
||||
this.extent = new ExtentHeightCacher(extent);
|
||||
this.maxY = extent.getMaximumPoint().getBlockY();
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public int getSlope(BaseBlock block, Vector vector) {
|
||||
@ -27,10 +29,10 @@ public class DataAnglePattern extends AbstractPattern {
|
||||
}
|
||||
int slope;
|
||||
boolean aboveMin;
|
||||
slope = Math.abs(extent.getNearestSurfaceTerrainBlock(x + 1, z, y, 0, maxY) - extent.getNearestSurfaceTerrainBlock(x - 1, z, y, 0, maxY)) * 7;
|
||||
slope += Math.abs(extent.getNearestSurfaceTerrainBlock(x, z + 1, y, 0, maxY) - extent.getNearestSurfaceTerrainBlock(x, z - 1, y, 0, maxY)) * 7;
|
||||
slope += Math.abs(extent.getNearestSurfaceTerrainBlock(x + 1, z + 1, y, 0, maxY) - extent.getNearestSurfaceTerrainBlock(x - 1, z - 1, y, 0, maxY)) * 5;
|
||||
slope += Math.abs(extent.getNearestSurfaceTerrainBlock(x - 1, z + 1, y, 0, maxY) - extent.getNearestSurfaceTerrainBlock(x + 1, z - 1, y, 0, maxY)) * 5;
|
||||
slope = Math.abs(extent.getNearestSurfaceTerrainBlock(x + distance, z, y, 0, maxY) - extent.getNearestSurfaceTerrainBlock(x - distance, z, y, 0, maxY)) * 7;
|
||||
slope += Math.abs(extent.getNearestSurfaceTerrainBlock(x, z + distance, y, 0, maxY) - extent.getNearestSurfaceTerrainBlock(x, z - distance, y, 0, maxY)) * 7;
|
||||
slope += Math.abs(extent.getNearestSurfaceTerrainBlock(x + distance, z + distance, y, 0, maxY) - extent.getNearestSurfaceTerrainBlock(x - distance, z - distance, y, 0, maxY)) * 5;
|
||||
slope += Math.abs(extent.getNearestSurfaceTerrainBlock(x - distance, z + distance, y, 0, maxY) - extent.getNearestSurfaceTerrainBlock(x + distance, z - distance, y, 0, maxY)) * 5;
|
||||
return slope;
|
||||
}
|
||||
|
||||
|
@ -17,8 +17,8 @@ public class AngleColorPattern extends DataAnglePattern {
|
||||
private final boolean randomize;
|
||||
private final int complexity;
|
||||
|
||||
public AngleColorPattern(Extent extent, int complexity, boolean randomize) {
|
||||
super(extent);
|
||||
public AngleColorPattern(Extent extent, int complexity, boolean randomize, int distance) {
|
||||
super(extent, distance);
|
||||
this.complexity = complexity;
|
||||
this.randomize = randomize;
|
||||
this.util = Fawe.get().getCachedTextureUtil(randomize, 0, complexity);
|
||||
|
@ -264,7 +264,7 @@ public class MaskCommands extends MethodCommands {
|
||||
"Explanation: Allows any block where the adjacent block is between 0 and 45 degrees.\n" +
|
||||
"Example: /[3][20]\n" +
|
||||
"Explanation: Allows any block where the adjacent block is between 3 and 20 blocks below",
|
||||
usage = "<min> <max>",
|
||||
usage = "<min> <max> [distance=1]",
|
||||
min = 2,
|
||||
max = 2
|
||||
)
|
||||
|
@ -71,7 +71,6 @@ import java.util.Set;
|
||||
" - Use , to OR multiple\n" +
|
||||
"e.g. #surfacespread[10][#existing],andesite\n" +
|
||||
"More Info: https://git.io/vSPmA"
|
||||
|
||||
)
|
||||
public class PatternCommands extends MethodCommands {
|
||||
public PatternCommands(WorldEdit worldEdit) {
|
||||
@ -125,13 +124,13 @@ public class PatternCommands extends MethodCommands {
|
||||
@Command(
|
||||
aliases = {"#anglecolor"},
|
||||
desc = "A darker block based on the existing terrain angle",
|
||||
usage = "[randomize=true] [max-complexity=100]",
|
||||
usage = "[randomize=true] [max-complexity=100] [distance=1]",
|
||||
min = 0,
|
||||
max = 2
|
||||
)
|
||||
public Pattern anglecolor(Extent extent, @Optional("true") boolean randomize, @Optional("100") double maxComplexity) {
|
||||
public Pattern anglecolor(Extent extent, @Optional("true") boolean randomize, @Optional("100") double maxComplexity, @Optional("1") int distance) {
|
||||
TextureUtil util = Fawe.get().getCachedTextureUtil(randomize, 0, (int) maxComplexity);
|
||||
return new AngleColorPattern(extent, (int) maxComplexity, randomize);
|
||||
return new AngleColorPattern(extent, (int) maxComplexity, randomize, distance);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -139,7 +138,7 @@ public class PatternCommands extends MethodCommands {
|
||||
desc = "Block data based on the existing terrain angle"
|
||||
)
|
||||
public Pattern angledata(Extent extent) {
|
||||
return new DataAnglePattern(extent);
|
||||
return new DataAnglePattern(extent, 1);
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
Loading…
Reference in New Issue
Block a user