dev.polymodloader.api.event.block
This page is generated from the source's Javadoc by ./gradlew apiReference. Do not edit it; fix the source comment and generate it again.
| Type | Kind | Description |
|---|---|---|
BlockBreakListener | functional interface | Listener for BlockEvents.BREAK. |
BlockBrokenListener | functional interface | Listener for BlockEvents.BROKEN. |
BlockEvents | class | Block events, fired on the server thread. |
BlockPlaceListener | functional interface | Listener for BlockEvents.PLACE. |
BlockPlacedListener | functional interface | Listener 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.
| Parameter | Type | Description |
|---|---|---|
world | WorldView | the world the block is in |
pos | BlockPos | where it is |
block | ResourceId | the block about to be broken |
player | PlayerView | who 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.
| Parameter | Type | Description |
|---|---|---|
world | WorldView | the world the block was in |
pos | BlockPos | where it was |
block | ResourceId | the block that was broken |
player | PlayerView | who 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 field | Type | Description |
|---|---|---|
BREAK | EventKey<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. |
BROKEN | EventKey<BlockBrokenListener> | A player broke a block (survival or creative). |
PLACE | EventKey<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. |
PLACED | EventKey<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.
| Parameter | Type | Description |
|---|---|---|
world | WorldView | the world |
pos | BlockPos | where the block goes |
block | ResourceId | the block about to be placed |
player | PlayerView | who 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.
| Parameter | Type | Description |
|---|---|---|
world | WorldView | the world |
pos | BlockPos | where the block is |
block | ResourceId | the placed block |
player | PlayerView | who placed it |