mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-16 15:46:16 +01:00
fixec //overlay command where the bottom layer was set to the given
block even if the block below is air
This commit is contained in:
parent
7141cc4a9c
commit
ca7579e0a7
@ -27,7 +27,7 @@ public class SurfaceRegionFunction implements FlatRegionFunction {
|
||||
public boolean apply(Vector2D position) throws WorldEditException {
|
||||
int x = position.getBlockX();
|
||||
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) {
|
||||
lastY = layer;
|
||||
return function.apply(mutable.setComponents(x, layer, z));
|
||||
|
@ -122,11 +122,19 @@ public interface Extent extends InputExtent, OutputExtent {
|
||||
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) {
|
||||
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) {
|
||||
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));
|
||||
int clearanceAbove = maxY - y;
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user