Skip to content

API reference / @jsprismarine/prismarine / world/thunder

world/thunder ​

Interfaces ​

ThunderWorld ​

Defined in: packages/prismarine/src/world/thunder.ts:28

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

Properties ​

random ​

readonly random: RandomSource

Defined in: packages/prismarine/src/world/thunder.ts:29

Methods ​

isLightningRod() ​

isLightningRod(at): boolean

Defined in: packages/prismarine/src/world/thunder.ts:55

Whether a block is in the minecraft:lightning_rods tag.

Parameters ​
at ​

ContentPosition

Returns ​

boolean

isRainingAt() ​

isRainingAt(at): boolean

Defined in: packages/prismarine/src/world/thunder.ts:49

Whether rain falls on a block, Level.isRainingAt.

Parameters ​
at ​

ContentPosition

Returns ​

boolean

lightningRodNear() ​

lightningRodNear(at): ContentPosition | undefined

Defined in: packages/prismarine/src/world/thunder.ts:45

The closest lightning rod within LIGHTNING_ROD_REACH blocks that is the highest block of its column, ServerLevel.findLightningRod.

Parameters ​
at ​

ContentPosition

Returns ​

ContentPosition | undefined

livingUnderSky() ​

livingUnderSky(min, max): readonly ContentPosition[]

Defined in: packages/prismarine/src/world/thunder.ts:47

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

Parameters ​
min ​

ContentPosition

max ​

ContentPosition

Returns ​

readonly ContentPosition[]

maxY() ​

maxY(): number

Defined in: packages/prismarine/src/world/thunder.ts:35

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

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

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

DifficultyInstance.getEffectiveDifficulty at a block.

Parameters ​
at ​

ContentPosition

Returns ​

number

spawnLightning() ​

spawnLightning(at, visualOnly): void

Defined in: packages/prismarine/src/world/thunder.ts:59

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

Parameters ​
at ​

ContentPosition

visualOnly ​

boolean

Returns ​

void

spawnSkeletonTrap() ​

spawnSkeletonTrap(at): void

Defined in: packages/prismarine/src/world/thunder.ts:57

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

Parameters ​
at ​

ContentPosition

Returns ​

void

spawnsMobs() ​

spawnsMobs(): boolean

Defined in: packages/prismarine/src/world/thunder.ts:53

Whether the spawnMobs game rule holds.

Returns ​

boolean

thundering() ​

thundering(): boolean

Defined in: packages/prismarine/src/world/thunder.ts:31

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

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

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

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

Parameters ​

world ​

ThunderWorld

chunkX ​

number

chunkZ ​

number

Returns ​

boolean

Whether a bolt struck.