# HitResultHelper.Block

`com.jsmacrosce.jsmacros.client.api.helper.world.HitResultHelper.Block`

**Since:** 1.9.1

Represents a block hit or miss; use [isMissed()](#com.jsmacrosce.jsmacros.client.api.helper.world.HitResultHelper.Block_isMissed-) to distinguish them.  
 ```js
const interactions = Player.interactions();  
const target = interactions === null ? null : interactions.getTarget();  
if (target instanceof HitResults.Block && !target.isMissed()) {
  const pos = target.getBlockPos();  
  if (pos !== null) Chat.log(`hit ${pos}`);  
}
 ```

Available in scripts as `HitResults.Block`.

Nested type declared in [HitResultHelper](HitResultHelper.md).

## Constructors

### new HitResultHelper.Block {#com.jsmacrosce.jsmacros.client.api.helper.world.HitResultHelper.Block_constructor-BlockHitResult-}

```js
new HitResultHelper.Block(BlockHitResult base)
```

Wraps the supplied block hit result, including a result representing a miss.

**Parameters:**
- `base`: block hit result to wrap

## Methods

### asBlock {#com.jsmacrosce.jsmacros.client.api.helper.world.HitResultHelper.Block_asBlock-}

```js
asBlock(): HitResultHelper.Block
```

Returns this block-hit-or-miss helper.

**Returns:** this block-hit-or-miss helper

### getBlockPos {#com.jsmacrosce.jsmacros.client.api.helper.world.HitResultHelper.Block_getBlockPos-}

```js
getBlockPos(): BlockPosHelper
```

Returns the position carried by the block hit result. For a miss, this is the position
 supplied with that miss, not necessarily a block reached by the ray.

**Returns:** the block that was hit, or `null` if the hit carries no position.

**Since:** 1.9.1

### getSide {#com.jsmacrosce.jsmacros.client.api.helper.world.HitResultHelper.Block_getSide-}

```js
getSide(): DirectionHelper
```

Returns the hit direction, or `null` if the result has no direction. Miss results
 also carry a direction; this does not imply a block was hit.

**Returns:** the face the ray came in on, or `null` if the hit carries no direction.

**Since:** 1.9.1

### isInsideBlock {#com.jsmacrosce.jsmacros.client.api.helper.world.HitResultHelper.Block_isInsideBlock-}

```js
isInsideBlock(): boolean
```

Whether the underlying block hit is marked as inside; this is independent of whether the
 hit is a miss.

**Returns:** `true` if the hit is marked as inside.

**Since:** 1.9.1

### isMissed {#com.jsmacrosce.jsmacros.client.api.helper.world.HitResultHelper.Block_isMissed-}

```js
isMissed(): boolean
```

Returns whether this block hit result is marked as a miss.

**Returns:** `true` if this hit is a miss rather than a block that was reached.

**Since:** 1.9.1

### toString {#com.jsmacrosce.jsmacros.client.api.helper.world.HitResultHelper.Block_toString-}

```js
toString(): String
```

Returns a diagnostic containing the hit position, direction, block position, miss flag, and inside flag.

**Returns:** a diagnostic with those values rendered from the underlying result and helper accessors
