Skip to main content
Version: Minecraft 26.2

dev.polymodloader.api.event.block

Generated

This page is generated from the source's Javadoc by ./gradlew apiReference. Do not edit it; fix the source comment and generate it again.

TypeKindDescription
BlockBreakListenerfunctional interfaceListener for BlockEvents.BREAK.
BlockBrokenListenerfunctional interfaceListener for BlockEvents.BROKEN.
BlockEventsclassBlock events, fired on the server thread.
BlockPlaceListenerfunctional interfaceListener for BlockEvents.PLACE.
BlockPlacedListenerfunctional interfaceListener for BlockEvents.PLACED.

BlockBreakListener​

functional interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public interface BlockBreakListener

Listener for BlockEvents.BREAK.

onBlockBreak(WorldView, BlockPos, ResourceId, PlayerView)​

EventResult onBlockBreak(WorldView world, BlockPos pos, ResourceId block, PlayerView player)

Since 0.1.0-alpha.4 or earlier

Called on the server thread before the block is removed. The views are valid only during the call.

ParameterTypeDescription
worldWorldViewthe world the block is in
posBlockPoswhere it is
blockResourceIdthe block about to be broken
playerPlayerViewwho breaks it

Returns EventResult — DENY to keep the block (the player's client is told the block is still there); PASS or ALLOW to let the game break it

BlockBrokenListener​

functional interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public interface BlockBrokenListener

Listener for BlockEvents.BROKEN.

onBlockBroken(WorldView, BlockPos, ResourceId, PlayerView)​

void onBlockBroken(WorldView world, BlockPos pos, ResourceId block, PlayerView player)

Since 0.1.0-alpha.4 or earlier

Called on the server thread after the block was removed and its drops spawned.

ParameterTypeDescription
worldWorldViewthe world the block was in
posBlockPoswhere it was
blockResourceIdthe block that was broken
playerPlayerViewwho broke it

BlockEvents​

class · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public final class BlockEvents

Block events, fired on the server thread.

Constant or fieldTypeDescription
BREAKEventKey<BlockBreakListener>A player is about to break a block (survival or creative); a decision event (see EventResult): DENY keeps the block. Fired before the game's own checks for the held item, game master blocks, and adventure mode, so it also fires for breaks the game then refuses. Fabric API: PlayerBlockBreakEvents.BEFORE; NeoForge: BlockEvent.BreakEvent.
BROKENEventKey<BlockBrokenListener>A player broke a block (survival or creative).
PLACEEventKey<BlockPlaceListener>A player is about to place a block from a block item (including beds and doors); a decision event: DENY refuses it. NeoForge: BlockEvent.EntityPlaceEvent for players.
PLACEDEventKey<BlockPlacedListener>A player placed a block from a block item.

BlockPlaceListener​

functional interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public interface BlockPlaceListener

Listener for BlockEvents.PLACE.

onBlockPlace(WorldView, BlockPos, ResourceId, PlayerView)​

EventResult onBlockPlace(WorldView world, BlockPos pos, ResourceId block, PlayerView player)

Since 0.1.0-alpha.4 or earlier

Called on the server thread after the game checked that the block fits, before it is set. The views are valid only during the call.

ParameterTypeDescription
worldWorldViewthe world
posBlockPoswhere the block goes
blockResourceIdthe block about to be placed
playerPlayerViewwho places it

Returns EventResult — DENY to refuse the placement (the item is not used up and the player's client is resynchronised); PASS or ALLOW to let it happen

BlockPlacedListener​

functional interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public interface BlockPlacedListener

Listener for BlockEvents.PLACED.

onBlockPlaced(WorldView, BlockPos, ResourceId, PlayerView)​

void onBlockPlaced(WorldView world, BlockPos pos, ResourceId block, PlayerView player)

Since 0.1.0-alpha.4 or earlier

Called on the server thread after the block was placed, its block entity data applied, and the item used up. The views are valid only during the call.

ParameterTypeDescription
worldWorldViewthe world
posBlockPoswhere the block is
blockResourceIdthe placed block
playerPlayerViewwho placed it
Buy me a coffee