Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-05 19:10:07 +01:00
Optimized //(h)sphere a bit and made the shell for //hsphere as thin as possible.
Dieser Commit ist enthalten in:
Ursprung
b74670fda6
Commit
af2429467d
@ -1813,38 +1813,50 @@ public class EditSession {
|
|||||||
boolean filled) throws MaxChangedBlocksException {
|
boolean filled) throws MaxChangedBlocksException {
|
||||||
int affected = 0;
|
int affected = 0;
|
||||||
|
|
||||||
int ceilRadius = (int) Math.ceil(radius);
|
radius += 0.5;
|
||||||
|
final double radiusSq = radius*radius;
|
||||||
|
final double radius1Sq = (radius - 1)*(radius - 1);
|
||||||
|
|
||||||
|
final int ceilRadius = (int) Math.ceil(radius);
|
||||||
for (int x = 0; x <= ceilRadius; ++x) {
|
for (int x = 0; x <= ceilRadius; ++x) {
|
||||||
for (int y = 0; y <= ceilRadius; ++y) {
|
for (int y = 0; y <= ceilRadius; ++y) {
|
||||||
for (int z = 0; z <= ceilRadius; ++z) {
|
for (int z = 0; z <= ceilRadius; ++z) {
|
||||||
Vector vec = pos.add(x, y, z);
|
double dSq = lengthSq(x, y, z);
|
||||||
double d = vec.distance(pos);
|
|
||||||
|
|
||||||
if (d <= radius + 0.5 && (filled || d >= radius - 0.5)) {
|
if (dSq > radiusSq)
|
||||||
if (setBlock(vec, block)) {
|
continue;
|
||||||
++affected;
|
|
||||||
}
|
if (!filled) {
|
||||||
if (setBlock(pos.add(-x, y, z), block)) {
|
if (dSq < radius1Sq)
|
||||||
++affected;
|
continue;
|
||||||
}
|
|
||||||
if (setBlock(pos.add(x, -y, z), block)) {
|
if (lengthSq(x+1, y, z) <= radiusSq && lengthSq(x, y+1, z) <= radiusSq && lengthSq(x, y, z+1) <= radiusSq)
|
||||||
++affected;
|
continue;
|
||||||
}
|
}
|
||||||
if (setBlock(pos.add(x, y, -z), block)) {
|
|
||||||
++affected;
|
if (setBlock(pos.add(x, y, z), block)) {
|
||||||
}
|
++affected;
|
||||||
if (setBlock(pos.add(-x, -y, z), block)) {
|
}
|
||||||
++affected;
|
if (setBlock(pos.add(-x, y, z), block)) {
|
||||||
}
|
++affected;
|
||||||
if (setBlock(pos.add(x, -y, -z), block)) {
|
}
|
||||||
++affected;
|
if (setBlock(pos.add(x, -y, z), block)) {
|
||||||
}
|
++affected;
|
||||||
if (setBlock(pos.add(-x, y, -z), block)) {
|
}
|
||||||
++affected;
|
if (setBlock(pos.add(x, y, -z), block)) {
|
||||||
}
|
++affected;
|
||||||
if (setBlock(pos.add(-x, -y, -z), block)) {
|
}
|
||||||
++affected;
|
if (setBlock(pos.add(-x, -y, z), block)) {
|
||||||
}
|
++affected;
|
||||||
|
}
|
||||||
|
if (setBlock(pos.add(x, -y, -z), block)) {
|
||||||
|
++affected;
|
||||||
|
}
|
||||||
|
if (setBlock(pos.add(-x, y, -z), block)) {
|
||||||
|
++affected;
|
||||||
|
}
|
||||||
|
if (setBlock(pos.add(-x, -y, -z), block)) {
|
||||||
|
++affected;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1853,6 +1865,10 @@ public class EditSession {
|
|||||||
return affected;
|
return affected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final double lengthSq(int x, int y, int z) {
|
||||||
|
return x*x + y*y + z*z;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a pyramid.
|
* Makes a pyramid.
|
||||||
*
|
*
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren