Package tk.airshipcraft.commonlib.world
Class EllipseArea
java.lang.Object
tk.airshipcraft.commonlib.world.AbstractYLimitedArea
tk.airshipcraft.commonlib.world.EllipseArea
- All Implemented Interfaces:
IArea
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
ConstructorsConstructorDescriptionEllipseArea
(double lowerYBound, double upperYBound, org.bukkit.Location center, double xSize, double zSize) Constructs a newEllipseArea
with specified Y boundaries, center, and radii. -
Method Summary
Modifier and TypeMethodDescriptionorg.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
getWorld()
Retrieves the world where this elliptical area exists.double
getXSize()
Gets the radius of the ellipse along the X-axis.double
getZSize()
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
-
Constructor Details
-
EllipseArea
public EllipseArea(double lowerYBound, double upperYBound, org.bukkit.Location center, double xSize, double zSize) Constructs a newEllipseArea
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
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 interfaceIArea
- Overrides:
isInArea
in classAbstractYLimitedArea
- 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
Retrieves a collection of pseudo chunk coordinates that fall within or intersect the boundaries of the elliptical area. This method provides a lightweight alternative togetChunks()
by avoiding actual chunk loading.- Returns:
- A collection of
PseudoChunk
instances representing the chunk coordinates within or intersecting the area.
-