Interface Region

All Superinterfaces:
Cloneable, Iterable<BlockVector3>
All Known Subinterfaces:
FlatRegion
All Known Implementing Classes:
AbstractFlatRegion, AbstractRegion, ConvexPolyhedralRegion, CuboidRegion, CylinderRegion, EllipsoidRegion, NullRegion, Polygonal2DRegion, RegionIntersection, RequestSelection, TransformRegion

public interface Region extends Iterable<BlockVector3>, Cloneable
Represents a physical shape.
  • Method Details

    • getMinimumPoint

      BlockVector3 getMinimumPoint()
      Get the lower point of a region.
      Returns:
      min. point
    • getMaximumPoint

      BlockVector3 getMaximumPoint()
      Get the upper point of a region.
      Returns:
      max. point
    • getBoundingBox

      default CuboidRegion getBoundingBox()
      Get the bounding box of this region as a CuboidRegion.
      Returns:
      the bounding box
    • getCenter

      Vector3 getCenter()
      Get the center point of a region. Note: Coordinates will not be integers if the corresponding lengths are even.
      Returns:
      center point
    • getArea

      @Deprecated default int getArea()
      Deprecated.
      use getVolume() to prevent overflows
      Get the number of blocks in the region.
      Returns:
      number of blocks
    • getVolume

      @NonAbstractForCompatibility(delegateName="getArea", delegateParams={}) default long getVolume()
      Get the number of blocks in the region.
      Returns:
      number of blocks
      API Note:
      This must be overridden by new subclasses. See NonAbstractForCompatibility for details
    • getWidth

      int getWidth()
      Get X-size.
      Returns:
      width
    • getHeight

      int getHeight()
      Get Y-size.
      Returns:
      height
    • getLength

      int getLength()
      Get Z-size.
      Returns:
      length
    • expand

      void expand(BlockVector3... changes) throws RegionOperationException
      Expand the region.
      Parameters:
      changes - array/arguments with multiple related changes
      Throws:
      RegionOperationException - if the operation cannot be performed
    • contract

      void contract(BlockVector3... changes) throws RegionOperationException
      Contract the region.
      Parameters:
      changes - array/arguments with multiple related changes
      Throws:
      RegionOperationException - if the operation cannot be performed
    • shift

      void shift(BlockVector3 change) throws RegionOperationException
      Shift the region.
      Parameters:
      change - the change
      Throws:
      RegionOperationException - if the operation cannot be performed
    • contains

      boolean contains(BlockVector3 position)
      Returns true based on whether the region contains the point.
      Parameters:
      position - the position
      Returns:
      true if contained
    • getChunks

      Set<BlockVector2> getChunks()
      Get a list of chunks.
      Returns:
      a list of chunk coordinates
    • getChunkCubes

      Set<BlockVector3> getChunkCubes()
      Return a list of 16*16*16 chunks in a region.
      Returns:
      the chunk cubes this region overlaps with
    • getWorld

      @Nullable World getWorld()
      Sets the world that the selection is in.
      Returns:
      the world, or null
    • setWorld

      void setWorld(@Nullable World world)
      Sets the world that the selection is in.
      Parameters:
      world - the world, which may be null
    • clone

      Region clone()
      Make a clone of the region.
      Returns:
      a cloned version
    • polygonize

      List<BlockVector2> polygonize(int maxPoints)
      Polygonizes a cross-section or a 2D projection of the region orthogonal to the Y axis.
      Parameters:
      maxPoints - maximum number of points to generate. -1 for no limit.
      Returns:
      the points.