Class Position

java.lang.Object
me.gamercoder215.mobchip.util.Position
All Implemented Interfaces:
Cloneable

public final class Position extends Object implements Cloneable
Represents a Location without a World
  • Constructor Details

    • Position

      public Position(@NotNull @NotNull Entity en)
      Constructs a Position at this Entity.
      Parameters:
      en - Entity to use
    • Position

      public Position(@NotNull @NotNull Location loc)
      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 coord
      y - Y Coord
      z - Z coord
    • Position

      public Position(int x, int y, int z)
      Constructs a Position at these coordinates.
      Parameters:
      x - X coord
      y - Y Coord
      z - Z coord
  • Method Details

    • distance

      public double distance(@NotNull @NotNull Position node)
      Gets the distance of this Position to another Position.
      Parameters:
      node - Position to use
      Returns:
      distance
    • distance

      public double distance(@NotNull @NotNull Location loc)
      Gets the distance of this Position to another Location.
      Parameters:
      loc - Location to use
      Returns:
      distance
    • distance

      public double distance(@NotNull @NotNull Entity en)
      Gets the distance of this Position to another Entity.
      Parameters:
      en - Entity to use
      Returns:
      distance
    • distanceSquared

      public double distanceSquared(@NotNull @NotNull Position node)
      Gets the distance, squared, of this Position to another Position.
      Parameters:
      node - Position to use
      Returns:
      distance squared
    • distanceSquared

      public double distanceSquared(@NotNull @NotNull Location loc)
      Gets the distance, squared, of this Position to another Location.
      Parameters:
      loc - Location to use
      Returns:
      distance squared
    • distanceSquared

      public double distanceSquared(@NotNull @NotNull Entity en)
      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 coord
      y - Y Coord
      z - Z coord
      Returns:
      distance squared
    • distanceManhattan

      public double distanceManhattan(@NotNull @NotNull Position node)
      Fetches the Manhattan distance to another Position.
      Parameters:
      node - Position to use
      Returns:
      Manhattan distance
    • distanceManhattan

      public double distanceManhattan(@NotNull @NotNull Location loc)
      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

      @NotNull public @NotNull Position add(int x, int y, int z)
      Adds an amount to each coordinate.
      Parameters:
      x - Amount of X to add
      y - Amount of Y to add
      z - Amount of Z to add
      Returns:
      this class, for chaining
    • remove

      @NotNull public @NotNull Position remove(int x, int y, int z)
      Removes an amount to each coordinate.
      Parameters:
      x - Amount of X to remove
      y - Amount of Y to remove
      z - 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

      @NotNull public @NotNull Vector toVector()
      Converts this Position to a Bukkit Vector.
      Returns:
      Bukkit Vector created
    • setX

      @NotNull public @NotNull Position setX(int x)
      Sets the Position's X value.
      Parameters:
      x - X value to set
      Returns:
      this class, for chaining
    • setY

      @NotNull public @NotNull Position setY(int y)
      Sets the Position's Y value.
      Parameters:
      y - Y value to set
      Returns:
      this class, for chaining
    • setZ

      @NotNull public @NotNull Position setZ(int z)
      Sets the Position's Z value.
      Parameters:
      z - Z value to set
      Returns:
      this class, for chaining
    • clone

      public Position clone()
      Overrides:
      clone in class Object