fix: improve test for polygonal region containment of cuboid

- Possibly fixes #2265
Dieser Commit ist enthalten in:
dordsor21 2023-06-04 23:57:51 +01:00
Ursprung e9fed5a066
Commit 46e8a37cf0
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
2 geänderte Dateien mit 17 neuen und 17 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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