mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-02 11:26:42 +00:00
Removed -q flag from //[h]sphere and the code to back it.
The speed difference between the "flexible" and the "quick" variant is so minor that it doesn't justify the aditional code complexity.
This commit is contained in:
@ -1976,74 +1976,6 @@ public class EditSession {
|
||||
return affected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a sphere or ellipsoid.
|
||||
*
|
||||
* @param pos Center of the sphere or ellipsoid
|
||||
* @param block The block pattern to use
|
||||
* @param radiusX The sphere/ellipsoid's largest north/south extent
|
||||
* @param radiusY The sphere/ellipsoid's largest up/down extent
|
||||
* @param radiusZ The sphere/ellipsoid's largest east/west extent
|
||||
* @param filled If false, only a shell will be generated.
|
||||
* @return number of blocks changed
|
||||
* @throws MaxChangedBlocksException
|
||||
*/
|
||||
public int makeSphere(Vector pos, Pattern block, double radius, boolean filled) throws MaxChangedBlocksException {
|
||||
int affected = 0;
|
||||
|
||||
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 y = 0; y <= ceilRadius; ++y) {
|
||||
for (int z = 0; z <= ceilRadius; ++z) {
|
||||
double dSq = lengthSq(x, y, z);
|
||||
|
||||
if (dSq > radiusSq) {
|
||||
continue;
|
||||
}
|
||||
if (!filled) {
|
||||
if (dSq < radius1Sq
|
||||
|| (lengthSq(x + 1, y, z) <= radiusSq
|
||||
&& lengthSq(x, y + 1, z) <= radiusSq
|
||||
&& lengthSq(x, y, z + 1) <= radiusSq)) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return affected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a sphere or ellipsoid.
|
||||
*
|
||||
|
Reference in New Issue
Block a user