2011-12-27 22:24:57 +00:00
|
|
|
/*
|
2014-04-04 22:03:18 +00:00
|
|
|
* WorldEdit, a Minecraft world manipulation toolkit
|
|
|
|
* Copyright (C) sk89q <http://www.sk89q.com>
|
|
|
|
* Copyright (C) WorldEdit team and contributors
|
2011-12-27 22:24:57 +00:00
|
|
|
*
|
2014-04-04 22:03:18 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU Lesser General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or
|
2011-12-27 22:24:57 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
2014-04-04 22:03:18 +00:00
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
|
|
* for more details.
|
2011-12-27 22:24:57 +00:00
|
|
|
*
|
2014-04-04 22:03:18 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
2011-12-27 22:24:57 +00:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2014-04-04 22:03:18 +00:00
|
|
|
*/
|
2011-12-27 22:24:57 +00:00
|
|
|
|
|
|
|
package com.sk89q.worldedit.regions;
|
|
|
|
|
2019-07-18 06:56:57 +00:00
|
|
|
|
|
|
|
import com.boydti.fawe.beta.ChunkFilterBlock;
|
|
|
|
import com.boydti.fawe.beta.Filter;
|
|
|
|
import com.boydti.fawe.beta.IChunk;
|
|
|
|
import com.boydti.fawe.beta.IChunkGet;
|
|
|
|
import com.boydti.fawe.beta.IChunkSet;
|
|
|
|
import com.boydti.fawe.util.MathMan;
|
2018-12-23 16:19:33 +00:00
|
|
|
import com.sk89q.worldedit.math.BlockVector2;
|
|
|
|
import com.sk89q.worldedit.math.BlockVector3;
|
|
|
|
import com.sk89q.worldedit.math.Vector3;
|
2014-04-05 09:59:38 +00:00
|
|
|
import com.sk89q.worldedit.world.World;
|
2014-04-03 02:08:50 +00:00
|
|
|
import com.sk89q.worldedit.world.storage.ChunkStore;
|
2019-06-12 21:12:12 +00:00
|
|
|
|
2011-12-27 22:24:57 +00:00
|
|
|
import java.util.HashSet;
|
2018-06-16 05:29:48 +00:00
|
|
|
import java.util.Set;
|
2011-12-27 22:24:57 +00:00
|
|
|
|
|
|
|
/**
|
2014-07-26 07:29:12 +00:00
|
|
|
* Represents an ellipsoid region.
|
2011-12-27 22:24:57 +00:00
|
|
|
*/
|
2012-01-03 14:57:29 +00:00
|
|
|
public class EllipsoidRegion extends AbstractRegion {
|
2014-07-26 07:29:12 +00:00
|
|
|
|
2011-12-27 22:24:57 +00:00
|
|
|
/**
|
|
|
|
* Stores the center.
|
|
|
|
*/
|
2019-01-09 07:13:44 +00:00
|
|
|
private BlockVector3 center;
|
2014-07-26 07:29:12 +00:00
|
|
|
|
2011-12-27 22:24:57 +00:00
|
|
|
/**
|
2014-04-05 09:59:38 +00:00
|
|
|
* Stores the radii plus 0.5 on each axis.
|
2011-12-27 22:24:57 +00:00
|
|
|
*/
|
2019-01-09 07:13:44 +00:00
|
|
|
private Vector3 radius;
|
2014-07-26 07:29:12 +00:00
|
|
|
|
2019-06-28 16:09:56 +00:00
|
|
|
private Vector3 radiusSqr;
|
2019-07-18 06:56:57 +00:00
|
|
|
private Vector3 inverseRadius;
|
2019-06-28 16:09:56 +00:00
|
|
|
private int radiusLengthSqr;
|
|
|
|
private boolean sphere;
|
|
|
|
|
2011-12-27 22:24:57 +00:00
|
|
|
/**
|
|
|
|
* Construct a new instance of this ellipsoid region.
|
|
|
|
*
|
2014-07-26 07:29:12 +00:00
|
|
|
* @param pos1 the first position
|
|
|
|
* @param pos2 the second position
|
2011-12-27 22:24:57 +00:00
|
|
|
*/
|
2018-12-23 16:19:33 +00:00
|
|
|
public EllipsoidRegion(BlockVector3 pos1, Vector3 pos2) {
|
2011-12-27 22:24:57 +00:00
|
|
|
this(null, pos1, pos2);
|
|
|
|
}
|
2012-03-30 04:06:43 +00:00
|
|
|
|
2011-12-27 22:24:57 +00:00
|
|
|
/**
|
|
|
|
* Construct a new instance of this ellipsoid region.
|
2012-03-30 04:06:43 +00:00
|
|
|
*
|
2019-06-12 21:12:12 +00:00
|
|
|
* @param world the world
|
2014-07-26 07:29:12 +00:00
|
|
|
* @param center the center
|
|
|
|
* @param radius the radius
|
2011-12-27 22:24:57 +00:00
|
|
|
*/
|
2018-12-23 16:19:33 +00:00
|
|
|
public EllipsoidRegion(World world, BlockVector3 center, Vector3 radius) {
|
2012-01-03 14:57:29 +00:00
|
|
|
super(world);
|
2019-01-09 07:13:44 +00:00
|
|
|
this.center = center;
|
|
|
|
setRadius(radius);
|
2011-12-27 22:24:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public EllipsoidRegion(EllipsoidRegion ellipsoidRegion) {
|
2012-01-03 16:26:22 +00:00
|
|
|
this(ellipsoidRegion.world, ellipsoidRegion.center, ellipsoidRegion.getRadius());
|
2011-12-27 22:24:57 +00:00
|
|
|
}
|
|
|
|
|
2014-07-26 07:29:12 +00:00
|
|
|
@Override
|
2018-12-23 16:19:33 +00:00
|
|
|
public BlockVector3 getMinimumPoint() {
|
|
|
|
return center.toVector3().subtract(getRadius()).toBlockPoint();
|
2011-12-27 22:24:57 +00:00
|
|
|
}
|
|
|
|
|
2014-07-26 07:29:12 +00:00
|
|
|
@Override
|
2018-12-23 16:19:33 +00:00
|
|
|
public BlockVector3 getMaximumPoint() {
|
|
|
|
return center.toVector3().add(getRadius()).toBlockPoint();
|
2011-12-27 22:24:57 +00:00
|
|
|
}
|
|
|
|
|
2014-07-26 07:29:12 +00:00
|
|
|
@Override
|
2011-12-27 22:24:57 +00:00
|
|
|
public int getArea() {
|
|
|
|
return (int) Math.floor((4.0 / 3.0) * Math.PI * radius.getX() * radius.getY() * radius.getZ());
|
|
|
|
}
|
|
|
|
|
2014-07-26 07:29:12 +00:00
|
|
|
@Override
|
2011-12-27 22:24:57 +00:00
|
|
|
public int getWidth() {
|
|
|
|
return (int) (2 * radius.getX());
|
|
|
|
}
|
|
|
|
|
2014-07-26 07:29:12 +00:00
|
|
|
@Override
|
2011-12-27 22:24:57 +00:00
|
|
|
public int getHeight() {
|
2019-09-21 01:52:35 +00:00
|
|
|
return (int) (2 * radius.getY());
|
2011-12-27 22:24:57 +00:00
|
|
|
}
|
|
|
|
|
2014-07-26 07:29:12 +00:00
|
|
|
@Override
|
2011-12-27 22:24:57 +00:00
|
|
|
public int getLength() {
|
|
|
|
return (int) (2 * radius.getZ());
|
|
|
|
}
|
|
|
|
|
2018-12-23 16:19:33 +00:00
|
|
|
private BlockVector3 calculateDiff(BlockVector3... changes) throws RegionOperationException {
|
|
|
|
BlockVector3 diff = BlockVector3.ZERO.add(changes);
|
2012-03-13 10:00:40 +00:00
|
|
|
|
2012-03-14 10:58:26 +00:00
|
|
|
if ((diff.getBlockX() & 1) + (diff.getBlockY() & 1) + (diff.getBlockZ() & 1) != 0) {
|
2012-03-13 10:00:40 +00:00
|
|
|
throw new RegionOperationException(
|
2012-03-14 10:58:26 +00:00
|
|
|
"Ellipsoid changes must be even for each dimensions.");
|
2012-03-13 10:00:40 +00:00
|
|
|
}
|
|
|
|
|
2012-03-14 10:58:26 +00:00
|
|
|
return diff.divide(2).floor();
|
2012-03-13 10:00:40 +00:00
|
|
|
}
|
|
|
|
|
2018-10-14 10:40:53 +00:00
|
|
|
private Vector3 calculateChanges(BlockVector3... changes) {
|
|
|
|
Vector3 total = Vector3.ZERO;
|
2018-12-23 16:19:33 +00:00
|
|
|
for (BlockVector3 change : changes) {
|
2018-10-14 10:40:53 +00:00
|
|
|
total = total.add(change.abs().toVector3());
|
2012-03-14 10:58:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return total.divide(2).floor();
|
2011-12-27 22:24:57 +00:00
|
|
|
}
|
|
|
|
|
2014-07-26 07:29:12 +00:00
|
|
|
@Override
|
2018-12-23 16:19:33 +00:00
|
|
|
public void expand(BlockVector3... changes) throws RegionOperationException {
|
2019-01-09 07:13:44 +00:00
|
|
|
center = center.add(calculateDiff(changes));
|
2019-06-28 16:09:56 +00:00
|
|
|
setRadius(radius.add(calculateChanges(changes)));
|
2011-12-27 22:24:57 +00:00
|
|
|
}
|
|
|
|
|
2014-07-26 07:29:12 +00:00
|
|
|
@Override
|
2018-12-23 16:19:33 +00:00
|
|
|
public void contract(BlockVector3... changes) throws RegionOperationException {
|
2019-01-09 07:13:44 +00:00
|
|
|
center = center.subtract(calculateDiff(changes));
|
2018-10-14 10:40:53 +00:00
|
|
|
Vector3 newRadius = radius.subtract(calculateChanges(changes));
|
2019-06-28 16:09:56 +00:00
|
|
|
setRadius(Vector3.at(1.5, 1.5, 1.5).getMaximum(newRadius));
|
2012-03-13 10:00:40 +00:00
|
|
|
}
|
|
|
|
|
2012-01-03 15:13:50 +00:00
|
|
|
@Override
|
2018-12-23 16:19:33 +00:00
|
|
|
public void shift(BlockVector3 change) throws RegionOperationException {
|
2019-01-09 07:13:44 +00:00
|
|
|
center = center.add(change);
|
2012-01-03 15:13:50 +00:00
|
|
|
}
|
|
|
|
|
2011-12-27 22:24:57 +00:00
|
|
|
/**
|
|
|
|
* Get the center.
|
|
|
|
*
|
|
|
|
* @return center
|
|
|
|
*/
|
2012-08-29 08:00:26 +00:00
|
|
|
@Override
|
2018-12-23 16:19:33 +00:00
|
|
|
public Vector3 getCenter() {
|
|
|
|
return center.toVector3();
|
2011-12-27 22:24:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the center.
|
|
|
|
*
|
2014-07-26 07:29:12 +00:00
|
|
|
* @param center the center
|
2011-12-27 22:24:57 +00:00
|
|
|
*/
|
2018-12-23 16:19:33 +00:00
|
|
|
public void setCenter(BlockVector3 center) {
|
2019-01-09 07:13:44 +00:00
|
|
|
this.center = center;
|
2011-12-27 22:24:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-07-26 07:29:12 +00:00
|
|
|
* Get the radii.
|
2011-12-27 22:24:57 +00:00
|
|
|
*
|
2014-07-26 07:29:12 +00:00
|
|
|
* @return radii
|
2011-12-27 22:24:57 +00:00
|
|
|
*/
|
2018-12-23 16:19:33 +00:00
|
|
|
public Vector3 getRadius() {
|
2019-01-09 07:13:44 +00:00
|
|
|
return radius.subtract(0.5, 0.5, 0.5);
|
2011-12-27 22:24:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-07-26 07:29:12 +00:00
|
|
|
* Set the radii.
|
2011-12-27 22:24:57 +00:00
|
|
|
*
|
2014-07-26 07:29:12 +00:00
|
|
|
* @param radius the radius
|
2011-12-27 22:24:57 +00:00
|
|
|
*/
|
2019-01-09 07:13:44 +00:00
|
|
|
public void setRadius(Vector3 radius) {
|
2019-06-28 16:09:56 +00:00
|
|
|
this.radius = radius;
|
|
|
|
radiusSqr = radius.multiply(radius);
|
|
|
|
radiusLengthSqr = (int) radiusSqr.getX();
|
2019-07-06 00:46:48 +00:00
|
|
|
this.sphere = radius.getY() == radius.getX() && radius.getX() == radius.getZ();
|
2019-07-18 06:56:57 +00:00
|
|
|
if (radius.getY() == radius.getX() && radius.getX() == radius.getZ()) {
|
|
|
|
this.sphere = true;
|
|
|
|
} else {
|
|
|
|
this.sphere = false;
|
|
|
|
}
|
|
|
|
inverseRadius = Vector3.ONE.divide(radius);
|
2011-12-27 22:24:57 +00:00
|
|
|
}
|
|
|
|
|
2014-07-26 07:29:12 +00:00
|
|
|
@Override
|
2018-12-23 16:19:33 +00:00
|
|
|
public Set<BlockVector2> getChunks() {
|
|
|
|
final Set<BlockVector2> chunks = new HashSet<>();
|
2011-12-27 22:24:57 +00:00
|
|
|
|
2018-12-23 16:19:33 +00:00
|
|
|
final BlockVector3 min = getMinimumPoint();
|
|
|
|
final BlockVector3 max = getMaximumPoint();
|
|
|
|
final int centerY = center.getBlockY();
|
2011-12-27 22:24:57 +00:00
|
|
|
|
|
|
|
for (int x = min.getBlockX(); x <= max.getBlockX(); ++x) {
|
2013-07-31 08:35:47 +00:00
|
|
|
for (int z = min.getBlockZ(); z <= max.getBlockZ(); ++z) {
|
2018-10-19 20:13:32 +00:00
|
|
|
if (!contains(BlockVector3.at(x, centerY, z))) {
|
2013-07-31 08:35:47 +00:00
|
|
|
continue;
|
2012-03-30 04:06:43 +00:00
|
|
|
}
|
|
|
|
|
2018-10-19 20:13:32 +00:00
|
|
|
chunks.add(BlockVector2.at(
|
2018-12-23 16:19:33 +00:00
|
|
|
x >> ChunkStore.CHUNK_SHIFTS,
|
|
|
|
z >> ChunkStore.CHUNK_SHIFTS
|
2013-07-31 08:35:47 +00:00
|
|
|
));
|
2011-12-27 22:24:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return chunks;
|
|
|
|
}
|
|
|
|
|
2019-07-18 06:56:57 +00:00
|
|
|
@Override
|
|
|
|
public boolean contains(int x, int y, int z) {
|
|
|
|
int cx = x - center.getBlockX();
|
|
|
|
int cx2 = cx * cx;
|
|
|
|
if (cx2 > radiusSqr.getBlockX()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
int cz = z - center.getBlockZ();
|
|
|
|
int cz2 = cz * cz;
|
|
|
|
if (cz2 > radiusSqr.getBlockZ()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
int cy = y - center.getBlockY();
|
|
|
|
int cy2 = cy * cy;
|
|
|
|
if (radiusSqr.getBlockY() < 255 && cy2 > radiusSqr.getBlockY()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (sphere) {
|
|
|
|
return cx2 + cy2 + cz2 <= radiusLengthSqr;
|
|
|
|
}
|
|
|
|
double cxd = cx2 * inverseRadius.getX();
|
|
|
|
double cyd = cy2 * inverseRadius.getY();
|
|
|
|
double czd = cz2 * inverseRadius.getZ();
|
|
|
|
return cxd + cyd + czd <= 1;
|
|
|
|
}
|
|
|
|
|
2019-09-21 01:52:35 +00:00
|
|
|
@Override
|
|
|
|
public boolean contains(BlockVector3 position) {
|
|
|
|
return position.subtract(center).toVector3().divide(radius).lengthSq() <= 1;
|
|
|
|
}
|
|
|
|
|
2014-07-26 07:29:12 +00:00
|
|
|
@Override
|
2019-07-18 06:56:57 +00:00
|
|
|
public boolean contains(int x, int z) {
|
|
|
|
int cx = x - center.getBlockX();
|
2019-06-28 16:09:56 +00:00
|
|
|
int cx2 = cx * cx;
|
|
|
|
if (cx2 > radiusSqr.getBlockX()) {
|
|
|
|
return false;
|
|
|
|
}
|
2019-07-18 06:56:57 +00:00
|
|
|
int cz = z - center.getBlockZ();
|
2019-06-28 16:09:56 +00:00
|
|
|
int cz2 = cz * cz;
|
|
|
|
if (cz2 > radiusSqr.getBlockZ()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (sphere) {
|
2019-07-18 06:56:57 +00:00
|
|
|
return cx2 + cz2 <= radiusLengthSqr;
|
2019-06-28 16:09:56 +00:00
|
|
|
}
|
2019-07-18 06:56:57 +00:00
|
|
|
double cxd = cx2 * inverseRadius.getX();
|
|
|
|
double czd = cz2 * inverseRadius.getZ();
|
|
|
|
return cxd + czd <= 1;
|
2011-12-27 22:24:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns string representation in the format
|
|
|
|
* "(centerX, centerY, centerZ) - (radiusX, radiusY, radiusZ)".
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
return center + " - " + getRadius();
|
|
|
|
}
|
|
|
|
|
2018-12-23 16:19:33 +00:00
|
|
|
public void extendRadius(Vector3 minRadius) {
|
2019-01-09 07:13:44 +00:00
|
|
|
setRadius(minRadius.getMaximum(getRadius()));
|
2011-12-27 22:24:57 +00:00
|
|
|
}
|
2012-03-20 14:14:41 +00:00
|
|
|
|
2014-07-26 07:29:12 +00:00
|
|
|
@Override
|
2012-03-20 14:14:41 +00:00
|
|
|
public EllipsoidRegion clone() {
|
|
|
|
return (EllipsoidRegion) super.clone();
|
|
|
|
}
|
2019-06-12 21:12:12 +00:00
|
|
|
|
2019-07-18 06:56:57 +00:00
|
|
|
private void filterSpherePartial(int y1, int y2, int bx, int bz, Filter filter, ChunkFilterBlock block, IChunkGet get, IChunkSet set) {
|
|
|
|
int sectionStart = y1 >> 4;
|
|
|
|
int sectionEnd = y2 >> 4;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void filterSpherePartial(int layer, int y1, int y2, int bx, int bz, Filter filter, ChunkFilterBlock block, IChunkGet get, IChunkSet set) {
|
|
|
|
int cx = center.getBlockX();
|
|
|
|
int cy = center.getBlockY();
|
|
|
|
int cz = center.getBlockZ();
|
|
|
|
|
|
|
|
block.init(get, set, layer);
|
|
|
|
|
|
|
|
int by = layer << 4;
|
|
|
|
int diffY;
|
|
|
|
for (int y = y1, yy = by + y1; y <= y2; y++, yy++) {
|
|
|
|
diffY = cy - yy;
|
|
|
|
int remainderY = radiusLengthSqr - (diffY * diffY);
|
|
|
|
if (remainderY >= 0) {
|
|
|
|
for (int z = 0; z < 16; z++) {
|
|
|
|
int zz = z + bz;
|
|
|
|
int diffZ = cz - zz;
|
|
|
|
int remainderZ = remainderY - (diffZ * diffZ);
|
|
|
|
if (remainderZ >= 0) {
|
|
|
|
int diffX = MathMan.usqrt(remainderZ);
|
|
|
|
int minX = Math.max(0, cx - diffX - bx);
|
|
|
|
int maxX = Math.min(15, cx + diffX - bx);
|
|
|
|
if (minX != maxX) {
|
|
|
|
block.filter(filter, minX, y, z, maxX, y, z);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void filter(IChunk chunk, Filter filter, ChunkFilterBlock block, IChunkGet get, IChunkSet set) {
|
|
|
|
// Check bounds
|
|
|
|
// This needs to be able to perform 50M blocks/sec otherwise it becomes a bottleneck
|
|
|
|
int cx = center.getBlockX();
|
|
|
|
int cz = center.getBlockZ();
|
|
|
|
int bx = chunk.getX() << 4;
|
|
|
|
int bz = chunk.getZ() << 4;
|
|
|
|
int tx = bx + 15;
|
|
|
|
int tz = bz + 15;
|
|
|
|
int cx1 = bx - cx;
|
|
|
|
int cx2 = tx - cx;
|
|
|
|
int cxMax, cxMin;
|
|
|
|
if (cx1 < cx2) {
|
|
|
|
cxMin = cx1;
|
|
|
|
cxMax = cx2;
|
|
|
|
} else {
|
|
|
|
cxMin = cx2;
|
|
|
|
cxMax = cx1;
|
|
|
|
}
|
|
|
|
int cxMin2 = cxMin * cxMin;
|
|
|
|
int cxMax2 = cxMax * cxMax;
|
|
|
|
int cz1 = bz - cz;
|
|
|
|
int cz2 = tz - cz;
|
|
|
|
int czMax, czMin;
|
|
|
|
if (cz1 < cz2) {
|
|
|
|
czMin = cz1;
|
|
|
|
czMax = cz2;
|
|
|
|
} else {
|
|
|
|
czMin = cz2;
|
|
|
|
czMax = cz1;
|
|
|
|
}
|
|
|
|
int czMin2 = czMin * czMin;
|
|
|
|
int czMax2 = czMax * czMax;
|
|
|
|
|
|
|
|
|
|
|
|
if (sphere) {
|
|
|
|
// Does not contain chunk
|
|
|
|
if (cxMin2 + czMin2 >= radiusLengthSqr) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
int diffY2 = radiusLengthSqr - cxMax2 - czMax2;
|
|
|
|
// (shortcut) Contains all of certain layers
|
|
|
|
if (diffY2 >= 0) {
|
|
|
|
// Get the solid layers
|
|
|
|
int cy = center.getBlockY();
|
|
|
|
int diffYFull = MathMan.usqrt(diffY2);
|
|
|
|
int yBotFull = Math.max(0, cy - diffYFull);
|
|
|
|
int yTopFull = Math.min(255, cy + diffYFull);
|
|
|
|
// Set those layers
|
|
|
|
filter(chunk, filter, block, get, set, yBotFull, yTopFull);
|
|
|
|
|
|
|
|
// Fill the remaining layers
|
|
|
|
if (yBotFull != 0 || yTopFull != 255) {
|
|
|
|
int diffYPartial = MathMan.usqrt(radiusLengthSqr - cxMin * cxMin - czMin * czMin);
|
|
|
|
|
|
|
|
if (yBotFull != 0) {
|
|
|
|
int yBotPartial = Math.max(0, cy - diffYPartial);
|
|
|
|
filterSpherePartial(yBotPartial, yBotFull - 1, bx, bz, filter, block, get, set);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (yTopFull != 255) {
|
|
|
|
int yTopPartial = Math.min(255, cy + diffYPartial);
|
|
|
|
filterSpherePartial(yTopFull + 1, yTopPartial - 1, bx, bz, filter, block, get, set);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
super.filter(chunk, filter, block, get, set); // TODO optimize non spheres
|
|
|
|
}
|
|
|
|
}
|
2011-12-27 22:24:57 +00:00
|
|
|
}
|