Skip to content

AttackBlock ​

com.jsmacrosce.jsmacros.client.api.event.impl.player.EventAttackBlock

Not cancellable

Fires when the client's startDestroyBlock call returns true for a block target. This does not guarantee a new break request was sent or that the block was destroyed.

js
JsMacros.on("AttackBlock", JavaWrapper.methodToJava(function (event) {
 Chat.log(`Breaking ${event.block.getId()} at ${event.block.getX()}, ${event.block.getY()}, ${event.block.getZ()}`);  
}))

Constructors ​

new EventAttackBlock ​

new EventAttackBlock(BlockDataHelper block, int side)#
Initializes the event with the client's core and stores the supplied block helper and side value unchanged. This does not break, destroy, or update the world, or dispatch the event.

Parameters:

  • block: the supplied helper for the target block
  • side: the provided hit-face code

Fields ​

block ​

block: BlockDataHelperread-only#
The block at the target position, using the client's current block state and block entity.

side ​

side: intread-only#
The hit face as the direction's 3D data value: 0 down, 1 up, 2 north, 3 south, 4 west and 5 east.

Methods ​

toString ​

toString(): String#
Returns a diagnostic string containing the event name and stored block-helper representation. The format is %s:{"block": %s}; it omits side and is not JSON.
Returns: the event name and stored block-helper representation in the diagnostic format