[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/prismarine](https://jsprismarine.dev/api/@jsprismarine/prismarine/index.md) / world/BlockMining

# world/BlockMining

## Interfaces

### BlockMining

Defined in: [packages/prismarine/src/world/BlockMining.ts:13](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/BlockMining.ts#L13)

A block a player is mining, and what its crack animation needs each tick.

Kept on the player between the action that starts the mining and the one that ends it,
because a server with server-authoritative block breaking animates the cracks itself,
every tick, rather than waiting for the client to report each swing.

#### Properties

##### breakTicks

> `readonly` **breakTicks**: `number`

Defined in: [packages/prismarine/src/world/BlockMining.ts:23](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/BlockMining.ts#L23)

How many ticks the break takes for the tool in hand; infinite for an unbreakable block.

##### face

> `readonly` **face**: `number`

Defined in: [packages/prismarine/src/world/BlockMining.ts:17](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/BlockMining.ts#L17)

The face being mined, 0 to 5 as the protocol numbers faces.

##### position

> `readonly` **position**: [`Vector3`](https://jsprismarine.dev/api/@jsprismarine/math/classes/Vector3.md)

Defined in: [packages/prismarine/src/world/BlockMining.ts:15](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/BlockMining.ts#L15)

The block, in block coordinates.

##### progressPerTick

> `readonly` **progressPerTick**: `number`

Defined in: [packages/prismarine/src/world/BlockMining.ts:21](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/BlockMining.ts#L21)

How much of the 65535 a full break takes one tick is worth.

##### runtimeId

> `readonly` **runtimeId**: `number`

Defined in: [packages/prismarine/src/world/BlockMining.ts:19](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/BlockMining.ts#L19)

The block's runtime id, which the client textures the particles with.

##### serverBreaks?

> `readonly` `optional` **serverBreaks?**: `true`

Defined in: [packages/prismarine/src/world/BlockMining.ts:36](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/BlockMining.ts#L36)

Set when the server breaks the block once its time is up, for a client that never reports
the break, such as a Java client mining a borrowed block state.

##### startedAt

> `readonly` **startedAt**: `number`

Defined in: [packages/prismarine/src/world/BlockMining.ts:25](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/BlockMining.ts#L25)

The server tick the player began mining this block on.

##### startedAtInput?

> `readonly` `optional` **startedAtInput?**: `number`

Defined in: [packages/prismarine/src/world/BlockMining.ts:31](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/BlockMining.ts#L31)

How many inputs the client had sent when it began mining this block, which counts the
client's own ticks: see `PlayerSession.handledInputs`. Absent for mining begun without a
client to count, such as mining saved before the field existed.

## Variables

### MINING\_LATENCY\_TICKS

> `const` **MINING\_LATENCY\_TICKS**: `5` = `5`

Defined in: [packages/prismarine/src/world/BlockMining.ts:110](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/BlockMining.ts#L110)

How many ticks early a predicted break may arrive. Network jitter can delay the start of
mining more than the prediction that ends it, which makes the break look shorter on the
server than it was on the client.

## Functions

### blockMiningOf()

The mining a player's component keeps, or its absence, as the world animates it.

#### Param

**mining**

The logged plain data, or null when nothing is mined.

#### Call Signature

> **blockMiningOf**(`mining`): [`BlockMining`](#blockmining)

Defined in: [packages/prismarine/src/world/BlockMining.ts:78](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/BlockMining.ts#L78)

The mining a player's component keeps, as the world animates it.

##### Parameters

###### mining

[`PlayerMining`](https://jsprismarine.dev/api/@jsprismarine/prismarine/entity/playerComponents/index.md#playermining)

The logged plain data.

##### Returns

[`BlockMining`](#blockmining)

The same block, with its position as a vector.

#### Call Signature

> **blockMiningOf**(`mining`): [`BlockMining`](#blockmining) \| `null`

Defined in: [packages/prismarine/src/world/BlockMining.ts:84](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/BlockMining.ts#L84)

The mining a player's component keeps, or its absence, as the world animates it.

##### Parameters

###### mining

[`PlayerMining`](https://jsprismarine.dev/api/@jsprismarine/prismarine/entity/playerComponents/index.md#playermining) \| `null`

The logged plain data, or null when nothing is mined.

##### Returns

[`BlockMining`](#blockmining) \| `null`

The same block, with its position as a vector, or null for null.

***

### hastenedBreakTicks()

> **hastenedBreakTicks**(`mining`, `effects`): `number`

Defined in: [packages/prismarine/src/world/BlockMining.ts:124](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/BlockMining.ts#L124)

How many ticks a break takes the player: the server's break time for the tool in hand, sped up
by the miner's strongest haste or conduit power level. Mining fatigue, water and being off the
ground only slow a break down, and are left out, so this is never longer than the real break.

#### Parameters

##### mining

`Pick`\<[`BlockMining`](#blockmining), `"breakTicks"`\>

What the player is mining.

##### effects

readonly `Pick`\<[`StatusEffect`](https://jsprismarine.dev/api/@jsprismarine/prismarine/entity/StatusEffect/index.md#statuseffect), `"id"` \| `"amplifier"`\>[]

The miner's status effects.

#### Returns

`number`

The ticks; infinite for a block that never breaks.

***

### minimumBreakTicks()

> **minimumBreakTicks**(`mining`, `effects`): `number`

Defined in: [packages/prismarine/src/world/BlockMining.ts:146](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/BlockMining.ts#L146)

The fewest ticks a break may have taken before the server accepts a client's prediction
that the block gave way: [hastenedBreakTicks](#hastenedbreakticks), with [MINING\_LATENCY\_TICKS](#mining-latency-ticks) off as
slack.

#### Parameters

##### mining

`Pick`\<[`BlockMining`](#blockmining), `"breakTicks"`\>

What the player is mining.

##### effects

readonly `Pick`\<[`StatusEffect`](https://jsprismarine.dev/api/@jsprismarine/prismarine/entity/StatusEffect/index.md#statuseffect), `"id"` \| `"amplifier"`\>[]

The miner's status effects.

#### Returns

`number`

The minimum ticks; infinite for a block that never breaks.

***

### playerMiningOf()

A player's mining, or its absence, as the logged plain data its component keeps.

#### Param

**mining**

What the player is mining, or null when nothing.

#### Call Signature

> **playerMiningOf**(`mining`): [`PlayerMining`](https://jsprismarine.dev/api/@jsprismarine/prismarine/entity/playerComponents/index.md#playermining)

Defined in: [packages/prismarine/src/world/BlockMining.ts:44](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/BlockMining.ts#L44)

A player's mining as the logged plain data its component keeps.

##### Parameters

###### mining

[`BlockMining`](#blockmining)

What the player is mining.

##### Returns

[`PlayerMining`](https://jsprismarine.dev/api/@jsprismarine/prismarine/entity/playerComponents/index.md#playermining)

The same block as plain data.

#### Call Signature

> **playerMiningOf**(`mining`): [`PlayerMining`](https://jsprismarine.dev/api/@jsprismarine/prismarine/entity/playerComponents/index.md#playermining) \| `null`

Defined in: [packages/prismarine/src/world/BlockMining.ts:50](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/BlockMining.ts#L50)

A player's mining, or its absence, as the logged plain data its component keeps.

##### Parameters

###### mining

[`BlockMining`](#blockmining) \| `null`

What the player is mining, or null when nothing.

##### Returns

[`PlayerMining`](https://jsprismarine.dev/api/@jsprismarine/prismarine/entity/playerComponents/index.md#playermining) \| `null`

The same block as plain data, or null for null.
