# AttackBlock

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

**Cancellable:** No. Calling `event.cancel()` throws `UnsupportedOperationException`.

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 {#com.jsmacrosce.jsmacros.client.api.event.impl.player.EventAttackBlock_constructor-BlockDataHelper-int-}

```js
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 {#com.jsmacrosce.jsmacros.client.api.event.impl.player.EventAttackBlock_block}

```js
block: BlockDataHelper
```

The block at the target position, using the client's current block state and block entity.

### side {#com.jsmacrosce.jsmacros.client.api.event.impl.player.EventAttackBlock_side}

```js
side: int
```

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 {#com.jsmacrosce.jsmacros.client.api.event.impl.player.EventAttackBlock_toString-}

```js
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
