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

# world/thunder

## Interfaces

### ThunderWorld

Defined in: [packages/prismarine/src/world/thunder.ts:28](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/thunder.ts#L28)

What a storm reads of the world, and the two things a strike does to it.

#### Properties

##### random

> `readonly` **random**: [`RandomSource`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/world/adapter/index.md#randomsource)

Defined in: [packages/prismarine/src/world/thunder.ts:29](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/thunder.ts#L29)

#### Methods

##### isLightningRod()

> **isLightningRod**(`at`): `boolean`

Defined in: [packages/prismarine/src/world/thunder.ts:55](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/thunder.ts#L55)

Whether a block is in the `minecraft:lightning_rods` tag.

###### Parameters

###### at

[`ContentPosition`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/world/adapter/index.md#contentposition)

###### Returns

`boolean`

##### isRainingAt()

> **isRainingAt**(`at`): `boolean`

Defined in: [packages/prismarine/src/world/thunder.ts:49](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/thunder.ts#L49)

Whether rain falls on a block, `Level.isRainingAt`.

###### Parameters

###### at

[`ContentPosition`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/world/adapter/index.md#contentposition)

###### Returns

`boolean`

##### lightningRodNear()

> **lightningRodNear**(`at`): [`ContentPosition`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/world/adapter/index.md#contentposition) \| `undefined`

Defined in: [packages/prismarine/src/world/thunder.ts:45](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/thunder.ts#L45)

The closest lightning rod within [LIGHTNING\_ROD\_REACH](#lightning-rod-reach) blocks that is the highest
block of its column, `ServerLevel.findLightningRod`.

###### Parameters

###### at

[`ContentPosition`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/world/adapter/index.md#contentposition)

###### Returns

[`ContentPosition`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/world/adapter/index.md#contentposition) \| `undefined`

##### livingUnderSky()

> **livingUnderSky**(`min`, `max`): readonly [`ContentPosition`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/world/adapter/index.md#contentposition)[]

Defined in: [packages/prismarine/src/world/thunder.ts:47](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/thunder.ts#L47)

The block positions of the living entities under open sky in a box, `canSeeSky` at each.

###### Parameters

###### min

[`ContentPosition`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/world/adapter/index.md#contentposition)

###### max

[`ContentPosition`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/world/adapter/index.md#contentposition)

###### Returns

readonly [`ContentPosition`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/world/adapter/index.md#contentposition)[]

##### maxY()

> **maxY**(): `number`

Defined in: [packages/prismarine/src/world/thunder.ts:35](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/thunder.ts#L35)

One past the highest block y of the dimension, `Level.getMaxY` plus one.

###### Returns

`number`

##### minY()

> **minY**(): `number`

Defined in: [packages/prismarine/src/world/thunder.ts:33](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/thunder.ts#L33)

The lowest block y of the dimension, `Level.getMinY`.

###### Returns

`number`

##### motionBlockingY()

> **motionBlockingY**(`x`, `z`): `number`

Defined in: [packages/prismarine/src/world/thunder.ts:40](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/thunder.ts#L40)

The `MOTION_BLOCKING` heightmap: one above the highest block in a column that blocks motion
or holds a fluid, and the dimension's floor less one in an empty column.

###### Parameters

###### x

`number`

###### z

`number`

###### Returns

`number`

##### regionalDifficulty()

> **regionalDifficulty**(`at`): `number`

Defined in: [packages/prismarine/src/world/thunder.ts:51](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/thunder.ts#L51)

`DifficultyInstance.getEffectiveDifficulty` at a block.

###### Parameters

###### at

[`ContentPosition`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/world/adapter/index.md#contentposition)

###### Returns

`number`

##### spawnLightning()

> **spawnLightning**(`at`, `visualOnly`): `void`

Defined in: [packages/prismarine/src/world/thunder.ts:59](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/thunder.ts#L59)

Spawns a lightning bolt on the middle of a block's floor, a flash and nothing more when `visualOnly`.

###### Parameters

###### at

[`ContentPosition`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/world/adapter/index.md#contentposition)

###### visualOnly

`boolean`

###### Returns

`void`

##### spawnSkeletonTrap()

> **spawnSkeletonTrap**(`at`): `void`

Defined in: [packages/prismarine/src/world/thunder.ts:57](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/thunder.ts#L57)

Spawns a skeleton horse trap standing at a block's corner, where Java's `setPos` puts it.

###### Parameters

###### at

[`ContentPosition`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/world/adapter/index.md#contentposition)

###### Returns

`void`

##### spawnsMobs()

> **spawnsMobs**(): `boolean`

Defined in: [packages/prismarine/src/world/thunder.ts:53](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/thunder.ts#L53)

Whether the `spawnMobs` game rule holds.

###### Returns

`boolean`

##### thundering()

> **thundering**(): `boolean`

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

Whether it rains and thunders, `Level.isRaining` and `Level.isThundering`.

###### Returns

`boolean`

## Variables

### LIGHTNING\_ROD\_REACH

> `const` **LIGHTNING\_ROD\_REACH**: `128` = `128`

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

How far a lightning rod draws a bolt, `ServerLevel.findLightningRod`'s 128.

***

### THUNDER\_ODDS

> `const` **THUNDER\_ODDS**: `100000` = `100_000`

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

The odds of a strike in one chunk on one stormy tick, `ServerLevel.tickThunder`'s 100000.

## Functions

### tickThunder()

> **tickThunder**(`world`, `chunkX`, `chunkZ`): `boolean`

Defined in: [packages/prismarine/src/world/thunder.ts:88](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/thunder.ts#L88)

Rolls one chunk's storm for one tick, and strikes when the roll comes up.

#### Parameters

##### world

[`ThunderWorld`](#thunderworld)

##### chunkX

`number`

##### chunkZ

`number`

#### Returns

`boolean`

Whether a bolt struck.
