Class LocationUtils

java.lang.Object
net.paulem.arcana.utils.LocationUtils

public class LocationUtils extends Object
Utility methods for working with locations.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.bukkit.Location[]
    getIntermediary(org.bukkit.Location base, org.bukkit.Location end, double stepsInterval)
    Computes a series of locations between base and end, evenly spaced along the Y axis by stepsInterval blocks.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LocationUtils

      public LocationUtils()
  • Method Details

    • getIntermediary

      public static org.bukkit.Location[] getIntermediary(org.bukkit.Location base, org.bukkit.Location end, double stepsInterval)
      Computes a series of locations between base and end, evenly spaced along the Y axis by stepsInterval blocks. The X and Z coordinates of base are kept for every intermediary location. Works whether end is above or below base: the step direction is chosen based on the sign of the Y difference, and the number of steps is derived from the absolute Y distance divided by stepsInterval, rounded up. The returned array always starts at base's Y and ends at or past end's Y.
      Parameters:
      base - the starting location
      end - the ending location
      stepsInterval - the vertical distance, in blocks, between each intermediary location
      Returns:
      an array of locations from base to end, spaced by stepsInterval on the Y axis