Class EllipseArea

java.lang.Object
tk.airshipcraft.commonlib.world.AbstractYLimitedArea
tk.airshipcraft.commonlib.world.EllipseArea
All Implemented Interfaces:
IArea

public class EllipseArea extends AbstractYLimitedArea
Represents an elliptical area in a world, defined by a center point, and the radii along the X and Z axes. The area is bounded vertically by specified Y levels.
Since:
2023-04-01
Version:
1.0.0
Author:
notzune
  • Constructor Summary

    Constructors
    Constructor
    Description
    EllipseArea(double lowerYBound, double upperYBound, org.bukkit.Location center, double xSize, double zSize)
    Constructs a new EllipseArea with specified Y boundaries, center, and radii.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.Location
    Gets the center of the elliptical area.
    Collection<org.bukkit.Chunk>
    Retrieves a collection of chunks that fall within or intersect the boundaries of the elliptical area.
    Retrieves a collection of pseudo chunk coordinates that fall within or intersect the boundaries of the elliptical area.
    org.bukkit.World
    Retrieves the world where this elliptical area exists.
    double
    Gets the radius of the ellipse along the X-axis.
    double
    Gets the radius of the ellipse along the Z-axis.
    boolean
    isInArea(org.bukkit.Location loc)
    Checks if a location is within the boundaries of the elliptical area.

    Methods inherited from class tk.airshipcraft.commonlib.world.AbstractYLimitedArea

    getLowerYBound, getUpperYBound

    Methods inherited from class java.lang.Object

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

    • EllipseArea

      public EllipseArea(double lowerYBound, double upperYBound, org.bukkit.Location center, double xSize, double zSize)
      Constructs a new EllipseArea with specified Y boundaries, center, and radii.
      Parameters:
      lowerYBound - The lower Y boundary of the area.
      upperYBound - The upper Y boundary of the area.
      center - The center location of the ellipse.
      xSize - The radius of the ellipse along the X-axis.
      zSize - The radius of the ellipse along the Z-axis.
  • Method Details

    • getChunks

      public Collection<org.bukkit.Chunk> getChunks()
      Retrieves a collection of chunks that fall within or intersect the boundaries of the elliptical area.
      Returns:
      A collection of Chunk instances representing the chunks within or intersecting the area.
    • getCenter

      public org.bukkit.Location getCenter()
      Gets the center of the elliptical area.
      Returns:
      The center Location of the ellipse.
    • getWorld

      public org.bukkit.World getWorld()
      Retrieves the world where this elliptical area exists.
      Returns:
      The World instance associated with this area.
    • isInArea

      public boolean isInArea(org.bukkit.Location loc)
      Checks if a location is within the boundaries of the elliptical area.
      Specified by:
      isInArea in interface IArea
      Overrides:
      isInArea in class AbstractYLimitedArea
      Parameters:
      loc - The location to check.
      Returns:
      True if the location falls within the ellipse, false otherwise.
    • getXSize

      public double getXSize()
      Gets the radius of the ellipse along the X-axis.
      Returns:
      The radius of the ellipse along the X-axis.
    • getZSize

      public double getZSize()
      Gets the radius of the ellipse along the Z-axis.
      Returns:
      The radius of the ellipse along the Z-axis.
    • getPseudoChunks

      public Collection<PseudoChunk> getPseudoChunks()
      Retrieves a collection of pseudo chunk coordinates that fall within or intersect the boundaries of the elliptical area. This method provides a lightweight alternative to getChunks() by avoiding actual chunk loading.
      Returns:
      A collection of PseudoChunk instances representing the chunk coordinates within or intersecting the area.