Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.block.Block Interface Reference
Inheritance diagram for org.bukkit.block.Block:
org.bukkit.metadata.Metadatable

Public Member Functions

byte getData ()
 
Block getRelative (int modX, int modY, int modZ)
 
Block getRelative (BlockFace face)
 
Block getRelative (BlockFace face, int distance)
 
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)
 
void setData (byte data, boolean applyPhysics)
 
void setType (Material type)
 
boolean setTypeId (int type)
 
boolean setTypeId (int type, boolean applyPhysics)
 
boolean setTypeIdAndData (int type, byte data, boolean applyPhysics)
 
BlockFace getFace (Block block)
 
BlockState getState ()
 
Biome getBiome ()
 
void setBiome (Biome bio)
 
boolean isBlockPowered ()
 
boolean isBlockIndirectlyPowered ()
 
boolean isBlockFacePowered (BlockFace face)
 
boolean isBlockFaceIndirectlyPowered (BlockFace face)
 
int getBlockPower (BlockFace face)
 
int getBlockPower ()
 
boolean isEmpty ()
 
boolean isLiquid ()
 
double getTemperature ()
 
double getHumidity ()
 
PistonMoveReaction getPistonMoveReaction ()
 
boolean breakNaturally ()
 
boolean breakNaturally (ItemStack tool)
 
Collection< ItemStackgetDrops ()
 
Collection< ItemStackgetDrops (ItemStack tool)
 

Detailed Description

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.

Definition at line 18 of file Block.java.

Member Function Documentation

boolean org.bukkit.block.Block.breakNaturally ( )

Breaks the block and spawns items as if a player had digged it

Returns
true if the block was destroyed
boolean org.bukkit.block.Block.breakNaturally ( ItemStack  tool)

Breaks the block and spawns items as if a player had digged it with a specific tool

Parameters
toolThe tool or item in hand used for digging
Returns
true if the block was destroyed
Biome org.bukkit.block.Block.getBiome ( )

Returns the biome that this block resides in

Returns
Biome type containing this block
int org.bukkit.block.Block.getBlockPower ( BlockFace  face)

Returns the redstone power being provided to this block face

Parameters
facethe face of the block to query or BlockFace.SELF for the block itself
Returns
The power level.
int org.bukkit.block.Block.getBlockPower ( )

Returns the redstone power being provided to this block

Returns
The power level.
Chunk org.bukkit.block.Block.getChunk ( )

Gets the chunk which contains this block

Returns
Containing Chunk
byte org.bukkit.block.Block.getData ( )

Gets the metadata for this block

Returns
block specific metadata
Deprecated:
Magic value
Collection<ItemStack> org.bukkit.block.Block.getDrops ( )

Returns a list of items which would drop by destroying this block

Returns
a list of dropped items for this type of block
Collection<ItemStack> org.bukkit.block.Block.getDrops ( ItemStack  tool)

Returns a list of items which would drop by destroying this block with a specific tool

Parameters
toolThe tool or item in hand used for digging
Returns
a list of dropped items for this type of block
BlockFace org.bukkit.block.Block.getFace ( Block  block)

Gets the face relation of this block compared to the given block

For example:

Block current = world.getBlockAt(100, 100, 100);
Block target = world.getBlockAt(100, 101, 100);
current.getFace(target) == BlockFace.Up;


If the given block is not connected to this block, null may be returned

Parameters
blockBlock to compare against this block
Returns
BlockFace of this block which has the requested block, or null
double org.bukkit.block.Block.getHumidity ( )

Gets the humidity of the biome of this block

Returns
Humidity of this block
byte org.bukkit.block.Block.getLightFromBlocks ( )

Get the amount of light at this block from nearby blocks.

Any light given from other sources (such as the sun) will be ignored.

Returns
Block light level
byte org.bukkit.block.Block.getLightFromSky ( )

Get the amount of light at this block from the sky.

Any light given from other sources (such as blocks like torches) will be ignored.

Returns
Sky light level
byte org.bukkit.block.Block.getLightLevel ( )

Gets the light level between 0-15

Returns
light level
Location org.bukkit.block.Block.getLocation ( )

Gets the Location of the block

Returns
Location of block

Referenced by org.bukkit.event.block.BlockPistonRetractEvent.getRetractLocation().

Location org.bukkit.block.Block.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.

Returns
The Location object provided or null
PistonMoveReaction org.bukkit.block.Block.getPistonMoveReaction ( )

Returns the reaction of the block when moved by a piston

Returns
reaction
Block org.bukkit.block.Block.getRelative ( int  modX,
int  modY,
int  modZ 
)

Gets the block at the given offsets

Parameters
modXX-coordinate offset
modYY-coordinate offset
modZZ-coordinate offset
Returns
Block at the given offsets

Referenced by org.bukkit.util.BlockIterator.BlockIterator(), org.bukkit.event.block.BlockPistonExtendEvent.getBlocks(), org.bukkit.event.block.BlockPistonRetractEvent.getRetractLocation(), and org.bukkit.event.block.BlockFromToEvent.getToBlock().

Block org.bukkit.block.Block.getRelative ( BlockFace  face)

Gets the block at the given face

This method is equal to getRelative(face, 1)

Parameters
faceFace of this block to return
Returns
Block at the given face
See also
getRelative(BlockFace, int)
Block org.bukkit.block.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 block = world.getBlockAt(100, 100, 100);
Block shower = block.getRelative(BlockFace.UP, 2);
shower.setType(Material.WATER);
Parameters
faceFace of this block to return
distanceDistance to get the block at
Returns
Block at the given face
BlockState org.bukkit.block.Block.getState ( )

Captures the current state of this block. You may then cast that state into any accepted type, such as Furnace or Sign.

The returned object will never be updated, and you are not guaranteed that (for example) a sign is still a sign after you capture its state.

Returns
BlockState with the current state of this block.
double org.bukkit.block.Block.getTemperature ( )

Gets the temperature of the biome of this block

Returns
Temperature of this block
Material org.bukkit.block.Block.getType ( )

Gets the type of this block

Returns
block type

Referenced by org.bukkit.generator.ChunkGenerator.canSpawn(), and org.bukkit.event.block.BlockPistonEvent.isSticky().

int org.bukkit.block.Block.getTypeId ( )

Gets the type-id of this block

Returns
block type-id
Deprecated:
Magic value
World org.bukkit.block.Block.getWorld ( )

Gets the world which contains this Block

Returns
World containing this block
int org.bukkit.block.Block.getX ( )

Gets the x-coordinate of this block

Returns
x-coordinate
int org.bukkit.block.Block.getY ( )

Gets the y-coordinate of this block

Returns
y-coordinate
int org.bukkit.block.Block.getZ ( )

Gets the z-coordinate of this block

Returns
z-coordinate
boolean org.bukkit.block.Block.isBlockFaceIndirectlyPowered ( BlockFace  face)

Returns true if the block face is being indirectly powered by Redstone.

Parameters
faceThe block face
Returns
True if the block face is indirectly powered.
boolean org.bukkit.block.Block.isBlockFacePowered ( BlockFace  face)

Returns true if the block face is being powered by Redstone.

Parameters
faceThe block face
Returns
True if the block face is powered.
boolean org.bukkit.block.Block.isBlockIndirectlyPowered ( )

Returns true if the block is being indirectly powered by Redstone.

Returns
True if the block is indirectly powered.
boolean org.bukkit.block.Block.isBlockPowered ( )

Returns true if the block is being powered by Redstone.

Returns
True if the block is powered.
boolean org.bukkit.block.Block.isEmpty ( )

Checks if this block is empty.

A block is considered empty when getType() returns Material#AIR.

Returns
true if this block is empty
boolean org.bukkit.block.Block.isLiquid ( )

Checks if this block is liquid.

A block is considered liquid when getType() returns Material#WATER, Material#STATIONARY_WATER, Material#LAVA or Material#STATIONARY_LAVA.

Returns
true if this block is liquid
void org.bukkit.block.Block.setBiome ( Biome  bio)

Sets the biome that this block resides in

Parameters
bionew Biome type for this block
void org.bukkit.block.Block.setData ( byte  data)

Sets the metadata for this block

Parameters
dataNew block specific metadata
Deprecated:
Magic value
void org.bukkit.block.Block.setData ( byte  data,
boolean  applyPhysics 
)

Sets the metadata for this block

Parameters
dataNew block specific metadata
applyPhysicsFalse to cancel physics from the changed block.
Deprecated:
Magic value
void org.bukkit.block.Block.setType ( Material  type)

Sets the type of this block

Parameters
typeMaterial to change this block to
boolean org.bukkit.block.Block.setTypeId ( int  type)

Sets the type-id of this block

Parameters
typeType-Id to change this block to
Returns
whether the block was changed
Deprecated:
Magic value
boolean org.bukkit.block.Block.setTypeId ( int  type,
boolean  applyPhysics 
)

Sets the type-id of this block

Parameters
typeType-Id to change this block to
applyPhysicsFalse to cancel physics on the changed block.
Returns
whether the block was changed
Deprecated:
Magic value
boolean org.bukkit.block.Block.setTypeIdAndData ( int  type,
byte  data,
boolean  applyPhysics 
)

Sets the type-id of this block

Parameters
typeType-Id to change this block to
dataThe data value to change this block to
applyPhysicsFalse to cancel physics on the changed block
Returns
whether the block was changed
Deprecated:
Magic value

The documentation for this interface was generated from the following file: