Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 18:40:05 +01:00
Improved speed of functions that iterated over a cuboid by 20-40%.
Dieser Commit ist enthalten in:
Ursprung
491f63b196
Commit
57906fba32
@ -423,9 +423,13 @@ public class EditSession {
|
|||||||
size--;
|
size--;
|
||||||
int affected = 0;
|
int affected = 0;
|
||||||
|
|
||||||
for (int x = (int)pos.getX() - size; x <= (int)pos.getX() + size; x++) {
|
int oX = pos.getBlockX();
|
||||||
for (int z = (int)pos.getZ() - size; z <= (int)pos.getZ() + size; z++) {
|
int oY = pos.getBlockY();
|
||||||
for (int y = (int)pos.getY(); y <= maxY; y++) {
|
int oZ = pos.getBlockZ();
|
||||||
|
|
||||||
|
for (int x = oX - size; x <= oX + size; x++) {
|
||||||
|
for (int z = oZ - size; z <= oZ + size; z++) {
|
||||||
|
for (int y = oY; y <= maxY; y++) {
|
||||||
Vector pt = new Vector(x, y, z);
|
Vector pt = new Vector(x, y, z);
|
||||||
|
|
||||||
if (!getBlock(pt).isAir()) {
|
if (!getBlock(pt).isAir()) {
|
||||||
@ -453,9 +457,13 @@ public class EditSession {
|
|||||||
size--;
|
size--;
|
||||||
int affected = 0;
|
int affected = 0;
|
||||||
|
|
||||||
for (int x = (int)pos.getX() - size; x <= (int)pos.getX() + size; x++) {
|
int oX = pos.getBlockX();
|
||||||
for (int z = (int)pos.getZ() - size; z <= (int)pos.getZ() + size; z++) {
|
int oY = pos.getBlockY();
|
||||||
for (int y = (int)pos.getY(); y >= minY; y--) {
|
int oZ = pos.getBlockZ();
|
||||||
|
|
||||||
|
for (int x = oX - size; x <= oX + size; x++) {
|
||||||
|
for (int z = oZ - size; z <= oZ + size; z++) {
|
||||||
|
for (int y = oY; y >= minY; y--) {
|
||||||
Vector pt = new Vector(x, y, z);
|
Vector pt = new Vector(x, y, z);
|
||||||
|
|
||||||
if (!getBlock(pt).isAir()) {
|
if (!getBlock(pt).isAir()) {
|
||||||
@ -562,9 +570,16 @@ public class EditSession {
|
|||||||
Vector min = region.getMinimumPoint();
|
Vector min = region.getMinimumPoint();
|
||||||
Vector max = region.getMaximumPoint();
|
Vector max = region.getMaximumPoint();
|
||||||
|
|
||||||
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
|
int minX = min.getBlockX();
|
||||||
for (int y = min.getBlockY(); y <= max.getBlockY(); y++) {
|
int minY = min.getBlockY();
|
||||||
for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) {
|
int minZ = min.getBlockZ();
|
||||||
|
int maxX = max.getBlockX();
|
||||||
|
int maxY = max.getBlockY();
|
||||||
|
int maxZ = max.getBlockZ();
|
||||||
|
|
||||||
|
for (int x = minX; x <= maxX; x++) {
|
||||||
|
for (int y = minY; y <= maxY; y++) {
|
||||||
|
for (int z = minZ; z <= maxZ; z++) {
|
||||||
Vector pt = new Vector(x, y, z);
|
Vector pt = new Vector(x, y, z);
|
||||||
|
|
||||||
if (setBlock(pt, pattern.next(pt))) {
|
if (setBlock(pt, pattern.next(pt))) {
|
||||||
@ -602,9 +617,16 @@ public class EditSession {
|
|||||||
Vector min = region.getMinimumPoint();
|
Vector min = region.getMinimumPoint();
|
||||||
Vector max = region.getMaximumPoint();
|
Vector max = region.getMaximumPoint();
|
||||||
|
|
||||||
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
|
int minX = min.getBlockX();
|
||||||
for (int y = min.getBlockY(); y <= max.getBlockY(); y++) {
|
int minY = min.getBlockY();
|
||||||
for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) {
|
int minZ = min.getBlockZ();
|
||||||
|
int maxX = max.getBlockX();
|
||||||
|
int maxY = max.getBlockY();
|
||||||
|
int maxZ = max.getBlockZ();
|
||||||
|
|
||||||
|
for (int x = minX; x <= maxX; x++) {
|
||||||
|
for (int y = minY; y <= maxY; y++) {
|
||||||
|
for (int z = minZ; z <= maxZ; z++) {
|
||||||
Vector pt = new Vector(x, y, z);
|
Vector pt = new Vector(x, y, z);
|
||||||
int curBlockType = getBlock(pt).getID();
|
int curBlockType = getBlock(pt).getID();
|
||||||
|
|
||||||
@ -648,25 +670,32 @@ public class EditSession {
|
|||||||
Vector min = region.getMinimumPoint();
|
Vector min = region.getMinimumPoint();
|
||||||
Vector max = region.getMaximumPoint();
|
Vector max = region.getMaximumPoint();
|
||||||
|
|
||||||
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
|
int minX = min.getBlockX();
|
||||||
for (int y = min.getBlockY(); y <= max.getBlockY(); y++) {
|
int minY = min.getBlockY();
|
||||||
if (setBlock(new Vector(x, y, min.getBlockZ()), block)) { affected++; }
|
int minZ = min.getBlockZ();
|
||||||
if (setBlock(new Vector(x, y, max.getBlockZ()), block)) { affected++; }
|
int maxX = max.getBlockX();
|
||||||
|
int maxY = max.getBlockY();
|
||||||
|
int maxZ = max.getBlockZ();
|
||||||
|
|
||||||
|
for (int x = minX; x <= maxX; x++) {
|
||||||
|
for (int y = minY; y <= maxY; y++) {
|
||||||
|
if (setBlock(new Vector(x, y, minZ), block)) { affected++; }
|
||||||
|
if (setBlock(new Vector(x, y, maxZ), block)) { affected++; }
|
||||||
affected++;
|
affected++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y = min.getBlockY(); y <= max.getBlockY(); y++) {
|
for (int y = minY; y <= maxY; y++) {
|
||||||
for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) {
|
for (int z = minZ; z <= maxZ; z++) {
|
||||||
if (setBlock(new Vector(min.getBlockX(), y, z), block)) { affected++; }
|
if (setBlock(new Vector(minX, y, z), block)) { affected++; }
|
||||||
if (setBlock(new Vector(max.getBlockX(), y, z), block)) { affected++; }
|
if (setBlock(new Vector(maxX, y, z), block)) { affected++; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) {
|
for (int z = minZ; z <= maxZ; z++) {
|
||||||
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
|
for (int x = minX; x <= maxX; x++) {
|
||||||
if (setBlock(new Vector(x, min.getBlockY(), z), block)) { affected++; }
|
if (setBlock(new Vector(x, minY, z), block)) { affected++; }
|
||||||
if (setBlock(new Vector(x, max.getBlockY(), z), block)) { affected++; }
|
if (setBlock(new Vector(x, maxY, z), block)) { affected++; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -688,18 +717,25 @@ public class EditSession {
|
|||||||
Vector min = region.getMinimumPoint();
|
Vector min = region.getMinimumPoint();
|
||||||
Vector max = region.getMaximumPoint();
|
Vector max = region.getMaximumPoint();
|
||||||
|
|
||||||
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
|
int minX = min.getBlockX();
|
||||||
for (int y = min.getBlockY(); y <= max.getBlockY(); y++) {
|
int minY = min.getBlockY();
|
||||||
if (setBlock(new Vector(x, y, min.getBlockZ()), block)) { affected++; }
|
int minZ = min.getBlockZ();
|
||||||
if (setBlock(new Vector(x, y, max.getBlockZ()), block)) { affected++; }
|
int maxX = max.getBlockX();
|
||||||
|
int maxY = max.getBlockY();
|
||||||
|
int maxZ = max.getBlockZ();
|
||||||
|
|
||||||
|
for (int x = minX; x <= maxX; x++) {
|
||||||
|
for (int y = minY; y <= maxY; y++) {
|
||||||
|
if (setBlock(new Vector(x, y, minZ), block)) { affected++; }
|
||||||
|
if (setBlock(new Vector(x, y, maxZ), block)) { affected++; }
|
||||||
affected++;
|
affected++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y = min.getBlockY(); y <= max.getBlockY(); y++) {
|
for (int y = minY; y <= maxY; y++) {
|
||||||
for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) {
|
for (int z = minZ; z <= maxZ; z++) {
|
||||||
if (setBlock(new Vector(min.getBlockX(), y, z), block)) { affected++; }
|
if (setBlock(new Vector(minX, y, z), block)) { affected++; }
|
||||||
if (setBlock(new Vector(max.getBlockX(), y, z), block)) { affected++; }
|
if (setBlock(new Vector(maxX, y, z), block)) { affected++; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -724,8 +760,13 @@ public class EditSession {
|
|||||||
|
|
||||||
int affected = 0;
|
int affected = 0;
|
||||||
|
|
||||||
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
|
int minX = min.getBlockX();
|
||||||
for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) {
|
int minZ = min.getBlockZ();
|
||||||
|
int maxX = max.getBlockX();
|
||||||
|
int maxZ = max.getBlockZ();
|
||||||
|
|
||||||
|
for (int x = minX; x <= maxX; x++) {
|
||||||
|
for (int z = minZ; z <= maxZ; z++) {
|
||||||
for (int y = upperY; y >= lowerY; y--) {
|
for (int y = upperY; y >= lowerY; y--) {
|
||||||
Vector above = new Vector(x, y + 1, z);
|
Vector above = new Vector(x, y + 1, z);
|
||||||
|
|
||||||
@ -760,13 +801,21 @@ public class EditSession {
|
|||||||
|
|
||||||
Vector min = region.getMinimumPoint();
|
Vector min = region.getMinimumPoint();
|
||||||
Vector max = region.getMaximumPoint();
|
Vector max = region.getMaximumPoint();
|
||||||
|
|
||||||
|
int minX = min.getBlockX();
|
||||||
|
int minY = min.getBlockY();
|
||||||
|
int minZ = min.getBlockZ();
|
||||||
|
int maxX = max.getBlockX();
|
||||||
|
int maxY = max.getBlockY();
|
||||||
|
int maxZ = max.getBlockZ();
|
||||||
|
|
||||||
int xs = region.getWidth();
|
int xs = region.getWidth();
|
||||||
int ys = region.getHeight();
|
int ys = region.getHeight();
|
||||||
int zs = region.getLength();
|
int zs = region.getLength();
|
||||||
|
|
||||||
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
|
for (int x = minX; x <= maxX; x++) {
|
||||||
for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) {
|
for (int z = minZ; z <= maxZ; z++) {
|
||||||
for (int y = min.getBlockY(); y <= max.getBlockY(); y++) {
|
for (int y = minY; y <= maxY; y++) {
|
||||||
BaseBlock block = getBlock(new Vector(x, y, z));
|
BaseBlock block = getBlock(new Vector(x, y, z));
|
||||||
|
|
||||||
if (!block.isAir() || copyAir) {
|
if (!block.isAir() || copyAir) {
|
||||||
@ -807,17 +856,26 @@ public class EditSession {
|
|||||||
Vector shift = dir.multiply(distance);
|
Vector shift = dir.multiply(distance);
|
||||||
Vector min = region.getMinimumPoint();
|
Vector min = region.getMinimumPoint();
|
||||||
Vector max = region.getMaximumPoint();
|
Vector max = region.getMaximumPoint();
|
||||||
|
|
||||||
|
int minX = min.getBlockX();
|
||||||
|
int minY = min.getBlockY();
|
||||||
|
int minZ = min.getBlockZ();
|
||||||
|
int maxX = max.getBlockX();
|
||||||
|
int maxY = max.getBlockY();
|
||||||
|
int maxZ = max.getBlockZ();
|
||||||
|
|
||||||
Vector newMin = min.add(shift);
|
Vector newMin = min.add(shift);
|
||||||
Vector newMax = min.add(shift);
|
Vector newMax = min.add(shift);
|
||||||
|
|
||||||
int xs = region.getWidth();
|
int xs = region.getWidth();
|
||||||
int ys = region.getHeight();
|
int ys = region.getHeight();
|
||||||
int zs = region.getLength();
|
int zs = region.getLength();
|
||||||
|
|
||||||
Map<Vector,BaseBlock> delayed = new LinkedHashMap<Vector,BaseBlock>();
|
Map<Vector,BaseBlock> delayed = new LinkedHashMap<Vector,BaseBlock>();
|
||||||
|
|
||||||
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
|
for (int x = minX; x <= maxX; x++) {
|
||||||
for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) {
|
for (int z = minZ; z <= maxZ; z++) {
|
||||||
for (int y = min.getBlockY(); y <= max.getBlockY(); y++) {
|
for (int y = minY; y <= maxY; y++) {
|
||||||
Vector pos = new Vector(x, y, z);
|
Vector pos = new Vector(x, y, z);
|
||||||
BaseBlock block = getBlock(pos);
|
BaseBlock block = getBlock(pos);
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren