breakBlock

open fun breakBlock(block: Block): Boolean(source)

Breaks the block and drops the same items on the ground as for a suitable tool without enchantments.


open fun breakBlock(block: Block, tool: ItemStack?): Boolean(source)

Breaks the block with the tool and drops the items on the ground.


abstract fun breakBlock(block: Block, tool: ItemStack? = null, dropsConsumer: DropsConsumer): Boolean(source)

Breaks the block via the provider owning it and passes the dropped items to the dropsConsumer. Only items are dropped, without experience and break effects.

Return

false if the block can't be broken or no provider recognizes it.

Parameters

tool

The tool the block is broken with, or null to drop the same items as for a suitable tool without enchantments. Pass an empty stack to break the block by hand.

dropsConsumer

Use DropsConsumer.drop to drop all items on the ground, or DropsConsumer.disappear to drop nothing.