Package tk.airshipcraft.commonlib.world
Provides classes for defining and working with various geometric areas within the Minecraft world. These areas can be used for a variety of purposes such as event handling, entity management, custom mechanics, and more.
The key abstractions provided by this package include:
IArea
: An interface for general area definitions in a world.AbstractYLimitedArea
: An abstract class that implements IArea and adds vertical (Y-level) boundaries to an area.EllipseArea
: Defines an elliptical area based on a center point and radii along the X and Z axes.GlobalYLimitedArea
: Represents a globally spanning area limited only by Y levels, ignoring X and Z constraints.PseudoChunk
: Represents a chunk by its coordinates without holding its actual data, useful for lightweight chunk referencing.RectangleArea
: Defines a rectangular area based on a center point and dimensions along the X and Z axes.
Each area type is designed to efficiently manage the inclusion checks and retrieval of chunks or pseudo chunks. They can be extended or used as-is to fit the requirements of the plugin or server mechanics.
Usage examples:
// Define an elliptical area
Location center = ...; // Some location in the world
EllipseArea ellipseArea = new EllipseArea(50, 70, center, 10, 15);
// Check if a location is inside the ellipse
boolean isInEllipse = ellipseArea.isInArea(someLocation);
// Get all chunks within the ellipse
Collection<Chunk> chunks = ellipseArea.getChunks();
It is crucial to consider performance when working with large areas, as operations such as getChunks()
may carry significant overhead. It is recommended to use getPseudoChunks()
where appropriate and to
carefully manage chunk loading and unloading.
Implementations should handle any edge cases such as areas crossing world borders or chunk boundaries, and ensure thread-safety if areas are accessed from multiple threads.
- Since:
- 2023-11-20
- Version:
- 1.0.0
- Author:
- notzune
-
ClassDescriptionAn abstract implementation of a Y-limited area.Represents an elliptical area in a world, defined by a center point, and the radii along the X and Z axes.Represents a world-limited area with vertical bounds that extend infinitely along the X and Z axes.Defines the contract for area-related operations within the world.Represents a chunk-like structure that holds the coordinates for a chunk in a world without storing the actual chunk data.Represents a rectangular area in a Minecraft world with Y-level boundaries.