Package com.sk89q.worldedit.regions
Class CuboidRegion
java.lang.Object
com.sk89q.worldedit.regions.AbstractRegion
com.sk89q.worldedit.regions.CuboidRegion
- All Implemented Interfaces:
FlatRegion
,Region
,Cloneable
,Iterable<BlockVector3>
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. -
Method Summary
Modifier and TypeMethodDescriptionGet this region as an iterable flat region.clone()
Make a clone of the region.boolean
contains
(BlockVector3 position) Returns true based on whether the region contains the point.void
contract
(BlockVector3... changes) Contract the region.void
expand
(BlockVector3... changes) Expand the region.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
Gets the maximum Y value.Get the lower point of a region.int
Gets the minimum Y value.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.void
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
getCenter, getHeight, getLength, getVolume, getWidth, getWorld, getWorldMaxY, getWorldMinY, polygonize, setWorld
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
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
-
-
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
-
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
- Returns:
- the Y value
-
getMaximumY
public int getMaximumY()Description copied from interface:FlatRegion
Gets the maximum Y value.- Specified by:
getMaximumY
in interfaceFlatRegion
- 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. -
iterator
Description copied from class:AbstractRegion
Get the iterator.- Specified by:
iterator
in interfaceIterable<BlockVector3>
- Overrides:
iterator
in classAbstractRegion
- Returns:
- iterator of points inside the region
-
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
-
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
-
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
-