Package com.sk89q.worldedit.regions
Class CuboidRegion
java.lang.Object
java.util.AbstractCollection<BlockVector3>
java.util.AbstractSet<BlockVector3>
com.sk89q.worldedit.regions.AbstractRegion
com.sk89q.worldedit.regions.CuboidRegion
- All Implemented Interfaces:
IBatchProcessor,FlatRegion,Region,Cloneable,Iterable<BlockVector3>,Collection<BlockVector3>,Set<BlockVector3>
- Direct Known Subclasses:
RegionWrapper
An axis-aligned cuboid. It can be defined using two corners of the cuboid.
-
Field Summary
Fields inherited from class com.sk89q.worldedit.regions.AbstractRegion
world -
Constructor Summary
ConstructorsConstructorDescriptionCuboidRegion(BlockVector3 pos1, BlockVector3 pos2) Construct a new instance of this cuboid using two corners of the cuboid.CuboidRegion(World world, BlockVector3 pos1, BlockVector3 pos2) Construct a new instance of this cuboid using two corners of the cuboid.CuboidRegion(World world, BlockVector3 pos1, BlockVector3 pos2, boolean clampY) Construct a new instance of this cuboid using two corners of the cuboid. -
Method Summary
Modifier and TypeMethodDescriptionGet this region as an iterable flat region.booleanchunkContainedBy(int chunkX, int chunkZ, int chunkMinY, int chunkMaxY) Check if an entire chunk is contained by this regionclone()Make a clone of the region.booleancontains(int x, int z) booleancontains(int x, int y, int z) booleancontains(BlockVector3 position) Returns true based on whether the region contains the point.static booleancontains(CuboidRegion region) voidcontract(BlockVector3... changes) Contract the region.voidexpand(BlockVector3... changes) Expand the region.voidfilter(IChunk chunk, Filter filter, ChunkFilterBlock block, IChunkGet get, IChunkSet set, boolean full) static CuboidRegionfromCenter(BlockVector3 origin, int apothem) Make a cuboid from the center.Get the bounding box of this region as aCuboidRegion.Return a list of 16*16*16 chunks in a region.Get a list of chunks.getFaces()Get a region that contains the faces of this cuboid.Get the upper point of a region.intintGets the maximum Y value.intGet the lower point of a region.intintGets the minimum Y value.intgetPos1()Get the first cuboid-defining corner.getPos2()Get the second cuboid-defining corner.getWalls()Get a region that contains the walls (all faces but the ones parallel to the X-Z plane) of this cuboid.iterator()Get the iterator.static CuboidRegionmakeCuboid(Region region) Make a cuboid region out of the given region using the minimum and maximum bounds of the provided region.processSet(IChunk chunk, IChunkGet get, IChunkSet set) Process a chunk that has been set.processSet(IChunk chunk, IChunkGet get, IChunkSet set, boolean asBlacklist) Process the chunk, with the option to process as if the region is a blacklisted region, and thus any contained blocks should be removed, rather than uncontained blocks being removed.protected voidSets the cached min and max x/y/z and clamps Y to world y min/maxprotected voidSets the cached min and max x/y/zvoidsetPos1(BlockVector3 pos1) Set the first cuboid-defining corner.voidsetPos2(BlockVector3 pos2) Set the second cuboid-defining corner.voidshift(BlockVector3 change) Shift the region.toString()Methods inherited from class com.sk89q.worldedit.regions.AbstractRegion
equals, getCenter, getHeight, getLength, getVolume, getWidth, getWorld, getWorldMaxY, getWorldMinY, hashCode, polygonize, setWorld, sizeMethods inherited from class java.util.AbstractSet
removeAllMethods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArrayMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface com.fastasyncworldedit.core.queue.IBatchProcessor
flush, join, joinPost, postProcess, postProcessSet, processGet, processGet, remove, trimNBT, trimNBT, trimYMethods inherited from interface com.sk89q.worldedit.regions.Region
construct, containsChunk, containsEntireCuboid, filter, filter, filter, filter, getArea, getCenter, getDimensions, getHeight, getLength, getScope, getVolume, getWidth, getWorld, isGlobal, polygonize, setWorld
-
Constructor Details
-
CuboidRegion
Construct a new instance of this cuboid using two corners of the cuboid.- Parameters:
pos1- the first positionpos2- the second position
-
CuboidRegion
Construct a new instance of this cuboid using two corners of the cuboid.- Parameters:
world- the worldpos1- the first positionpos2- the second position
-
CuboidRegion
Construct a new instance of this cuboid using two corners of the cuboid.- Parameters:
world- the worldpos1- the first positionpos2- the second positionclampY- if the min/max Y of the region should be clamped to the world- Since:
- 2.1.0
-
-
Method Details
-
getPos1
Get the first cuboid-defining corner.- Returns:
- a position
-
setPos1
Set the first cuboid-defining corner.- Parameters:
pos1- a position
-
getPos2
Get the second cuboid-defining corner.- Returns:
- a position
-
setPos2
Set the second cuboid-defining corner.- Parameters:
pos2- a position
-
recalculate
protected void recalculate()Sets the cached min and max x/y/z and clamps Y to world y min/max -
recalculateNoClamp
protected void recalculateNoClamp()Sets the cached min and max x/y/z -
getFaces
Get a region that contains the faces of this cuboid.- Returns:
- a new complex region
-
getWalls
Get a region that contains the walls (all faces but the ones parallel to the X-Z plane) of this cuboid.- Returns:
- a new complex region
-
getMinimumPoint
Description copied from interface:RegionGet the lower point of a region.- Specified by:
getMinimumPointin interfaceRegion- Returns:
- min. point
-
getMaximumPoint
Description copied from interface:RegionGet the upper point of a region.- Specified by:
getMaximumPointin interfaceRegion- Returns:
- max. point
-
getBoundingBox
Description copied from interface:RegionGet the bounding box of this region as aCuboidRegion.- Specified by:
getBoundingBoxin interfaceRegion- Returns:
- the bounding box
-
getMinimumY
public int getMinimumY()Description copied from interface:FlatRegionGets the minimum Y value.- Specified by:
getMinimumYin interfaceFlatRegion- Specified by:
getMinimumYin interfaceRegion- Returns:
- the Y value
-
getMaximumY
public int getMaximumY()Description copied from interface:FlatRegionGets the maximum Y value.- Specified by:
getMaximumYin interfaceFlatRegion- Specified by:
getMaximumYin interfaceRegion- Returns:
- the Y value
-
expand
Description copied from interface:RegionExpand the region. -
contract
Description copied from interface:RegionContract the region. -
shift
Description copied from interface:RegionShift the region.- Specified by:
shiftin interfaceRegion- Overrides:
shiftin classAbstractRegion- Parameters:
change- the change- Throws:
RegionOperationException- if the operation cannot be performed
-
getChunks
Description copied from class:AbstractRegionGet a list of chunks.- Specified by:
getChunksin interfaceRegion- Overrides:
getChunksin classAbstractRegion- Returns:
- a set of chunks
-
getChunkCubes
Description copied from interface:RegionReturn a list of 16*16*16 chunks in a region.- Specified by:
getChunkCubesin interfaceRegion- Overrides:
getChunkCubesin classAbstractRegion- Returns:
- the chunk cubes this region overlaps with
-
contains
Description copied from interface:RegionReturns true based on whether the region contains the point. -
contains
public boolean contains(int x, int y, int z) -
contains
public boolean contains(int x, int z) -
iterator
Description copied from class:AbstractRegionGet the iterator.- Specified by:
iteratorin interfaceCollection<BlockVector3>- Specified by:
iteratorin interfaceIterable<BlockVector3>- Specified by:
iteratorin interfaceSet<BlockVector3>- Overrides:
iteratorin classAbstractRegion- Returns:
- iterator of points inside the region
-
iterator_old
-
asFlatRegion
Description copied from interface:FlatRegionGet this region as an iterable flat region.- Specified by:
asFlatRegionin interfaceFlatRegion- Returns:
- a flat region iterable
-
toString
- Overrides:
toStringin classAbstractCollection<BlockVector3>
-
clone
Description copied from interface:RegionMake a clone of the region.- Specified by:
clonein interfaceRegion- Overrides:
clonein classAbstractRegion- Returns:
- a cloned version
-
makeCuboid
Make a cuboid region out of the given region using the minimum and maximum bounds of the provided region.- Parameters:
region- the region- Returns:
- a new cuboid region
-
contains
-
fromCenter
Make a cuboid from the center.- Parameters:
origin- the originapothem- the apothem, where 0 is the minimum value to make a 1x1 cuboid- Returns:
- a cuboid region
-
getMinimumX
public int getMinimumX() -
getMinimumZ
public int getMinimumZ() -
getMaximumX
public int getMaximumX() -
getMaximumZ
public int getMaximumZ() -
chunkContainedBy
public boolean chunkContainedBy(int chunkX, int chunkZ, int chunkMinY, int chunkMaxY) Check if an entire chunk is contained by this region- Parameters:
chunkX- chunk x coordchunkZ- chunk z coordchunkMinY- The minimum Y level of the chunkchunkMaxY- The maximum Y level of the chunk- Returns:
- If the entire chunk is contained by this region
- Since:
- 2.13.0
-
filter
public void filter(IChunk chunk, Filter filter, ChunkFilterBlock block, IChunkGet get, IChunkSet set, boolean full) -
processSet
Description copied from interface:IBatchProcessorProcess a chunk that has been set.- Specified by:
processSetin interfaceIBatchProcessor- Specified by:
processSetin interfaceRegion
-
processSet
Description copied from interface:RegionProcess the chunk, with the option to process as if the region is a blacklisted region, and thus any contained blocks should be removed, rather than uncontained blocks being removed.- Specified by:
processSetin interfaceRegion- Parameters:
asBlacklist- If any blocks contained by the region should be removed
-