fix: improve test for polygonal region containment of cuboid

- Possibly fixes #2265
This commit is contained in:
dordsor21 2023-06-04 23:57:51 +01:00
parent e9fed5a066
commit 46e8a37cf0
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
2 changed files with 17 additions and 17 deletions

View File

@ -506,24 +506,26 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion {
//FAWE start
@Override
public boolean containsEntireCuboid(int bx, int tx, int by, int ty, int bz, int tz) {
for (int x = bx; x <= tx; x++) {
if (!contains(x, 0, bz)) {
return false;
for (int y : new int[]{by, ty}) {
for (int x = bx; x <= tx; x++) {
if (!contains(x, y, bz)) {
return false;
}
}
}
for (int x = bx; x <= tx; x++) {
if (!contains(x, 0, tz)) {
return false;
for (int x = bx; x <= tx; x++) {
if (!contains(x, y, tz)) {
return false;
}
}
}
for (int z = bz; z <= tz; z++) {
if (!contains(bx, 0, z)) {
return false;
for (int z = bz; z <= tz; z++) {
if (!contains(bx, y, z)) {
return false;
}
}
}
for (int z = bz; z <= tz; z++) {
if (!contains(tx, 0, z)) {
return false;
for (int z = bz; z <= tz; z++) {
if (!contains(tx, y, z)) {
return false;
}
}
}
return true;

View File

@ -42,8 +42,6 @@ import com.sk89q.worldedit.world.World;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
/**
* Represents a physical shape.