mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-07 23:52:11 -07:00
Improved Vector and Location with some utility methods, optimized Vector.isInSphere().
By: sk89q <the.sk89q@gmail.com>
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
Reference in New Issue
Block a user