Fix walls command on 1D/2D selection (#1821)

Dieser Commit ist enthalten in:
Jordan 2022-06-24 15:04:11 +01:00 committet von GitHub
Ursprung 38d1a64bf5
Commit 34ea713d29
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 15 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -1671,12 +1671,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
checkNotNull(region);
checkNotNull(pattern);
//FAWE start
int blocksChanged = 0;
for (Region wall : CuboidRegion.makeCuboid(region).getWalls().getRegions()) {
blocksChanged += setBlocks(wall, pattern);
}
return blocksChanged;
CuboidRegion cuboid = CuboidRegion.makeCuboid(region);
//FAWE start - specify RegionIntersection
Region faces = cuboid.getWalls();
return setBlocks((Set<BlockVector3>) faces, pattern);
//FAWE end
}

Datei anzeigen

@ -215,9 +215,17 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
*
* @return a new complex region
*/
public RegionIntersection getWalls() {
public Region getWalls() {
BlockVector3 min = getMinimumPoint();
BlockVector3 max = getMaximumPoint();
BlockVector3 dimensions = getDimensions();
//FAWE start
if (dimensions.getX() <= 2 || dimensions.getZ() <= 2) {
// The wall are the region
return new RegionIntersection(this);
}
//FAWE end
return new RegionIntersection(
// Project to Z-Y plane
@ -225,6 +233,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
new CuboidRegion(pos1.withX(max.getX()), pos2.withX(max.getX())),
// Project to X-Y plane
//FAWE start = prevent overlap
new CuboidRegion(
pos1.withZ(min.getZ()).add(BlockVector3.UNIT_X),
pos2.withZ(min.getZ()).subtract(BlockVector3.UNIT_X)
@ -233,6 +242,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
pos1.withZ(max.getZ()).add(BlockVector3.UNIT_X),
pos2.withZ(max.getZ()).subtract(BlockVector3.UNIT_X)
)
//FAWE end
);
}