Class PathPosition

java.lang.Object
de.metaphoriker.pathetic.api.wrapper.PathPosition
All Implemented Interfaces:
Cloneable

public class PathPosition extends Object implements Cloneable
  • Constructor Details

    • PathPosition

      public PathPosition()
  • Method Details

    • interpolate

      public PathPosition interpolate(PathPosition other, double progress)
      Interpolates between two positions based on the given progress.
      Parameters:
      other - The other position to interpolate with
      progress - The interpolation progress (0.0 to 1.0)
      Returns:
      The interpolated position
    • isInSameBlock

      public boolean isInSameBlock(PathPosition otherPosition)
      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

      public int manhattanDistance(PathPosition otherPosition)
      Gets the manhattan distance between the current and another position
      Parameters:
      otherPosition - the other PathPosition to get the distance to
      Returns:
      the distance
    • octileDistance

      public double octileDistance(PathPosition otherPosition)
      Gets the octile distance between the current and another position
      Parameters:
      otherPosition - the other PathPosition to get the distance to
      Returns:
      the distance
    • distanceSquared

      public double distanceSquared(PathPosition otherPosition)
      Gets the distance squared between the current and another position
      Returns:
      The distance squared
    • distance

      public double distance(PathPosition otherPosition)
      Gets the distance between the current and another position
      Returns:
      The distance
    • setX

      public PathPosition setX(double x)
      Sets the X coordinate of the PathPosition
      Parameters:
      x - The new X coordinate
      Returns:
      A new PathPosition
    • setY

      public PathPosition setY(double y)
      Sets the Y coordinate of the PathPosition
      Parameters:
      y - The new Y coordinate
      Returns:
      A new PathPosition
    • setZ

      public PathPosition setZ(double z)
      Sets the Z coordinate of the PathPosition
      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

      @NonNull public @NonNull PathPosition add(double x, double y, double z)
      Adds x,y,z values to the current values
      Parameters:
      x - The value to add to the x
      y - The value to add to the y
      z - The value to add to the z
      Returns:
      A new PathPosition
    • add

      @NonNull public @NonNull PathPosition add(PathVector vector)
      Adds the values of a vector to the position
      Parameters:
      vector - The PathVector who's values will be added
      Returns:
      A new PathPosition
    • subtract

      @NonNull public @NonNull PathPosition subtract(double x, double y, double z)
      Subtracts x,y,z values from the current values
      Parameters:
      x - The value to subtract from the x
      y - The value to subtract from the y
      z - The value to subtract from the z
      Returns:
      A new PathPosition
    • subtract

      @NonNull public @NonNull PathPosition subtract(PathVector vector)
      Subtracts the values of a vector from the position
      Parameters:
      vector - The PathVector who's values will be subtracted
      Returns:
      A new PathPosition
    • toVector

      @NonNull public @NonNull PathVector toVector()
      Converts the positions x,y,z to a PathVector
      Returns:
      A PathVector of the x,y,z
    • floor

      public PathPosition floor()
      Rounds the x,y,z values to the floor of the values
      Returns:
      A new PathPosition
    • mid

      public PathPosition mid()
      Sets the coordinates to the middle of the block
      Returns:
      A new PathPosition
    • midPoint

      public PathPosition midPoint(PathPosition end)
    • clone

      public PathPosition clone()
      Overrides:
      clone in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object