|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Block
Represents a block. This is a live object, and only one Block may exist for any given location in a world. The state of the block may change concurrently to your own handling of it; use block.getState() to get a snapshot state of a block which will not be modified.
Method Summary | |
---|---|
boolean |
breakNaturally()
Breaks the block and spawns items as if a player had digged it |
boolean |
breakNaturally(ItemStack tool)
Breaks the block and spawns items as if a player had digged it with a specific tool |
Biome |
getBiome()
Returns the biome that this block resides in |
int |
getBlockPower()
Returns the redstone power being provided to this block |
int |
getBlockPower(BlockFace face)
Returns the redstone power being provided to this block face |
Chunk |
getChunk()
Gets the chunk which contains this block |
byte |
getData()
Gets the metadata for this block |
Collection<ItemStack> |
getDrops()
Returns a list of items which would drop by destroying this block |
Collection<ItemStack> |
getDrops(ItemStack tool)
Returns a list of items which would drop by destroying this block with a specific tool |
BlockFace |
getFace(Block block)
Gets the face relation of this block compared to the given block For example: |
double |
getHumidity()
Gets the humidity of the biome of this block |
byte |
getLightFromBlocks()
Get the amount of light at this block from nearby blocks. |
byte |
getLightFromSky()
Get the amount of light at this block from the sky. |
byte |
getLightLevel()
Gets the light level between 0-15 |
Location |
getLocation()
Gets the Location of the block |
Location |
getLocation(Location loc)
Stores the location of the block in the provided Location object. If the provided Location is null this method does nothing and returns null. |
PistonMoveReaction |
getPistonMoveReaction()
Returns the reaction of the block when moved by a piston |
Block |
getRelative(BlockFace face)
Gets the block at the given face This method is equal to getRelative(face, 1) |
Block |
getRelative(BlockFace face,
int distance)
Gets the block at the given distance of the given face For example, the following method places water at 100,102,100; two blocks above 100,100,100. |
Block |
getRelative(int modX,
int modY,
int modZ)
Gets the block at the given offsets |
BlockState |
getState()
Captures the current state of this block. |
double |
getTemperature()
Gets the temperature of the biome of this block |
Material |
getType()
Gets the type of this block |
int |
getTypeId()
Gets the type-id of this block |
World |
getWorld()
Gets the world which contains this Block |
int |
getX()
Gets the x-coordinate of this block |
int |
getY()
Gets the y-coordinate of this block |
int |
getZ()
Gets the z-coordinate of this block |
boolean |
isBlockFaceIndirectlyPowered(BlockFace face)
Returns true if the block face is being indirectly powered by Redstone. |
boolean |
isBlockFacePowered(BlockFace face)
Returns true if the block face is being powered by Redstone. |
boolean |
isBlockIndirectlyPowered()
Returns true if the block is being indirectly powered by Redstone. |
boolean |
isBlockPowered()
Returns true if the block is being powered by Redstone. |
boolean |
isEmpty()
Checks if this block is empty. |
boolean |
isLiquid()
Checks if this block is liquid. |
void |
setBiome(Biome bio)
Sets the biome that this block resides in |
void |
setData(byte data)
Sets the metadata for this block |
void |
setData(byte data,
boolean applyPhysics)
Sets the metadata for this block |
void |
setType(Material type)
Sets the type of this block |
boolean |
setTypeId(int type)
Sets the type-id of this block |
boolean |
setTypeId(int type,
boolean applyPhysics)
Sets the type-id of this block |
boolean |
setTypeIdAndData(int type,
byte data,
boolean applyPhysics)
Sets the type-id of this block |
Methods inherited from interface org.bukkit.metadata.Metadatable |
---|
getMetadata, hasMetadata, removeMetadata, setMetadata |
Method Detail |
---|
byte getData()
Block getRelative(int modX, int modY, int modZ)
modX
- X-coordinate offsetmodY
- Y-coordinate offsetmodZ
- Z-coordinate offset
Block getRelative(BlockFace face)
face
- Face of this block to return
getRelative(BlockFace, int)
Block getRelative(BlockFace face, int distance)
Block block = world.getBlockAt(100, 100, 100); Block shower = block.getRelative(BlockFace.UP, 2); shower.setType(Material.WATER);
face
- Face of this block to returndistance
- Distance to get the block at
Material getType()
int getTypeId()
byte getLightLevel()
byte getLightFromSky()
byte getLightFromBlocks()
World getWorld()
int getX()
int getY()
int getZ()
Location getLocation()
Location getLocation(Location loc)
Chunk getChunk()
void setData(byte data)
data
- New block specific metadatavoid setData(byte data, boolean applyPhysics)
data
- New block specific metadataapplyPhysics
- False to cancel physics from the changed block.void setType(Material type)
type
- Material to change this block toboolean setTypeId(int type)
type
- Type-Id to change this block to
boolean setTypeId(int type, boolean applyPhysics)
type
- Type-Id to change this block toapplyPhysics
- False to cancel physics on the changed block.
boolean setTypeIdAndData(int type, byte data, boolean applyPhysics)
type
- Type-Id to change this block todata
- The data value to change this block toapplyPhysics
- False to cancel physics on the changed block
BlockFace getFace(Block block)
Block current = world.getBlockAt(100, 100, 100); Block target = world.getBlockAt(100, 101, 100); current.getFace(target) == BlockFace.Up;
block
- Block to compare against this block
BlockState getState()
Biome getBiome()
void setBiome(Biome bio)
bio
- new Biome type for this blockboolean isBlockPowered()
boolean isBlockIndirectlyPowered()
boolean isBlockFacePowered(BlockFace face)
face
- The block face
boolean isBlockFaceIndirectlyPowered(BlockFace face)
face
- The block face
int getBlockPower(BlockFace face)
face
- the face of the block to query or BlockFace.SELF for the block itself
int getBlockPower()
boolean isEmpty()
getType()
returns Material.AIR
.
boolean isLiquid()
getType()
returns Material.WATER
, Material.STATIONARY_WATER
, Material.LAVA
or Material.STATIONARY_LAVA
.
double getTemperature()
double getHumidity()
PistonMoveReaction getPistonMoveReaction()
boolean breakNaturally()
boolean breakNaturally(ItemStack tool)
tool
- The tool or item in hand used for digging
Collection<ItemStack> getDrops()
Collection<ItemStack> getDrops(ItemStack tool)
tool
- The tool or item in hand used for digging
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |