mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
Upstream changes, prefix changes, formatting changes, variable name changes
I think that draining waterlogged items also works now?
This commit is contained in:
@ -19,13 +19,12 @@
|
||||
|
||||
package com.sk89q.worldedit.regions;
|
||||
|
||||
|
||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.storage.ChunkStore;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@ -43,9 +42,6 @@ public class EllipsoidRegion extends AbstractRegion {
|
||||
* Stores the radii plus 0.5 on each axis.
|
||||
*/
|
||||
private Vector3 radius;
|
||||
private Vector3 radiusSqr;
|
||||
private int radiusLengthSqr;
|
||||
private boolean sphere;
|
||||
|
||||
/**
|
||||
* Construct a new instance of this ellipsoid region.
|
||||
@ -57,11 +53,10 @@ public class EllipsoidRegion extends AbstractRegion {
|
||||
this(null, pos1, pos2);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new instance of this ellipsoid region.
|
||||
*
|
||||
* @param world the world
|
||||
* @param world the world
|
||||
* @param center the center
|
||||
* @param radius the radius
|
||||
*/
|
||||
@ -87,7 +82,6 @@ public class EllipsoidRegion extends AbstractRegion {
|
||||
|
||||
@Override
|
||||
public int getArea() {
|
||||
if (radius == null) return 0;
|
||||
return (int) Math.floor((4.0 / 3.0) * Math.PI * radius.getX() * radius.getY() * radius.getZ());
|
||||
}
|
||||
|
||||
@ -98,7 +92,7 @@ public class EllipsoidRegion extends AbstractRegion {
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return Math.max((int) (2 * radius.getY()), 256);
|
||||
return (int) (2 * radius.getY());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -129,7 +123,7 @@ public class EllipsoidRegion extends AbstractRegion {
|
||||
@Override
|
||||
public void expand(BlockVector3... changes) throws RegionOperationException {
|
||||
center = center.add(calculateDiff(changes));
|
||||
setRadius(radius.add(calculateChanges(changes)));
|
||||
radius = radius.add(calculateChanges(changes));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -169,7 +163,6 @@ public class EllipsoidRegion extends AbstractRegion {
|
||||
* @return radii
|
||||
*/
|
||||
public Vector3 getRadius() {
|
||||
if (radius == null) return null;
|
||||
return radius.subtract(0.5, 0.5, 0.5);
|
||||
}
|
||||
|
||||
@ -179,14 +172,7 @@ public class EllipsoidRegion extends AbstractRegion {
|
||||
* @param radius the radius
|
||||
*/
|
||||
public void setRadius(Vector3 radius) {
|
||||
this.radius = radius;
|
||||
radiusSqr = radius.multiply(radius);
|
||||
radiusLengthSqr = (int) radiusSqr.getX();
|
||||
if (radius.getY() == radius.getX() && radius.getX() == radius.getZ()) {
|
||||
this.sphere = true;
|
||||
} else {
|
||||
this.sphere = false;
|
||||
}
|
||||
this.radius = radius.add(0.5, 0.5, 0.5);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -214,29 +200,8 @@ public class EllipsoidRegion extends AbstractRegion {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(BlockVector3 position) {
|
||||
int cx = position.getBlockX() - center.getBlockX();
|
||||
int cx2 = cx * cx;
|
||||
if (cx2 > radiusSqr.getBlockX()) {
|
||||
return false;
|
||||
}
|
||||
int cz = position.getBlockZ() - center.getBlockZ();
|
||||
int cz2 = cz * cz;
|
||||
if (cz2 > radiusSqr.getBlockZ()) {
|
||||
return false;
|
||||
}
|
||||
int cy = position.getBlockY() - center.getBlockY();
|
||||
int cy2 = cy * cy;
|
||||
if (radiusSqr.getBlockY() < 255 && cy2 > radiusSqr.getBlockY()) {
|
||||
return false;
|
||||
}
|
||||
if (sphere) {
|
||||
return cx2 + cy2 + cz2 <= radiusLengthSqr;
|
||||
}
|
||||
double cxd = (double) cx / radius.getBlockX();
|
||||
double cyd = (double) cy / radius.getBlockY();
|
||||
double czd = (double) cz / radius.getBlockZ();
|
||||
return cxd * cxd + cyd * cyd + czd * czd <= 1;
|
||||
public boolean contains(BlockVector3 position) {
|
||||
return position.subtract(center).toVector3().divide(radius).lengthSq() <= 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -258,4 +223,5 @@ public class EllipsoidRegion extends AbstractRegion {
|
||||
public EllipsoidRegion clone() {
|
||||
return (EllipsoidRegion) super.clone();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user