public class Cuboid
extends java.lang.Object
implements java.lang.Iterable<org.bukkit.block.Block>, java.lang.Cloneable, org.bukkit.configuration.serialization.ConfigurationSerializable
| Modifier and Type | Class and Description |
|---|---|
static class |
Cuboid.CuboidDirection |
class |
Cuboid.CuboidIterator |
| Constructor and Description |
|---|
Cuboid(Cuboid other)
Copy constructor.
|
Cuboid(org.bukkit.Location l1)
Construct a one-block Cuboid at the given Location of the Cuboid.
|
Cuboid(org.bukkit.Location l1,
org.bukkit.Location l2)
Construct a Cuboid given two Location objects which represent any two
corners of the Cuboid.
|
Cuboid(java.util.Map<java.lang.String,java.lang.Object> map)
Construct a Cuboid using a map with the following keys: worldName, x1,
x2, y1, y2, z1, z2
|
Cuboid(org.bukkit.World world,
int x1,
int y1,
int z1,
int x2,
int y2,
int z2)
Construct a Cuboid in the given World and xyz co-ordinates
|
| Modifier and Type | Method and Description |
|---|---|
Cuboid |
clone() |
boolean |
contains(org.bukkit.block.Block b)
Check if the given Block is contained within this Cuboid.
|
boolean |
contains(int x,
int y,
int z)
Return true if the point at (x,y,z) is contained within this Cuboid.
|
boolean |
contains(org.bukkit.Location l)
Check if the given Location is contained within this Cuboid.
|
boolean |
containsOnly(int blockId)
Check if the Cuboid contains only blocks of the given type
|
Cuboid |
contract()
Contract the Cuboid, returning a Cuboid with any air around the edges
removed, just large enough to include all non-air blocks.
|
Cuboid |
contract(Cuboid.CuboidDirection dir)
Contract the Cuboid in the given direction, returning a new Cuboid which
has no exterior empty space.
|
org.bukkit.block.Block[] |
corners()
Get the Blocks at the eight corners of the Cuboid.
|
Cuboid |
expand(Cuboid.CuboidDirection dir,
int amount)
Expand the Cuboid in the given direction by the given amount.
|
byte |
getAverageLightLevel()
Get the average light level of all empty (air) blocks in the Cuboid.
|
java.util.List<org.bukkit.block.Block> |
getBlocks()
Get the blocks in the Cuboid.
|
java.util.List<org.bukkit.block.Block> |
getBlocks(org.bukkit.Material material)
Get the blocks in the Cuboid.
|
Cuboid |
getBoundingCuboid(Cuboid other)
Get the Cuboid big enough to hold both this Cuboid and the given one.
|
org.bukkit.Location |
getCenter()
Get the the centre of the Cuboid.
|
java.util.List<org.bukkit.Chunk> |
getChunks()
Get a list of the chunks which are fully or partially contained in this
cuboid.
|
Cuboid |
getFace(Cuboid.CuboidDirection dir)
Get the Cuboid representing the face of this Cuboid.
|
org.bukkit.Location |
getLowerNE()
Get the Location of the lower northeast corner of the Cuboid (minimum XYZ
co-ordinates).
|
int |
getLowerX()
Get the minimum X co-ordinate of this Cuboid
|
int |
getLowerY()
Get the minimum Y co-ordinate of this Cuboid
|
int |
getLowerZ()
Get the minimum Z co-ordinate of this Cuboid
|
org.bukkit.block.Block |
getRelativeBlock(int x,
int y,
int z)
Get a block relative to the lower NE point of the Cuboid.
|
org.bukkit.block.Block |
getRelativeBlock(org.bukkit.World w,
int x,
int y,
int z)
Get a block relative to the lower NE point of the Cuboid in the given
World.
|
int |
getSizeX()
Get the size of this Cuboid along the X axis
|
int |
getSizeY()
Get the size of this Cuboid along the Y axis
|
int |
getSizeZ()
Get the size of this Cuboid along the Z axis
|
org.bukkit.Location |
getUpperSW()
Get the Location of the upper southwest corner of the Cuboid (maximum XYZ
co-ordinates).
|
int |
getUpperX()
Get the maximum X co-ordinate of this Cuboid
|
int |
getUpperY()
Get the maximum Y co-ordinate of this Cuboid
|
int |
getUpperZ()
Get the maximum Z co-ordinate of this Cuboid
|
int |
getVolume()
Get the volume of this Cuboid.
|
org.bukkit.World |
getWorld()
Get the Cuboid's world.
|
Cuboid |
inset(Cuboid.CuboidDirection dir,
int amount)
Inset (shrink) the Cuboid in the given direction by the given amount.
|
java.util.Iterator<org.bukkit.block.Block> |
iterator() |
Cuboid |
outset(Cuboid.CuboidDirection dir,
int amount)
Outset (grow) the Cuboid in the given direction by the given amount.
|
java.util.Map<java.lang.String,java.lang.Object> |
serialize() |
Cuboid |
shift(Cuboid.CuboidDirection dir,
int amount)
Shift the Cuboid in the given direction by the given amount.
|
java.lang.String |
toString() |
public Cuboid(org.bukkit.Location l1,
org.bukkit.Location l2)
l1 - - One of the cornersl2 - - The other cornerpublic Cuboid(org.bukkit.Location l1)
l1 - location of the Cuboidpublic Cuboid(Cuboid other)
other - - The Cuboid to copypublic Cuboid(org.bukkit.World world,
int x1,
int y1,
int z1,
int x2,
int y2,
int z2)
world - - The Cuboid's worldx1 - - X co-ordinate of corner 1y1 - - Y co-ordinate of corner 1z1 - - Z co-ordinate of corner 1x2 - - X co-ordinate of corner 2y2 - - Y co-ordinate of corner 2z2 - - Z co-ordinate of corner 2public Cuboid(java.util.Map<java.lang.String,java.lang.Object> map)
map - - The map of keys.public java.util.Map<java.lang.String,java.lang.Object> serialize()
serialize in interface org.bukkit.configuration.serialization.ConfigurationSerializablepublic org.bukkit.Location getLowerNE()
public org.bukkit.Location getUpperSW()
public java.util.List<org.bukkit.block.Block> getBlocks(org.bukkit.Material material)
public java.util.List<org.bukkit.block.Block> getBlocks()
public org.bukkit.Location getCenter()
public org.bukkit.World getWorld()
java.lang.IllegalStateException - if the world is not loadedpublic int getSizeX()
public int getSizeY()
public int getSizeZ()
public int getLowerX()
public int getLowerY()
public int getLowerZ()
public int getUpperX()
public int getUpperY()
public int getUpperZ()
public org.bukkit.block.Block[] corners()
public Cuboid expand(Cuboid.CuboidDirection dir, int amount)
dir - - The direction in which to expandamount - - The number of blocks by which to expandpublic Cuboid shift(Cuboid.CuboidDirection dir, int amount)
dir - - The direction in which to shiftamount - - The number of blocks by which to shiftpublic Cuboid outset(Cuboid.CuboidDirection dir, int amount)
dir - - The direction in which to outset (must be Horizontal,
Vertical, or Both)amount - - The number of blocks by which to outsetpublic Cuboid inset(Cuboid.CuboidDirection dir, int amount)
dir - - The direction in which to inset (must be Horizontal,
Vertical, or Both)amount - - The number of blocks by which to insetpublic boolean contains(int x,
int y,
int z)
x - - The X co-ordinatey - - The Y co-ordinatez - - The Z co-ordinatepublic boolean contains(org.bukkit.block.Block b)
b - - The Block to check forpublic boolean contains(org.bukkit.Location l)
l - - The Location to check forpublic int getVolume()
public byte getAverageLightLevel()
public Cuboid contract()
public Cuboid contract(Cuboid.CuboidDirection dir)
dir - - The direction in which to contractpublic Cuboid getFace(Cuboid.CuboidDirection dir)
dir - - which face of the Cuboid to getpublic boolean containsOnly(int blockId)
blockId - - The block ID to check forpublic Cuboid getBoundingCuboid(Cuboid other)
other - - The other cuboid.public org.bukkit.block.Block getRelativeBlock(int x,
int y,
int z)
x - - The X co-ordinatey - - The Y co-ordinatez - - The Z co-ordinatepublic org.bukkit.block.Block getRelativeBlock(org.bukkit.World w,
int x,
int y,
int z)
w - - The worldx - - The X co-ordinatey - - The Y co-ordinatez - - The Z co-ordinatepublic java.util.List<org.bukkit.Chunk> getChunks()
public java.util.Iterator<org.bukkit.block.Block> iterator()
iterator in interface java.lang.Iterable<org.bukkit.block.Block>public Cuboid clone()
clone in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object