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

# world/precipitation

## Interfaces

### BiomeWeather

Defined in: [packages/prismarine/src/world/precipitation.ts:38](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L38)

The weather a biome has: its climate, and whether anything falls there at all.

#### Properties

##### climate

> `readonly` **climate**: [`BiomeClimate`](https://jsprismarine.dev/api/@jsprismarine/worldgen/index.md#biomeclimate)

Defined in: [packages/prismarine/src/world/precipitation.ts:39](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L39)

##### hasPrecipitation

> `readonly` **hasPrecipitation**: `boolean`

Defined in: [packages/prismarine/src/world/precipitation.ts:41](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L41)

The biome's `has_precipitation`: false for a desert, where neither rain nor snow falls.

***

### PrecipitationWorld

Defined in: [packages/prismarine/src/world/precipitation.ts:76](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L76)

The reads and writes the weather needs of one dimension.

#### Properties

##### maxY

> `readonly` **maxY**: `number`

Defined in: [packages/prismarine/src/world/precipitation.ts:85](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L85)

One past the highest block y of the dimension.

##### minY

> `readonly` **minY**: `number`

Defined in: [packages/prismarine/src/world/precipitation.ts:83](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L83)

The lowest block y of the dimension.

##### random

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

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

The level's random, which a cauldron's fill and each chunk's rolls draw from.

##### seaLevel

> `readonly` **seaLevel**: `number`

Defined in: [packages/prismarine/src/world/precipitation.ts:81](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L81)

#### Methods

##### blockAt()

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

Defined in: [packages/prismarine/src/world/precipitation.ts:94](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L94)

The block at a position, or undefined when its chunk is not loaded.

###### Parameters

###### at

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

###### Returns

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

##### blockLight()

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

Defined in: [packages/prismarine/src/world/precipitation.ts:97](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L97)

###### Parameters

###### at

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

###### Returns

`number`

##### liquidAt()

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

Defined in: [packages/prismarine/src/world/precipitation.ts:96](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L96)

The liquid a waterlogged block holds, or undefined for none.

###### Parameters

###### at

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

###### Returns

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

##### maxSnowAccumulation()

> **maxSnowAccumulation**(): `number`

Defined in: [packages/prismarine/src/world/precipitation.ts:101](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L101)

The `max_snow_accumulation_height` game rule.

###### Returns

`number`

##### motionBlockingY()

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

Defined in: [packages/prismarine/src/world/precipitation.ts:90](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L90)

The `MOTION_BLOCKING` heightmap: one above the highest block in a column that blocks motion
or holds a fluid. A snow layer blocks no motion, so the height is the ground it lies on.

###### Parameters

###### x

`number`

###### z

`number`

###### Returns

`number`

##### raining()

> **raining**(): `boolean`

Defined in: [packages/prismarine/src/world/precipitation.ts:80](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L80)

Whether it rains, or snows where it is cold, `Level.isRaining`.

###### Returns

`boolean`

##### setBlock()

> **setBlock**(`at`, `block`): `void`

Defined in: [packages/prismarine/src/world/precipitation.ts:103](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L103)

Replaces a block and tells its neighbors, `Level.setBlockAndUpdate`.

###### Parameters

###### at

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

###### block

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

###### Returns

`void`

##### snowSurvives()

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

Defined in: [packages/prismarine/src/world/precipitation.ts:99](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L99)

Whether a snow layer could stand at a position, `SnowLayerBlock.canSurvive`.

###### Parameters

###### at

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

###### Returns

`boolean`

##### weatherAt()

> **weatherAt**(`at`): [`BiomeWeather`](#biomeweather) \| `undefined`

Defined in: [packages/prismarine/src/world/precipitation.ts:92](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L92)

The weather of the biome at a block, or undefined where the biome is not known.

###### Parameters

###### at

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

###### Returns

[`BiomeWeather`](#biomeweather) \| `undefined`

## Variables

### DEFAULT\_SNOW\_ACCUMULATION\_HEIGHT

> `const` **DEFAULT\_SNOW\_ACCUMULATION\_HEIGHT**: `1` = `1`

Defined in: [packages/prismarine/src/world/precipitation.ts:32](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L32)

The `max_snow_accumulation_height` a world gets when it carries no value of its own.

#### Java See

GameRules.MAX_SNOW_ACCUMULATION_HEIGHT

***

### PRECIPITATION\_ODDS

> `const` **PRECIPITATION\_ODDS**: `48` = `48`

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

One roll in this many lets a chunk's precipitation act at a column.

## Functions

### biomeWeatherOf()

> **biomeWeatherOf**(`worldgen`, `bedrockBiome`): [`BiomeWeather`](#biomeweather) \| `undefined`

Defined in: [packages/prismarine/src/world/precipitation.ts:54](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L54)

The weather of a Bedrock biome, read from the `worldgen/biome` document of the Java biome it
stands for: its `temperature`, `temperature_modifier` and `has_precipitation`.

#### Parameters

##### worldgen

`ReadonlyMap`\<`string`, \{ `data`: `unknown`; \}\>

The pack stack's `worldgen` registry, keyed `biome/<id>` for a biome.

##### bedrockBiome

`string`

The Bedrock biome identifier.

#### Returns

[`BiomeWeather`](#biomeweather) \| `undefined`

Undefined for a biome Java has no name for, or no document.

***

### precipitationAt()

> **precipitationAt**(`weather`, `at`, `seaLevel`): `Precipitation` \| `undefined`

Defined in: [packages/prismarine/src/world/precipitation.ts:123](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L123)

What falls at a block: nothing in a dry biome, snow where it is cold enough, and rain elsewhere.

#### Parameters

##### weather

[`BiomeWeather`](#biomeweather)

##### at

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

##### seaLevel

`number`

#### Returns

`Precipitation` \| `undefined`

#### Java Source

Biome.getPrecipitationAt

***

### shouldFreeze()

> **shouldFreeze**(`world`, `weather`, `at`): `boolean`

Defined in: [packages/prismarine/src/world/precipitation.ts:150](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L150)

Whether still water freezes at a position: the biome is cold enough to snow there, the block
light is under 10, the block is a water source, and water does not stand on all four sides of
it, so a lake freezes from its shore inwards.

#### Parameters

##### world

[`PrecipitationWorld`](#precipitationworld)

##### weather

[`BiomeWeather`](#biomeweather)

##### at

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

#### Returns

`boolean`

#### Java Source

Biome.shouldFreeze(Lnet/minecraft/world/level/LevelReader;Lnet/minecraft/core/BlockPos;Z)Z

***

### shouldSnow()

> **shouldSnow**(`world`, `weather`, `at`): `boolean`

Defined in: [packages/prismarine/src/world/precipitation.ts:169](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L169)

Whether snow settles at a position: it snows there, the block light is under 10, the position is
air or snow already, and a snow layer could stand there.

#### Parameters

##### world

[`PrecipitationWorld`](#precipitationworld)

##### weather

[`BiomeWeather`](#biomeweather)

##### at

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

#### Returns

`boolean`

#### Java Source

Biome.shouldSnow

***

### tickChunkPrecipitation()

> **tickChunkPrecipitation**(`world`, `chunkX`, `chunkZ`, `speed`, `nextPosition`): `void`

Defined in: [packages/prismarine/src/world/precipitation.ts:228](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L228)

One chunk's precipitation for one tick: `speed` rolls, each one in [PRECIPITATION\_ODDS](#precipitation-odds)
acting at a column drawn from the random tick counter, which a roll that misses leaves alone.

#### Parameters

##### world

[`PrecipitationWorld`](#precipitationworld)

The dimension.

##### chunkX

`number`

The chunk's x.

##### chunkZ

`number`

The chunk's z.

##### speed

`number`

The `random_tick_speed` game rule.

##### nextPosition

(`originX`, `originY`, `originZ`) => [`ContentPosition`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/world/adapter/index.md#contentposition)

Draws the next position in a section from the random tick counter.

#### Returns

`void`

#### Java See

ServerLevel.tickChunk

***

### tickPrecipitation()

> **tickPrecipitation**(`world`, `x`, `z`): `void`

Defined in: [packages/prismarine/src/world/precipitation.ts:188](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/precipitation.ts#L188)

The weather's work at one column: the top of the column freezes if it is still water that may
freeze, and while it rains, snow settles on the column or grows a layer up to the game rule's
height, and the block at the top takes the rain or snow, which fills a cauldron.

Known gap: a snow layer that grows does not lift the entities standing in it, as Java's
`Block.pushEntitiesUp` does.

#### Parameters

##### world

[`PrecipitationWorld`](#precipitationworld)

The dimension.

##### x

`number`

The column's x.

##### z

`number`

The column's z.

#### Returns

`void`

#### Java Source

ServerLevel.tickPrecipitation
