mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2025-01-19 23:01:35 +01:00
commit
61f3dcaacc
@ -27,7 +27,7 @@ public class SurfaceRegionFunction implements FlatRegionFunction {
|
|||||||
public boolean apply(Vector2D position) throws WorldEditException {
|
public boolean apply(Vector2D position) throws WorldEditException {
|
||||||
int x = position.getBlockX();
|
int x = position.getBlockX();
|
||||||
int z = position.getBlockZ();
|
int z = position.getBlockZ();
|
||||||
int layer = extent.getNearestSurfaceTerrainBlock(x, z, lastY, minY, maxY);
|
int layer = extent.getNearestSurfaceTerrainBlock(x, z, lastY, minY, maxY, false);
|
||||||
if (layer != -1) {
|
if (layer != -1) {
|
||||||
lastY = layer;
|
lastY = layer;
|
||||||
return function.apply(mutable.setComponents(x, layer, z));
|
return function.apply(mutable.setComponents(x, layer, z));
|
||||||
|
@ -122,11 +122,19 @@ public interface Extent extends InputExtent, OutputExtent {
|
|||||||
return (state ? minY : maxY) << 4;
|
return (state ? minY : maxY) << 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public default int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, boolean ignoreAir) {
|
||||||
|
return getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, minY, maxY, ignoreAir);
|
||||||
|
}
|
||||||
|
|
||||||
public default int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY) {
|
public default int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY) {
|
||||||
return getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, minY, maxY);
|
return getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, minY, maxY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public default int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax) {
|
public default int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax) {
|
||||||
|
return getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public default int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax, boolean ignoreAir) {
|
||||||
y = Math.max(minY, Math.min(maxY, y));
|
y = Math.max(minY, Math.min(maxY, y));
|
||||||
int clearanceAbove = maxY - y;
|
int clearanceAbove = maxY - y;
|
||||||
int clearanceBelow = y - minY;
|
int clearanceBelow = y - minY;
|
||||||
@ -155,7 +163,12 @@ public interface Extent extends InputExtent, OutputExtent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return state ? failedMin : failedMax;
|
int result = state ? failedMin : failedMax;
|
||||||
|
if(result > 0 && !ignoreAir) {
|
||||||
|
block = getLazyBlock(x, result, z);
|
||||||
|
return block.isAir() ? -1 : result;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
default public void addCaves(Region region) throws WorldEditException {
|
default public void addCaves(Region region) throws WorldEditException {
|
||||||
|
Loading…
Reference in New Issue
Block a user