public final class Position extends Object
Modifier and Type | Field and Description |
---|---|
static List<org.bukkit.block.BlockFace> |
ROTATIONS
Common Rotation values used blocks such as Signs, Skulls, and Banners.
|
Modifier and Type | Method and Description |
---|---|
static org.bukkit.Location |
copyLocation(org.bukkit.Location source,
org.bukkit.Location dest)
Copy the contents of one Location to another.
|
static org.bukkit.Location |
copyPosition(org.bukkit.Location source,
org.bukkit.Location dest)
Copy the position contents (x,y,z) of one Location to another.
|
static byte |
getDirection(org.bukkit.block.BlockFace rotation)
Gets the byte rotation for an intercardinal BlockFace, where NORTH is 0.
|
static org.bukkit.block.BlockFace |
getDirection(byte rotation)
Get an intercardinal BlockFace from a rotation value, where NORTH is 0.
|
static int |
getIntHeadYaw(float headYaw)
Gets an integer approximation of the head-yaw rotation between 0 and 255.
|
static int |
getIntPitch(org.bukkit.Location loc)
Gets an integer approximation of the pitch between 0 and 255.
|
static int |
getIntYaw(org.bukkit.Location loc)
Gets an integer approximation of the yaw between 0 and 255.
|
static long |
getPosition(org.bukkit.util.BlockVector vector)
Gets the serialized position value for a block vector.
|
static org.bukkit.util.BlockVector |
getPosition(long position)
Decodes the block vector from a serialized position value.
|
static boolean |
hasMoved(org.bukkit.Location first,
org.bukkit.Location second)
Gets whether there has been a position change between the two Locations.
|
static boolean |
hasRotated(org.bukkit.Location first,
org.bukkit.Location second)
Gets whether there has been a rotation change between the two Locations.
|
public static final List<org.bukkit.block.BlockFace> ROTATIONS
public static int getIntYaw(org.bukkit.Location loc)
loc
- The location to get the value from.public static int getIntPitch(org.bukkit.Location loc)
loc
- The location to get the value from.public static int getIntHeadYaw(float headYaw)
headYaw
- the head-yaw rotation value.public static boolean hasMoved(org.bukkit.Location first, org.bukkit.Location second)
first
- The initial location.second
- The final location.public static boolean hasRotated(org.bukkit.Location first, org.bukkit.Location second)
first
- The initial location.second
- The final location.public static org.bukkit.Location copyLocation(org.bukkit.Location source, org.bukkit.Location dest)
source
- The Location to read from.dest
- The Location to modify. May be null.public static org.bukkit.Location copyPosition(org.bukkit.Location source, org.bukkit.Location dest)
source
- The Location to read the x, y and z values from.dest
- The Location to modify the x, y and z values. May be null.public static org.bukkit.block.BlockFace getDirection(byte rotation)
rotation
- byte value rotation to getIndexOutOfBoundsException
- If the value is less than 0 or greater than 15public static byte getDirection(org.bukkit.block.BlockFace rotation)
rotation
- Rotation to getpublic static long getPosition(org.bukkit.util.BlockVector vector)
vector
- the block vector to serializepublic static org.bukkit.util.BlockVector getPosition(long position)
position
- the position to decodeCopyright © 2021. All rights reserved.