Class AbstractRegion

java.lang.Object
com.sk89q.worldedit.regions.AbstractRegion
All Implemented Interfaces:
Region, Cloneable, Iterable<BlockVector3>
Direct Known Subclasses:
AbstractFlatRegion, ConvexPolyhedralRegion, CuboidRegion, CylinderRegion, EllipsoidRegion, Polygonal2DRegion, RegionIntersection, TransformRegion

public abstract class AbstractRegion extends Object implements Region
  • Field Details

    • world

      protected World world
  • Constructor Details

    • AbstractRegion

      public AbstractRegion(World world)
  • Method Details

    • getCenter

      public Vector3 getCenter()
      Description copied from interface: Region
      Get the center point of a region. Note: Coordinates will not be integers if the corresponding lengths are even.
      Specified by:
      getCenter in interface Region
      Returns:
      center point
    • iterator

      public Iterator<BlockVector3> iterator()
      Get the iterator.
      Specified by:
      iterator in interface Iterable<BlockVector3>
      Returns:
      iterator of points inside the region
    • getWorld

      public World getWorld()
      Description copied from interface: Region
      Sets the world that the selection is in.
      Specified by:
      getWorld in interface Region
      Returns:
      the world, or null
    • setWorld

      public void setWorld(World world)
      Description copied from interface: Region
      Sets the world that the selection is in.
      Specified by:
      setWorld in interface Region
      Parameters:
      world - the world, which may be null
    • shift

      public void shift(BlockVector3 change) throws RegionOperationException
      Description copied from interface: Region
      Shift the region.
      Specified by:
      shift in interface Region
      Parameters:
      change - the change
      Throws:
      RegionOperationException - if the operation cannot be performed
    • clone

      public AbstractRegion clone()
      Description copied from interface: Region
      Make a clone of the region.
      Specified by:
      clone in interface Region
      Overrides:
      clone in class Object
      Returns:
      a cloned version
    • polygonize

      public List<BlockVector2> polygonize(int maxPoints)
      Description copied from interface: Region
      Polygonizes a cross-section or a 2D projection of the region orthogonal to the Y axis.
      Specified by:
      polygonize in interface Region
      Parameters:
      maxPoints - maximum number of points to generate. -1 for no limit.
      Returns:
      the points.
    • getVolume

      public long getVolume()
      Description copied from interface: Region
      Get the number of blocks in the region.
      Specified by:
      getVolume in interface Region
      Returns:
      number of blocks
    • getWidth

      public int getWidth()
      Get X-size.
      Specified by:
      getWidth in interface Region
      Returns:
      width
    • getHeight

      public int getHeight()
      Get Y-size.
      Specified by:
      getHeight in interface Region
      Returns:
      height
    • getLength

      public int getLength()
      Get Z-size.
      Specified by:
      getLength in interface Region
      Returns:
      length
    • getChunks

      public Set<BlockVector2> getChunks()
      Get a list of chunks.
      Specified by:
      getChunks in interface Region
      Returns:
      a set of chunks
    • getChunkCubes

      public Set<BlockVector3> getChunkCubes()
      Description copied from interface: Region
      Return a list of 16*16*16 chunks in a region.
      Specified by:
      getChunkCubes in interface Region
      Returns:
      the chunk cubes this region overlaps with
    • getWorldMinY

      protected final int getWorldMinY()
    • getWorldMaxY

      protected final int getWorldMaxY()