From 74835286d91a6eac9a5e35648f74e97cb48d41ce Mon Sep 17 00:00:00 2001 From: Brettflan Date: Wed, 27 Jul 2011 14:06:49 -0500 Subject: [PATCH] Fix for round borders with a radius larger than 46340 (!wow that's huge!) being horribly glitched; was caused by limitations of "int" data type --- src/com/wimbli/WorldBorder/BorderData.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/com/wimbli/WorldBorder/BorderData.java b/src/com/wimbli/WorldBorder/BorderData.java index d8926f8..932c339 100644 --- a/src/com/wimbli/WorldBorder/BorderData.java +++ b/src/com/wimbli/WorldBorder/BorderData.java @@ -20,7 +20,7 @@ public class BorderData private double minX; private double maxZ; private double minZ; - private int radiusSquared; + private double radiusSquared; private double DefiniteSquare; public BorderData(double x, double z, int radius) @@ -31,18 +31,12 @@ public class BorderData { setData(x, z, radius, shapeRound); } - public void setData(double x, double z, int radius, Boolean shapeRound) + public final void setData(double x, double z, int radius, Boolean shapeRound) { this.x = x; this.z = z; - this.radius = radius; - this.maxX = x + radius; - this.minX = x - radius; - this.maxZ = z + radius; - this.minZ = z - radius; - this.radiusSquared = radius * radius; this.shapeRound = shapeRound; - this.DefiniteSquare = Math.sqrt(.5 * this.radiusSquared); + this.setRadius(radius); } public BorderData copy() @@ -81,7 +75,7 @@ public class BorderData this.minX = x - radius; this.maxZ = z + radius; this.minZ = z - radius; - this.radiusSquared = radius * radius; + this.radiusSquared = (double)radius * (double)radius; this.DefiniteSquare = Math.sqrt(.5 * this.radiusSquared); }