API reference / @jsprismarine/prismarine / world/precipitation
world/precipitation
Interfaces
BiomeWeather
Defined in: packages/prismarine/src/world/precipitation.ts:38
The weather a biome has: its climate, and whether anything falls there at all.
Properties
climate
readonlyclimate:BiomeClimate
Defined in: packages/prismarine/src/world/precipitation.ts:39
hasPrecipitation
readonlyhasPrecipitation:boolean
Defined in: packages/prismarine/src/world/precipitation.ts:41
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
The reads and writes the weather needs of one dimension.
Properties
maxY
readonlymaxY:number
Defined in: packages/prismarine/src/world/precipitation.ts:85
One past the highest block y of the dimension.
minY
readonlyminY:number
Defined in: packages/prismarine/src/world/precipitation.ts:83
The lowest block y of the dimension.
random
readonlyrandom:RandomSource
Defined in: packages/prismarine/src/world/precipitation.ts:78
The level's random, which a cauldron's fill and each chunk's rolls draw from.
seaLevel
readonlyseaLevel:number
Defined in: packages/prismarine/src/world/precipitation.ts:81
Methods
blockAt()
blockAt(
at):ContentBlock|undefined
Defined in: packages/prismarine/src/world/precipitation.ts:94
The block at a position, or undefined when its chunk is not loaded.
Parameters
at
Returns
ContentBlock | undefined
blockLight()
blockLight(
at):number
Defined in: packages/prismarine/src/world/precipitation.ts:97
Parameters
at
Returns
number
liquidAt()
liquidAt(
at):ContentBlock|undefined
Defined in: packages/prismarine/src/world/precipitation.ts:96
The liquid a waterlogged block holds, or undefined for none.
Parameters
at
Returns
ContentBlock | undefined
maxSnowAccumulation()
maxSnowAccumulation():
number
Defined in: packages/prismarine/src/world/precipitation.ts:101
The max_snow_accumulation_height game rule.
Returns
number
motionBlockingY()
motionBlockingY(
x,z):number
Defined in: packages/prismarine/src/world/precipitation.ts:90
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
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
Replaces a block and tells its neighbors, Level.setBlockAndUpdate.
Parameters
at
block
Returns
void
snowSurvives()
snowSurvives(
at):boolean
Defined in: packages/prismarine/src/world/precipitation.ts:99
Whether a snow layer could stand at a position, SnowLayerBlock.canSurvive.
Parameters
at
Returns
boolean
weatherAt()
weatherAt(
at):BiomeWeather|undefined
Defined in: packages/prismarine/src/world/precipitation.ts:92
The weather of the biome at a block, or undefined where the biome is not known.
Parameters
at
Returns
BiomeWeather | undefined
Variables
DEFAULT_SNOW_ACCUMULATION_HEIGHT
constDEFAULT_SNOW_ACCUMULATION_HEIGHT:1=1
Defined in: packages/prismarine/src/world/precipitation.ts:32
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
constPRECIPITATION_ODDS:48=48
Defined in: packages/prismarine/src/world/precipitation.ts:23
One roll in this many lets a chunk's precipitation act at a column.
Functions
biomeWeatherOf()
biomeWeatherOf(
worldgen,bedrockBiome):BiomeWeather|undefined
Defined in: packages/prismarine/src/world/precipitation.ts:54
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 | 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
What falls at a block: nothing in a dry biome, snow where it is cold enough, and rain elsewhere.
Parameters
weather
at
seaLevel
number
Returns
Precipitation | undefined
Java Source
Biome.getPrecipitationAt
shouldFreeze()
shouldFreeze(
world,weather,at):boolean
Defined in: packages/prismarine/src/world/precipitation.ts:150
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
weather
at
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
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
weather
at
Returns
boolean
Java Source
Biome.shouldSnow
tickChunkPrecipitation()
tickChunkPrecipitation(
world,chunkX,chunkZ,speed,nextPosition):void
Defined in: packages/prismarine/src/world/precipitation.ts:228
One chunk's precipitation for one tick: speed rolls, each one in PRECIPITATION_ODDS acting at a column drawn from the random tick counter, which a roll that misses leaves alone.
Parameters
world
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
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
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
The dimension.
x
number
The column's x.
z
number
The column's z.
Returns
void
Java Source
ServerLevel.tickPrecipitation