Class IntXYZ
java.lang.Object
de.marcely.bedwars.tools.location.IntXYZ
- All Implemented Interfaces:
Cloneable
,ConfigurationSerializable
Represents a 3-dimensional int position (i.a. block coord)
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd
(int x, int y, int z) Adds the x-coordinatesclone()
static IntXYZ
deserialize
(Map<String, Object> data) Required method for deserializationdouble
double
boolean
equalsBlockCoords
(XYZ xyz) Check whether the block coords match.boolean
equalsBlockCoords
(Block block) Check whether the block coords match.boolean
Check whether the block coords match.Get the Bukkit block that you can find at the given position.int
getX()
Returns the x-coordinateint
getY()
Returns the y-coordinateint
getZ()
Returns the z-coordinateboolean
isZero()
Get whether all coordinates are set to 0multiply
(int amount) multiply
(int x, int y, int z) set
(int x, int y, int z) Sets the new coordinatesCopies and sets the xyz coordinates from the given objectCopies and sets the xyz coordinates from the given blockCopies and sets the xyz coordinates from the given objectsetX
(int x) Sets the x-coordinatesetY
(int y) Sets the y-coordinatesetZ
(int z) Sets the z-coordinatesubtract
(int x, int y, int 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 int x -
y
protected int y -
z
protected int z
-
-
Constructor Details
-
IntXYZ
public IntXYZ() -
IntXYZ
-
IntXYZ
-
IntXYZ
-
IntXYZ
-
IntXYZ
public IntXYZ(int x, int y, int z)
-
-
Method Details
-
getX
public int getX()Returns the x-coordinate- Returns:
- The x value
-
getY
public int getY()Returns the y-coordinate- Returns:
- The y value
-
getZ
public int getZ()Returns the z-coordinate- Returns:
- The z value
-
setX
Sets the x-coordinate- Parameters:
x
- The new x-coordinate- Returns:
- This IntXYZ instance
-
setY
Sets the y-coordinate- Parameters:
y
- The new y-coordinate- Returns:
- This IntXYZ instance
-
setZ
Sets the z-coordinate- Parameters:
z
- The new z-coordinate- Returns:
- This IntXYZ instance
-
set
Sets the new coordinates- Parameters:
x
- The new x-coordinatey
- The new y-coordinatez
- The new z-coordinate- Returns:
- This IntXYZ 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 IntXYZ 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 IntXYZ instance
-
set
Copies and sets the xyz coordinates from the given block- Parameters:
block
- The object from which it shall be taken from- Returns:
- This IntXYZ instance
-
add
Adds the x-coordinates- Parameters:
x
- The added x-coordinatey
- The added y-coordinatez
- The added z-coordinate- Returns:
- This IntXYZ instance
-
add
-
subtract
-
subtract
-
multiply
-
multiply
-
zero
Sets all coordinates to 0- Returns:
- This IntXYZ instance
-
isZero
public boolean isZero()Get whether all coordinates are set to 0- Returns:
true
if X, Y and Z are set to 0
-
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 match.- Parameters:
xyz
- The other object to compare with- Returns:
true
if the floored coordinates match
-
equalsBlockCoords
Check whether the block coords match.- Parameters:
loc
- The other object to compare with- Returns:
true
if the floored coordinates match
-
equalsBlockCoords
Check whether the block coords 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
-