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 newEllipseAreawith specified Y boundaries, center, and radii. -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.LocationGets 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.WorldgetWorld()Retrieves the world where this elliptical area exists.doublegetXSize()Gets the radius of the ellipse along the X-axis.doublegetZSize()Gets the radius of the ellipse along the Z-axis.booleanisInArea(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 newEllipseAreawith 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
Chunkinstances representing the chunks within or intersecting the area.
-
getCenter
public org.bukkit.Location getCenter()Gets the center of the elliptical area.- Returns:
- The center
Locationof the ellipse.
-
getWorld
public org.bukkit.World getWorld()Retrieves the world where this elliptical area exists.- Returns:
- The
Worldinstance 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:
isInAreain interfaceIArea- Overrides:
isInAreain 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
PseudoChunkinstances representing the chunk coordinates within or intersecting the area.
-