Improved Vector and Location with some utility methods, optimized Vector.isInSphere().

By: sk89q <the.sk89q@gmail.com>
This commit is contained in:
Bukkit/Spigot
2011-01-02 10:42:13 -08:00
parent f6873cab82
commit 61b42932b1
2 changed files with 419 additions and 352 deletions

View File

@@ -60,6 +60,16 @@ public class Location implements Cloneable {
public double getX() {
return x;
}
/**
* Gets the floored value of the X component, indicating the block that
* this location is contained with.
*
* @return block X
*/
public int getBlockX() {
return (int)Math.floor(x);
}
/**
* Sets the y-coordinate of this location
@@ -79,6 +89,16 @@ public class Location implements Cloneable {
return y;
}
/**
* Gets the floored value of the Y component, indicating the block that
* this location is contained with.
*
* @return block y
*/
public int getBlockY() {
return (int)Math.floor(y);
}
/**
* Sets the z-coordinate of this location
*
@@ -97,6 +117,16 @@ public class Location implements Cloneable {
return z;
}
/**
* Gets the floored value of the Z component, indicating the block that
* this location is contained with.
*
* @return block z
*/
public int getBlockZ() {
return (int)Math.floor(z);
}
/**
* Sets the yaw of this location
*