Class Position
java.lang.Object
me.gamercoder215.mobchip.util.Position
- All Implemented Interfaces:
Cloneable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull Positionadd(int x, int y, int z) Adds an amount to each coordinate.@NotNull PositionAdds a Position to this Position.@NotNull PositionAdds a location to this Position.@NotNull PositionAdds an entity's location to this Position.clone()doubleGets the distance of this Position to another Position.doubleGets the distance of this Position to another Location.doubleGets the distance of this Position to another Entity.doubledistanceManhattan(@NotNull Position node) Fetches the Manhattan distance to another Position.doubledistanceManhattan(@NotNull Location loc) Fetches the Manhattan distance to another Location.doubledistanceSquared(double x, double y, double z) GEts the distance, squared, of this Position to these coordinates.doubledistanceSquared(@NotNull Position node) Gets the distance, squared, of this Position to another Position.doubledistanceSquared(@NotNull Location loc) Gets the distance, squared, of this Position to another Location.doubledistanceSquared(@NotNull Entity en) Gets the distance, squared, of this Position to another Entity.intgetX()Fetches the current X value of this Position.intgetY()Fetches the current Y value of this Position.intgetZ()Fetches the current Z value of this Position.@NotNull Positionremove(int x, int y, int z) Removes an amount to each coordinate.@NotNull PositionRemoves a Position from this Position.@NotNull PositionRemoves a Location from this Position.@NotNull PositionRemoves an entity's location from this Position.@NotNull PositionsetX(int x) Sets the Position's X value.@NotNull PositionsetY(int y) Sets the Position's Y value.@NotNull PositionsetZ(int z) Sets the Position's Z value.@NotNull LocationtoLocation(@Nullable World w) Converts this Position to a Bukkit Location.@NotNull VectortoVector()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
-
add
-
add
-
remove
-
remove
-
remove
-
toLocation
-
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
-