Package me.gamercoder215.mobchip.util
Class Position
java.lang.Object
me.gamercoder215.mobchip.util.Position
- All Implemented Interfaces:
Cloneable
Represents a
Location
without a World-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd
(int x, int y, int z) Adds an amount to each coordinate.Adds a Position to this Position.Adds a location to this Position.Adds an entity's location to this Position.clone()
double
Gets the distance of this Position to another Position.double
Gets the distance of this Position to another Location.double
Gets the distance of this Position to another Entity.double
Fetches the Manhattan distance to another Position.double
Fetches the Manhattan distance to another Location.double
distanceSquared
(double x, double y, double z) GEts the distance, squared, of this Position to these coordinates.double
distanceSquared
(@NotNull Position node) Gets the distance, squared, of this Position to another Position.double
Gets the distance, squared, of this Position to another Location.double
Gets the distance, squared, of this Position to another Entity.int
getX()
Fetches the current X value of this Position.int
getY()
Fetches the current Y value of this Position.int
getZ()
Fetches the current Z value of this Position.remove
(int x, int y, int z) Removes an amount to each coordinate.Removes a Position from this Position.Removes a Location from this Position.Removes an entity's location from this Position.setX
(int x) Sets the Position's X value.setY
(int y) Sets the Position's Y value.setZ
(int z) Sets the Position's Z value.Converts this Position to a Bukkit Location.toVector()
Converts this Position to a Bukkit Vector.
-
Constructor Details
-
Position
Constructs a Position at this Entity.- Parameters:
en
- Entity to use
-
Position
Constructs a Position at this Location.- Parameters:
loc
- Location
-
Position
public Position(double x, double y, double z) Constructs a Position at these coordinates.- Parameters:
x
- X coordy
- Y Coordz
- Z coord
-
Position
public Position(int x, int y, int z) Constructs a Position at these coordinates.- Parameters:
x
- X coordy
- Y Coordz
- Z coord
-
-
Method Details
-
distance
Gets the distance of this Position to another Position.- Parameters:
node
- Position to use- Returns:
- distance
-
distance
Gets the distance of this Position to another Location.- Parameters:
loc
- Location to use- Returns:
- distance
-
distance
Gets the distance of this Position to another Entity.- Parameters:
en
- Entity to use- Returns:
- distance
-
distanceSquared
Gets the distance, squared, of this Position to another Position.- Parameters:
node
- Position to use- Returns:
- distance squared
-
distanceSquared
Gets the distance, squared, of this Position to another Location.- Parameters:
loc
- Location to use- Returns:
- distance squared
-
distanceSquared
Gets the distance, squared, of this Position to another Entity.- Parameters:
en
- Entity to use- Returns:
- distance squared
-
distanceSquared
public double distanceSquared(double x, double y, double z) GEts the distance, squared, of this Position to these coordinates.- Parameters:
x
- X coordy
- Y Coordz
- Z coord- Returns:
- distance squared
-
distanceManhattan
Fetches the Manhattan distance to another Position.- Parameters:
node
- Position to use- Returns:
- Manhattan distance
-
distanceManhattan
Fetches the Manhattan distance to another Location.- Parameters:
loc
- Location to use- Returns:
- Manhattan distance
-
getX
public int getX()Fetches the current X value of this Position.- Returns:
- X coordinate
-
getY
public int getY()Fetches the current Y value of this Position.- Returns:
- Y coordinate
-
getZ
public int getZ()Fetches the current Z value of this Position.- Returns:
- Z coordinate
-
add
Adds an amount to each coordinate.- Parameters:
x
- Amount of X to addy
- Amount of Y to addz
- Amount of Z to add- Returns:
- this class, for chaining
-
remove
Removes an amount to each coordinate.- Parameters:
x
- Amount of X to removey
- Amount of Y to removez
- Amount of Z to remove- Returns:
- this class, for chaining
-
add
Adds a Position to this Position.- Parameters:
node
- Position to add- Returns:
- this class, for chaining
-
add
Adds a location to this Position.- Parameters:
loc
- Location to add- Returns:
- this class, for chaining
-
add
Adds an entity's location to this Position.- Parameters:
en
- Entity to add- Returns:
- this class, for chaining
-
remove
Removes a Location from this Position.- Parameters:
loc
- Location to remove- Returns:
- this class, for chaining
-
remove
Removes an entity's location from this Position.- Parameters:
en
- Entity to remove- Returns:
- this class, for chaining
-
remove
Removes a Position from this Position.- Parameters:
node
- Position to remove- Returns:
- this class, for chaining
-
toLocation
Converts this Position to a Bukkit Location.- Parameters:
w
- World to use- Returns:
- Bukkit Location created
-
toVector
Converts this Position to a Bukkit Vector.- Returns:
- Bukkit Vector created
-
setX
Sets the Position's X value.- Parameters:
x
- X value to set- Returns:
- this class, for chaining
-
setY
Sets the Position's Y value.- Parameters:
y
- Y value to set- Returns:
- this class, for chaining
-
setZ
Sets the Position's Z value.- Parameters:
z
- Z value to set- Returns:
- this class, for chaining
-
clone
-