Interface BlockBreakEvent
- All Superinterfaces:
Cancellable, Event, PlayerEvent
drops() holds what the block is about to drop and can be modified: what is left in
it once the event is over is dropped where the block stood. Cancelling the event keeps the block
in place, drops nothing and resyncs the position to the client.
Fired on the thread of the region owning the block.
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptionblock()Returns the state of the block being broken.drops()Returns the stacks about to be dropped, which listeners may add to, remove from or replace.position()Returns the position of the block.tool()Returns what the player breaks the block with,ItemStack.EMPTYfor a bare hand.world()Returns the world the block belongs to, that is the world of the player.Methods inherited from interface Cancellable
isCancelled, setCancelledMethods inherited from interface PlayerEvent
player
-
Method Details
-
world
World world()Returns the world the block belongs to, that is the world of the player.- Returns:
- the world the block belongs to, that is the world of the player
- Since:
- 0.1.0
-
position
BlockPosition position()Returns the position of the block.- Returns:
- the position of the block
- Since:
- 0.1.0
-
block
BlockData block()Returns the state of the block being broken.- Returns:
- the state of the block being broken
- Since:
- 0.1.0
-
tool
ItemStack tool()Returns what the player breaks the block with,ItemStack.EMPTYfor a bare hand.- Returns:
- what the player breaks the block with,
ItemStack.EMPTYfor a bare hand - Since:
- 0.1.0
-
drops
Returns the stacks about to be dropped, which listeners may add to, remove from or replace.They are rolled from the loot table of the block with
tool(), so the list starts empty in creative mode, with theblock_dropsgame rule off, or when the block needs a tool the player does not hold. What listeners leave in it is dropped whatever the game mode and the game rule.A block taking part in farming starts with an empty list: its harvest is worked out once the event is over by
FarmingWorld.harvest(BlockPosition, Player, ItemStack), which fires aHarvestEvent. What listeners add here drops along with it.- Returns:
- the stacks about to be dropped, which listeners may add to, remove from or replace
- Since:
- 0.1.0
-