Interface Block
- All Superinterfaces:
- Metadatable
public interface Block extends Metadatable
Note that parts of this class which require access to the world at large (i.e. lighting and power) may not be able to be safely accessed during world generation when used in cases like BlockPhysicsEvent!!!!
- 
Method SummaryModifier and Type Method Description booleanapplyBoneMeal(BlockFace face)Simulate bone meal application to this block (if possible).booleanbreakNaturally()Breaks the block and spawns items as if a player had digged it regardless of the tool.booleanbreakNaturally(ItemStack tool)Breaks the block and spawns items as if a player had digged it with a specific toolBiomegetBiome()Returns the biome that this block resides inBlockDatagetBlockData()Gets the complete block data for this blockintgetBlockPower()Returns the redstone power being provided to this blockintgetBlockPower(BlockFace face)Returns the redstone power being provided to this block faceBoundingBoxgetBoundingBox()Gets the approximate bounding box for this block.ChunkgetChunk()Gets the chunk which contains this blockbytegetData()Deprecated.Magic valueCollection<ItemStack>getDrops()Returns a list of items which would drop by destroying this blockCollection<ItemStack>getDrops(ItemStack tool)Returns a list of items which would drop by destroying this block with a specific toolCollection<ItemStack>getDrops(ItemStack tool, Entity entity)Returns a list of items which would drop by the entity destroying this block with a specific toolBlockFacegetFace(Block block)Gets the face relation of this block compared to the given block.doublegetHumidity()Gets the humidity of the biome of this blockbytegetLightFromBlocks()Get the amount of light at this block from nearby blocks.bytegetLightFromSky()Get the amount of light at this block from the sky.bytegetLightLevel()Gets the light level between 0-15LocationgetLocation()Gets the Location of the blockLocationgetLocation(Location loc)Stores the location of the block in the provided Location object.PistonMoveReactiongetPistonMoveReaction()Returns the reaction of the block when moved by a pistonBlockgetRelative(int modX, int modY, int modZ)Gets the block at the given offsetsBlockgetRelative(BlockFace face)Gets the block at the given faceBlockgetRelative(BlockFace face, int distance)Gets the block at the given distance of the given faceBlockStategetState()Captures the current state of this block.doublegetTemperature()Gets the temperature of this block.MaterialgetType()Gets the type of this blockWorldgetWorld()Gets the world which contains this BlockintgetX()Gets the x-coordinate of this blockintgetY()Gets the y-coordinate of this blockintgetZ()Gets the z-coordinate of this blockbooleanisBlockFaceIndirectlyPowered(BlockFace face)Returns true if the block face is being indirectly powered by Redstone.booleanisBlockFacePowered(BlockFace face)Returns true if the block face is being powered by Redstone.booleanisBlockIndirectlyPowered()Returns true if the block is being indirectly powered by Redstone.booleanisBlockPowered()Returns true if the block is being powered by Redstone.booleanisEmpty()Checks if this block is empty.booleanisLiquid()Checks if this block is liquid.booleanisPassable()Checks if this block is passable.RayTraceResultrayTrace(Location start, Vector direction, double maxDistance, FluidCollisionMode fluidCollisionMode)Performs a ray trace that checks for collision with this specific block in its current state using its precise collision shape.voidsetBiome(Biome bio)Sets the biome that this block resides invoidsetBlockData(BlockData data)Sets the complete data for this blockvoidsetBlockData(BlockData data, boolean applyPhysics)Sets the complete data for this block
 Note that applyPhysics = false is not in general safe.voidsetType(Material type)Sets the type of this blockvoidsetType(Material type, boolean applyPhysics)Sets the type of this block
 Note that applyPhysics = false is not in general safe.Methods inherited from interface org.bukkit.metadata.MetadatablegetMetadata, hasMetadata, removeMetadata, setMetadata
- 
Method Details- 
getDataDeprecated.Magic valueGets the metadata for this block- Returns:
- block specific metadata
 
- 
getBlockDataGets the complete block data for this block- Returns:
- block specific data
 
- 
getRelativeGets the block at the given offsets- Parameters:
- modX- X-coordinate offset
- modY- Y-coordinate offset
- modZ- Z-coordinate offset
- Returns:
- Block at the given offsets
 
- 
getRelativeGets the block at the given faceThis method is equal to getRelative(face, 1) - Parameters:
- face- Face of this block to return
- Returns:
- Block at the given face
- See Also:
- getRelative(BlockFace, int)
 
- 
getRelativeGets the block at the given distance of the given faceFor 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:
- face- Face of this block to return
- distance- Distance to get the block at
- Returns:
- Block at the given face
 
- 
getTypeGets the type of this block- Returns:
- block type
 
- 
getLightLevelbyte getLightLevel()Gets the light level between 0-15- Returns:
- light level
 
- 
getLightFromSkybyte 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
 
- 
getLightFromBlocksbyte 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
 
- 
getWorldGets the world which contains this Block- Returns:
- World containing this block
 
- 
getXint getX()Gets the x-coordinate of this block- Returns:
- x-coordinate
 
- 
getYint getY()Gets the y-coordinate of this block- Returns:
- y-coordinate
 
- 
getZint getZ()Gets the z-coordinate of this block- Returns:
- z-coordinate
 
- 
getLocationGets the Location of the block- Returns:
- Location of block
 
- 
getLocationStores the location of the block in the provided Location object.If the provided Location is null this method does nothing and returns null. - Parameters:
- loc- the location to copy into
- Returns:
- The Location object provided or null
 
- 
getChunkGets the chunk which contains this block- Returns:
- Containing Chunk
 
- 
setBlockDataSets the complete data for this block- Parameters:
- data- new block specific data
 
- 
setBlockDataSets the complete data for this block
 Note that applyPhysics = false is not in general safe. It should only be used when you need to avoid triggering a physics update of neighboring blocks, for example when creating aBisectedblock. If you are using a custom populator, then this parameter may also be required to prevent triggering infinite chunk loads on border blocks. This method should NOT be used to "hack" physics by placing blocks in impossible locations. Such blocks are liable to be removed on various events such as world upgrades. Furthermore setting large amounts of such blocks in close proximity may overload the server physics engine if an update is triggered at a later point. If this occurs, the resulting behavior is undefined.- Parameters:
- data- new block specific data
- applyPhysics- false to cancel physics from the changed block
 
- 
setTypeSets the type of this block- Parameters:
- type- Material to change this block to
 
- 
setTypeSets the type of this block
 Note that applyPhysics = false is not in general safe. It should only be used when you need to avoid triggering a physics update of neighboring blocks, for example when creating aBisectedblock. If you are using a custom populator, then this parameter may also be required to prevent triggering infinite chunk loads on border blocks. This method should NOT be used to "hack" physics by placing blocks in impossible locations. Such blocks are liable to be removed on various events such as world upgrades. Furthermore setting large amounts of such blocks in close proximity may overload the server physics engine if an update is triggered at a later point. If this occurs, the resulting behavior is undefined.- Parameters:
- type- Material to change this block to
- applyPhysics- False to cancel physics on the changed block.
 
- 
getFaceGets 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:
- block- Block to compare against this block
- Returns:
- BlockFace of this block which has the requested block, or null
 
- 
getStateCaptures 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.
 
- 
getBiomeReturns the biome that this block resides in- Returns:
- Biome type containing this block
 
- 
setBiomeSets the biome that this block resides in- Parameters:
- bio- new Biome type for this block
 
- 
isBlockPoweredboolean isBlockPowered()Returns true if the block is being powered by Redstone.- Returns:
- True if the block is powered.
 
- 
isBlockIndirectlyPoweredboolean isBlockIndirectlyPowered()Returns true if the block is being indirectly powered by Redstone.- Returns:
- True if the block is indirectly powered.
 
- 
isBlockFacePoweredReturns true if the block face is being powered by Redstone.- Parameters:
- face- The block face
- Returns:
- True if the block face is powered.
 
- 
isBlockFaceIndirectlyPoweredReturns true if the block face is being indirectly powered by Redstone.- Parameters:
- face- The block face
- Returns:
- True if the block face is indirectly powered.
 
- 
getBlockPowerReturns the redstone power being provided to this block face- Parameters:
- face- the face of the block to query or BlockFace.SELF for the block itself
- Returns:
- The power level.
 
- 
getBlockPowerint getBlockPower()Returns the redstone power being provided to this block- Returns:
- The power level.
 
- 
isEmptyboolean isEmpty()Checks if this block is empty.A block is considered empty when getType()returnsMaterial.AIR.- Returns:
- true if this block is empty
 
- 
isLiquidboolean isLiquid()Checks if this block is liquid.A block is considered liquid when getType()returnsMaterial.WATERorMaterial.LAVA.- Returns:
- true if this block is liquid
 
- 
getTemperaturedouble getTemperature()Gets the temperature of this block.If the raw biome temperature without adjusting for height effects is required then please use World.getTemperature(int, int).- Returns:
- Temperature of this block
 
- 
getHumiditydouble getHumidity()Gets the humidity of the biome of this block- Returns:
- Humidity of this block
 
- 
getPistonMoveReactionReturns the reaction of the block when moved by a piston- Returns:
- reaction
 
- 
breakNaturallyboolean breakNaturally()Breaks the block and spawns items as if a player had digged it regardless of the tool.- Returns:
- true if the block was destroyed
 
- 
breakNaturallyBreaks the block and spawns items as if a player had digged it with a specific tool- Parameters:
- tool- The tool or item in hand used for digging
- Returns:
- true if the block was destroyed
 
- 
applyBoneMealSimulate bone meal application to this block (if possible).- Parameters:
- face- the face on which bonemeal should be applied
- Returns:
- true if the block was bonemealed, false otherwise
 
- 
getDropsReturns a list of items which would drop by destroying this block- Returns:
- a list of dropped items for this type of block
 
- 
getDropsReturns a list of items which would drop by destroying this block with a specific tool- Parameters:
- tool- The tool or item in hand used for digging
- Returns:
- a list of dropped items for this type of block
 
- 
getDropsReturns a list of items which would drop by the entity destroying this block with a specific tool- Parameters:
- tool- The tool or item in hand used for digging
- entity- the entity destroying the block
- Returns:
- a list of dropped items for this type of block
 
- 
isPassableboolean isPassable()Checks if this block is passable.A block is passable if it has no colliding parts that would prevent players from moving through it. Examples: Tall grass, flowers, signs, etc. are passable, but open doors, fence gates, trap doors, etc. are not because they still have parts that can be collided with. - Returns:
- trueif passable
 
- 
rayTrace@Nullable RayTraceResult rayTrace(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode)Performs a ray trace that checks for collision with this specific block in its current state using its precise collision shape.- Parameters:
- start- the start location
- direction- the ray direction
- maxDistance- the maximum distance
- fluidCollisionMode- the fluid collision mode
- Returns:
- the ray trace hit result, or nullif there is no hit
 
- 
getBoundingBoxGets the approximate bounding box for this block.This isn't exact as some blocks Stairscontain many bounding boxes to establish their complete form. Also, the box may not be exactly the same as the collision shape (such as cactus, which is 16/16 of a block with 15/16 collisional bounds). This method will return an empty bounding box if the geometric shape of the block is empty (such as air blocks).- Returns:
- the approximate bounding box of the block
 
 
-