Remove TNTMode.ONLY_BUILD

This commit is contained in:
2025-08-02 07:57:19 +02:00
parent 0763e4b189
commit 144975d977
10 changed files with 120 additions and 36 deletions
@@ -136,7 +136,14 @@ public interface Region {
@NonNull
Point getCopyPoint();
boolean inRegion(Location location, boolean extension);
default boolean inRegion(Location location, boolean extension) {
Point minPoint = getMinPoint(extension);
Point maxPoint = getMaxPoint(extension);
if (location.getBlockX() < minPoint.getX() || location.getBlockX() > maxPoint.getX()) return false;
if (location.getBlockY() < minPoint.getY() || location.getBlockY() > maxPoint.getY()) return false;
if (location.getBlockZ() < minPoint.getZ() || location.getBlockZ() > maxPoint.getZ()) return false;
return true;
}
@Nullable
EditSession copy(boolean extension);
@@ -146,8 +153,21 @@ public interface Region {
void reset(PasteBuilder pasteBuilder, boolean extension);
void forEachChunk(BiConsumer<Integer, Integer> executor);
default void forEachChunk(BiConsumer<Integer, Integer> executor) {
Point minPoint = getMinPoint(false);
Point maxPoint = getMaxPoint(false);
for (int x = (int) Math.floor(minPoint.getX() / 16.0); x <= (int) Math.ceil(maxPoint.getX() / 16.0); x++) {
for (int z = (int) Math.floor(minPoint.getZ() / 16.0); z <= (int) Math.ceil(maxPoint.getZ() / 16.0); z++) {
executor.accept(x, z);
}
}
}
boolean isChunkOutside(int chunkX, int chunkZ);
default boolean isChunkOutside(int chunkX, int chunkZ) {
Point minPoint = getMinPoint(true);
Point maxPoint = getMaxPoint(true);
return Math.floor(minPoint.getX() / 16.0) > chunkX || chunkX >= Math.ceil(maxPoint.getX() / 16.0) ||
Math.floor(minPoint.getZ() / 16.0) > chunkZ || chunkZ >= Math.ceil(maxPoint.getZ() / 16.0);
}
}
}