3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-10 05:20:04 +01:00

Added a utility method for dealing with location precision to bukkit utilities.

Dieser Commit ist enthalten in:
hash 2011-06-06 19:32:15 -05:00
Ursprung 126815fcf5
Commit b5c9f70e70

Datei anzeigen

@ -86,4 +86,16 @@ public class BukkitUtil {
public static World toWorld(WorldVector pt) { public static World toWorld(WorldVector pt) {
return ((BukkitWorld)pt.getWorld()).getWorld(); return ((BukkitWorld)pt.getWorld()).getWorld();
} }
/**
* Bukkit's Location class has serious problems with floating point
* precision.
*/
public static boolean equals(Location a, Location b) {
if (Math.abs(a.getX()-b.getX()) > EQUALS_PRECISION) return false;
if (Math.abs(a.getY()-b.getY()) > EQUALS_PRECISION) return false;
if (Math.abs(a.getZ()-b.getZ()) > EQUALS_PRECISION) return false;
return true;
}
public static final double EQUALS_PRECISION = 0.0001;
} }