mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
Fix walls command on 1D/2D selection (#1821)
This commit is contained in:
parent
38d1a64bf5
commit
34ea713d29
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user