Class PathPosition
java.lang.Object
de.metaphoriker.pathetic.api.wrapper.PathPosition
- All Implemented Interfaces:
Cloneable
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@NonNull PathPosition
add
(double x, double y, double z) Adds x,y,z values to the current values@NonNull PathPosition
add
(PathVector vector) Adds the values of a vector to the positionclone()
double
distance
(PathPosition otherPosition) Gets the distance between the current and another positiondouble
distanceSquared
(PathPosition otherPosition) Gets the distance squared between the current and another positionboolean
floor()
Rounds the x,y,z values to the floor of the valuesint
Gets the X coordinate of the block the position is inint
Gets the Y coordinate of the block the position is inint
Gets the Z coordinate of the block the position is inint
hashCode()
interpolate
(PathPosition other, double progress) Interpolates between two positions based on the given progress.boolean
isInSameBlock
(PathPosition otherPosition) Checks to see if the two positions are in the same blockint
manhattanDistance
(PathPosition otherPosition) Gets the manhattan distance between the current and another positionmid()
Sets the coordinates to the middle of the blockmidPoint
(PathPosition end) double
octileDistance
(PathPosition otherPosition) Gets the octile distance between the current and another positionsetX
(double x) Sets the X coordinate of thePathPosition
setY
(double y) Sets the Y coordinate of thePathPosition
setZ
(double z) Sets the Z coordinate of thePathPosition
@NonNull PathPosition
subtract
(double x, double y, double z) Subtracts x,y,z values from the current values@NonNull PathPosition
subtract
(PathVector vector) Subtracts the values of a vector from the position@NonNull PathVector
toVector()
Converts the positions x,y,z to aPathVector
-
Constructor Details
-
PathPosition
public PathPosition()
-
-
Method Details
-
interpolate
Interpolates between two positions based on the given progress.- Parameters:
other
- The other position to interpolate withprogress
- The interpolation progress (0.0 to 1.0)- Returns:
- The interpolated position
-
isInSameBlock
Checks to see if the two positions are in the same block- Parameters:
otherPosition
- The other position to check against- Returns:
- True if the positions are in the same block
-
manhattanDistance
Gets the manhattan distance between the current and another position- Parameters:
otherPosition
- the otherPathPosition
to get the distance to- Returns:
- the distance
-
octileDistance
Gets the octile distance between the current and another position- Parameters:
otherPosition
- the otherPathPosition
to get the distance to- Returns:
- the distance
-
distanceSquared
Gets the distance squared between the current and another position- Returns:
- The distance squared
-
distance
Gets the distance between the current and another position- Returns:
- The distance
-
setX
Sets the X coordinate of thePathPosition
- Parameters:
x
- The new X coordinate- Returns:
- A new
PathPosition
-
setY
Sets the Y coordinate of thePathPosition
- Parameters:
y
- The new Y coordinate- Returns:
- A new
PathPosition
-
setZ
Sets the Z coordinate of thePathPosition
- Parameters:
z
- The new Z coordinate- Returns:
- A new
PathPosition
-
getBlockX
public int getBlockX()Gets the X coordinate of the block the position is in- Returns:
- The X coordinate of the block
-
getBlockY
public int getBlockY()Gets the Y coordinate of the block the position is in- Returns:
- The Y coordinate of the block
-
getBlockZ
public int getBlockZ()Gets the Z coordinate of the block the position is in- Returns:
- The Z coordinate of the block
-
add
Adds x,y,z values to the current values- Parameters:
x
- The value to add to the xy
- The value to add to the yz
- The value to add to the z- Returns:
- A new
PathPosition
-
add
Adds the values of a vector to the position- Parameters:
vector
- ThePathVector
who's values will be added- Returns:
- A new
PathPosition
-
subtract
Subtracts x,y,z values from the current values- Parameters:
x
- The value to subtract from the xy
- The value to subtract from the yz
- The value to subtract from the z- Returns:
- A new
PathPosition
-
subtract
Subtracts the values of a vector from the position- Parameters:
vector
- ThePathVector
who's values will be subtracted- Returns:
- A new
PathPosition
-
toVector
Converts the positions x,y,z to aPathVector
- Returns:
- A
PathVector
of the x,y,z
-
floor
Rounds the x,y,z values to the floor of the values- Returns:
- A new
PathPosition
-
mid
Sets the coordinates to the middle of the block- Returns:
- A new
PathPosition
-
midPoint
-
clone
-
equals
-
hashCode
public int hashCode()
-