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
ConstructorDescriptionCuboidRegion
(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.clone()
Make a clone of the region.boolean
contains
(int x, int z) boolean
contains
(int x, int y, int z) boolean
contains
(BlockVector3 position) Returns true based on whether the region contains the point.static boolean
contains
(CuboidRegion region) void
contract
(BlockVector3... changes) Contract the region.void
expand
(BlockVector3... changes) Expand the region.void
filter
(IChunk chunk, Filter filter, ChunkFilterBlock block, IChunkGet get, IChunkSet set, boolean full) static CuboidRegion
fromCenter
(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.int
int
Gets the maximum Y value.int
Get the lower point of a region.int
int
Gets the minimum Y value.int
getPos1()
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 CuboidRegion
makeCuboid
(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 void
Sets the cached min and max x/y/z and clamps Y to world y min/maxprotected void
Sets the cached min and max x/y/zvoid
setPos1
(BlockVector3 pos1) Set the first cuboid-defining corner.void
setPos2
(BlockVector3 pos2) Set the second cuboid-defining corner.void
shift
(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, size
Methods inherited from class java.util.AbstractSet
removeAll
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface com.fastasyncworldedit.core.queue.IBatchProcessor
flush, join, joinPost, postProcess, postProcessSet, processGet, remove, trimNBT, trimNBT, trimY
Methods 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:Region
Get the lower point of a region.- Specified by:
getMinimumPoint
in interfaceRegion
- Returns:
- min. point
-
getMaximumPoint
Description copied from interface:Region
Get the upper point of a region.- Specified by:
getMaximumPoint
in interfaceRegion
- Returns:
- max. point
-
getBoundingBox
Description copied from interface:Region
Get the bounding box of this region as aCuboidRegion
.- Specified by:
getBoundingBox
in interfaceRegion
- Returns:
- the bounding box
-
getMinimumY
public int getMinimumY()Description copied from interface:FlatRegion
Gets the minimum Y value.- Specified by:
getMinimumY
in interfaceFlatRegion
- Specified by:
getMinimumY
in interfaceRegion
- Returns:
- the Y value
-
getMaximumY
public int getMaximumY()Description copied from interface:FlatRegion
Gets the maximum Y value.- Specified by:
getMaximumY
in interfaceFlatRegion
- Specified by:
getMaximumY
in interfaceRegion
- Returns:
- the Y value
-
expand
Description copied from interface:Region
Expand the region. -
contract
Description copied from interface:Region
Contract the region. -
shift
Description copied from interface:Region
Shift the region.- Specified by:
shift
in interfaceRegion
- Overrides:
shift
in classAbstractRegion
- Parameters:
change
- the change- Throws:
RegionOperationException
- if the operation cannot be performed
-
getChunks
Description copied from class:AbstractRegion
Get a list of chunks.- Specified by:
getChunks
in interfaceRegion
- Overrides:
getChunks
in classAbstractRegion
- Returns:
- a set of chunks
-
getChunkCubes
Description copied from interface:Region
Return a list of 16*16*16 chunks in a region.- Specified by:
getChunkCubes
in interfaceRegion
- Overrides:
getChunkCubes
in classAbstractRegion
- Returns:
- the chunk cubes this region overlaps with
-
contains
Description copied from interface:Region
Returns 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:AbstractRegion
Get the iterator.- Specified by:
iterator
in interfaceCollection<BlockVector3>
- Specified by:
iterator
in interfaceIterable<BlockVector3>
- Specified by:
iterator
in interfaceSet<BlockVector3>
- Overrides:
iterator
in classAbstractRegion
- Returns:
- iterator of points inside the region
-
iterator_old
-
asFlatRegion
Description copied from interface:FlatRegion
Get this region as an iterable flat region.- Specified by:
asFlatRegion
in interfaceFlatRegion
- Returns:
- a flat region iterable
-
toString
- Overrides:
toString
in classAbstractCollection<BlockVector3>
-
clone
Description copied from interface:Region
Make a clone of the region.- Specified by:
clone
in interfaceRegion
- Overrides:
clone
in 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() -
filter
public void filter(IChunk chunk, Filter filter, ChunkFilterBlock block, IChunkGet get, IChunkSet set, boolean full) -
processSet
Description copied from interface:IBatchProcessor
Process a chunk that has been set.- Specified by:
processSet
in interfaceIBatchProcessor
- Specified by:
processSet
in interfaceRegion
-
processSet
Description copied from interface:Region
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.- Specified by:
processSet
in interfaceRegion
- Parameters:
asBlacklist
- If any blocks contained by the region should be removed
-