Skip to content

API reference / @jsprismarine/prismarine / world/physics/BlockRules

world/physics/BlockRules ​

Interfaces ​

LiquidKind ​

Defined in: packages/prismarine/src/world/physics/BlockRules.ts:70

The still and moving forms of each liquid, which physics has to treat as one substance.

How far and how fast each one travels is not here: @jsprismarine/engine-systems carries Java's own rates and owns the spread. What is left is the pair of identifiers the support and gravity rules need in order to recognize liquid at all.

Properties ​

flowing ​

readonly flowing: string

Defined in: packages/prismarine/src/world/physics/BlockRules.ts:72

still ​

readonly still: string

Defined in: packages/prismarine/src/world/physics/BlockRules.ts:71

Variables ​

LAVA ​

const LAVA: LiquidKind

Defined in: packages/prismarine/src/world/physics/BlockRules.ts:80


LIQUIDS ​

const LIQUIDS: readonly LiquidKind[]

Defined in: packages/prismarine/src/world/physics/BlockRules.ts:85


WATER ​

const WATER: LiquidKind

Defined in: packages/prismarine/src/world/physics/BlockRules.ts:75

Functions ​

falls() ​

falls(name): boolean

Defined in: packages/prismarine/src/world/physics/BlockRules.ts:121

Whether a block falls under its own weight.

@jsprismarine/block-behaviors owns the answer, because the families it carries are what actually performs a fall when the content runtime is on, and two lists would drift. It knows the loose ground blocks, all sixteen concrete powders, the anvils, the dragon egg and the brushable blocks.

Parameters ​

name ​

string

The block's state name.

Returns ​

boolean

Whether gravity applies to it.


fallsThrough() ​

fallsThrough(name): boolean

Defined in: packages/prismarine/src/world/physics/BlockRules.ts:144

Whether a falling block passes through this block rather than landing on it.

Java's FallingBlock.isFree: air, a liquid, or a block a liquid would wash away. The world's gravity check and the falling entity both ask this, because when they disagree a block over water falls, lands back on the surface it left and falls again, every other tick, forever.

Parameters ​

name ​

string

The block's state name.

Returns ​

boolean

Whether a falling block moves into it.

Java Source ​

FallingBlock.isFree


isWashedAway() ​

isWashedAway(name): boolean

Defined in: packages/prismarine/src/world/physics/BlockRules.ts:132

Whether a liquid may take this block's place.

Vanilla drowns plants rather than damming water behind them, which is also what stops a field of wheat from holding back a river. Air and the liquids themselves count, since a liquid occupies their cell without doing anything to them.

Parameters ​

name ​

string

The block's state name.

Returns ​

boolean

Whether liquid flows into it.


liquidOf() ​

liquidOf(name): LiquidKind | null

Defined in: packages/prismarine/src/world/physics/BlockRules.ts:88

The liquid a block is, if it is one.

Parameters ​

name ​

string

Returns ​

LiquidKind | null


needsSupport() ​

needsSupport(name): boolean

Defined in: packages/prismarine/src/world/physics/BlockRules.ts:105

Whether a block needs something beneath it.

A plant is not attached to the ground so much as resting on it, so removing what it stands on removes the plant. Vanilla drops it rather than deleting it, which is what makes mining under a field of wheat give you the wheat.

The blocks that rest on the ground are the blocks a liquid pops or breaks, which is a column a Bedrock Dedicated Server publishes: every crop, carpet, rail, sapling, flower and mushroom, the snow layers, 151 names against the thirty this used to list by hand. Only what hangs on a wall or floats comes back out, by hangsOrFloats.

Parameters ​

name ​

string

The block's state name.

Returns ​

boolean

Whether it breaks when its support goes.