@@ -55,6 +55,7 @@ public class EllipsoidRegion extends AbstractRegion {
5555
5656 //FAWE start
5757 private Vector3 radiusSqr ;
58+ private BlockVector3 radiusSqrBlocks ;
5859 private Vector3 inverseRadiusSqr ;
5960 private int radiusLengthSqr ;
6061 private boolean sphere ;
@@ -198,6 +199,7 @@ public void setRadius(Vector3 radius) {
198199 this .radius = radius .add (0.5 , 0.5 , 0.5 );
199200 //FAWE start
200201 radiusSqr = radius .multiply (radius );
202+ radiusSqrBlocks = radiusSqr .toBlockPoint ();
201203 radiusLengthSqr = (int ) radiusSqr .x ();
202204 this .sphere = radius .y () == radius .x () && radius .x () == radius .z ();
203205 inverseRadiusSqr = Vector3 .ONE .divide (radiusSqr );
@@ -233,17 +235,17 @@ public Set<BlockVector2> getChunks() {
233235 public boolean contains (int x , int y , int z ) {
234236 int cx = x - center .x ();
235237 int cx2 = cx * cx ;
236- if (cx2 > radiusSqr . getBlockX ()) {
238+ if (cx2 > radiusSqrBlocks . x ()) {
237239 return false ;
238240 }
239241 int cz = z - center .z ();
240242 int cz2 = cz * cz ;
241- if (cz2 > radiusSqr . getBlockZ ()) {
243+ if (cz2 > radiusSqrBlocks . z ()) {
242244 return false ;
243245 }
244246 int cy = y - center .y ();
245247 int cy2 = cy * cy ;
246- if (radiusSqr . getBlockY () < getWorldMaxY () && cy2 > radiusSqr . getBlockY ()) {
248+ if (radiusSqrBlocks . y () < getWorldMaxY () && cy2 > radiusSqrBlocks . y ()) {
247249 return false ;
248250 }
249251 if (sphere ) {
@@ -272,12 +274,12 @@ public boolean contains(BlockVector3 position) {
272274 public boolean contains (int x , int z ) {
273275 int cx = x - center .x ();
274276 int cx2 = cx * cx ;
275- if (cx2 > radiusSqr . getBlockX ()) {
277+ if (cx2 > radiusSqrBlocks . x ()) {
276278 return false ;
277279 }
278280 int cz = z - center .z ();
279281 int cz2 = cz * cz ;
280- if (cz2 > radiusSqr . getBlockZ ()) {
282+ if (cz2 > radiusSqrBlocks . z ()) {
281283 return false ;
282284 }
283285 double cxd = cx2 * inverseRadiusSqr .x ();
0 commit comments