Class XYZ
java.lang.Object
de.marcely.bedwars.tools.location.XYZ
- All Implemented Interfaces:
Cloneable
,ConfigurationSerializable
- Direct Known Subclasses:
ImmutableXYZ
,XYZD
,XYZYP
Represents a 3-dimensional position
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd
(double x, double y, double z) Adds the x-coordinatesclone()
static XYZ
deserialize
(Map<String, Object> data) Required method for deserializationdouble
double
double
double
boolean
equalsBlockCoords
(XYZ xyz) Check whether the block coords (i.a.boolean
equalsBlockCoords
(Block block) Check whether the block coords (i.a.boolean
Check whether the block coords (i.a.Get the Bukkit block that you can find at the given position.int
Returns the floored x-coordinateint
Returns the floored y-coordinateint
Returns the floored z-coordinatedouble
getX()
Returns the x-coordinatedouble
getY()
Returns the y-coordinatedouble
getZ()
Returns the z-coordinateboolean
isZero()
Get whether all coordinates are set to 0multiply
(double amount) multiply
(double x, double y, double z) set
(double x, double y, double z) Sets the new coordinatesCopies and sets the xyz coordinates from the given objectCopies and sets the xyz coordinates from the given objectCopies and sets the xyz coordinates from the given objectsetX
(double x) Sets the x-coordinatesetY
(double y) Sets the y-coordinatesetZ
(double z) Sets the z-coordinatesubtract
(double x, double y, double z) toLocation
(World world) Converts this XYZ object to a new Location objecttoVector()
Converts this XYZ object to a new Vector objectzero()
Sets all coordinates to 0
-
Field Details
-
x
protected double x -
y
protected double y -
z
protected double z
-
-
Constructor Details
-
XYZ
public XYZ() -
XYZ
-
XYZ
-
XYZ
-
XYZ
-
XYZ
public XYZ(double x, double y, double z)
-
-
Method Details
-
getX
public double getX()Returns the x-coordinate- Returns:
- The x value
-
getY
public double getY()Returns the y-coordinate- Returns:
- The y value
-
getZ
public double getZ()Returns the z-coordinate- Returns:
- The z value
-
getBlockX
public int getBlockX()Returns the floored x-coordinate- Returns:
- The block x-coordinate
-
getBlockY
public int getBlockY()Returns the floored y-coordinate- Returns:
- The block y-coordinate
-
getBlockZ
public int getBlockZ()Returns the floored z-coordinate- Returns:
- The block z-coordinate
-
setX
Sets the x-coordinate- Parameters:
x
- The new x-coordinate- Returns:
- This XYZ instance
-
setY
Sets the y-coordinate- Parameters:
y
- The new y-coordinate- Returns:
- This XYZ instance
-
setZ
Sets the z-coordinate- Parameters:
z
- The new z-coordinate- Returns:
- This XYZ instance
-
set
Sets the new coordinates- Parameters:
x
- The new x-coordinatey
- The new y-coordinatez
- The new z-coordinate- Returns:
- This XYZ instance
-
set
Copies and sets the xyz coordinates from the given object- Parameters:
xyz
- The object from which it shall be taken from- Returns:
- This XYZ instance
-
set
Copies and sets the xyz coordinates from the given object- Parameters:
xyz
- The object from which it shall be taken from- Returns:
- This XYZ instance
-
set
Copies and sets the xyz coordinates from the given object- Parameters:
loc
- The object from which it shall be taken from- Returns:
- This XYZ instance
-
add
Adds the x-coordinates- Parameters:
x
- The added x-coordinatey
- The added y-coordinatez
- The added z-coordinate- Returns:
- This XYZ instance
-
add
-
add
-
add
-
add
-
subtract
-
subtract
-
subtract
-
subtract
-
subtract
-
multiply
-
multiply
-
zero
Sets all coordinates to 0- Returns:
- This XYZ instance
-
isZero
public boolean isZero()Get whether all coordinates are set to 0- Returns:
true
if X, Y and Z are set to 0.0D
-
distance
-
distanceSquared
-
distance
-
distanceSquared
-
toLocation
Converts this XYZ object to a new Location object- Parameters:
world
- The world needed for creating the Location- Returns:
- A new location whose coordinates where taken from this object
-
toVector
Converts this XYZ object to a new Vector object- Returns:
- A new vector whose coordinates where taken from this object
-
getBlock
Get the Bukkit block that you can find at the given position.- Parameters:
world
- The world in which we want to look up the block- Returns:
- The matching block
-
equalsBlockCoords
Check whether the block coords (i.a.getBlockX()
) match.- Parameters:
xyz
- The other object to compare with- Returns:
true
if the floored coordinates match
-
equalsBlockCoords
Check whether the block coords (i.a.getBlockX()
) match.- Parameters:
loc
- The other object to compare with- Returns:
true
if the floored coordinates match
-
equalsBlockCoords
Check whether the block coords (i.a.getBlockX()
) match.- Parameters:
block
- The other object to compare with- Returns:
true
if the floored coordinates match
-
clone
-
serialize
- Specified by:
serialize
in interfaceConfigurationSerializable
-
deserialize
Required method for deserialization- Parameters:
data
- map to deserialize- Returns:
- deserialized xyz instance
-