Skip to content

API reference / @jsprismarine/prismarine / content/world/adapter

content/world/adapter ​

Interfaces ​

BlockDestroyOptions ​

Defined in: packages/block-behaviors/src/world.ts:185

Options for removing a block without asking the family to guess its drops.

Properties ​

drops? ​

readonly optional drops?: boolean

Defined in: packages/block-behaviors/src/world.ts:187

Whether to roll the block's own loot, defaulting to true.


BlockEntityData ​

Defined in: packages/block-behaviors/src/world.ts:102

What a block entity stores.

Bedrock block entities have no shared schema, so the fields the behaviors agree on are named here and anything else travels under the index signature. A container's items is sparse on purpose: an empty slot is undefined, which is what the comparator fill-level formula counts.

Indexable ​

[field: string]: unknown

Properties ​

capacity? ​

readonly optional capacity?: number

Defined in: packages/block-behaviors/src/world.ts:106

How many slots the container has, which the comparator divides by.

items? ​

readonly optional items?: readonly (ItemDrop | undefined)[]

Defined in: packages/block-behaviors/src/world.ts:104

One entry per slot, undefined for an empty one.

pistonArm? ​

readonly optional pistonArm?: object

Defined in: packages/block-behaviors/src/world.ts:112

Bedrock's piston-arm state, stored as native PistonArm block-entity tags.

lastProgress ​

readonly lastProgress: number

Previous extension progress, 0 when retracted and 1 when extended.

newState ​

readonly newState: number

Bedrock piston state the arm is moving toward.

progress ​

readonly progress: number

Current extension progress, 0 when retracted and 1 when extended.

state ​

readonly state: number

Bedrock piston state used to draw the arm.

sticky ​

readonly sticky: boolean

Whether the piston is sticky.

sealed? ​

readonly optional sealed?: boolean

Defined in: packages/block-behaviors/src/world.ts:110

True once wax or a similar seal makes the block entity read-only.

text? ​

readonly optional text?: readonly string[]

Defined in: packages/block-behaviors/src/world.ts:108

A sign's lines, a lectern's book title, a jukebox's record.


ContentAiAccess ​

Defined in: packages/prismarine/src/content/world/adapter.ts:532

The per-entity AI seams, which need an entity index the content packages never see.

Methods ​

actuator() ​

actuator(entity): EntityActuator

Defined in: packages/prismarine/src/content/world/adapter.ts:536

The navigation and look control for one entity.

Parameters ​
entity ​

EntityInstance

Returns ​

EntityActuator

brainWorld() ​

brainWorld(): BrainWorld

Defined in: packages/prismarine/src/content/world/adapter.ts:538

The level the twenty Java brain mobs read.

Returns ​

BrainWorld

goalWorld() ​

goalWorld(entity): GoalWorld | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:534

The goal world for one entity, or undefined when the entity runs no goals.

Parameters ​
entity ​

EntityInstance

Returns ​

GoalWorld | undefined


ContentBlock ​

Defined in: packages/prismarine/src/content/world/adapter.ts:66

A block as the content packages read one: what it is, and the state values its rules read.

Properties ​

identifier ​

readonly identifier: string

Defined in: packages/prismarine/src/content/world/adapter.ts:68

The namespaced Bedrock block identifier, such as minecraft:oak_stairs.

states ​

readonly states: Readonly<Record<string, BlockStateValue>>

Defined in: packages/prismarine/src/content/world/adapter.ts:70

Every state value the block carries, keyed by state name.


ContentBlockAccess ​

Defined in: packages/prismarine/src/content/world/adapter.ts:116

Reads and writes the blocks of one dimension.

Methods ​

biome() ​

biome(at): string | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:256

The namespaced Bedrock biome identifier at a position, such as minecraft:mesa.

Undefined when the chunk is not loaded, and when the chunk holds a biome number the pinned Bedrock data has no name for, which is a biome nothing in this server wrote.

Parameters ​
at ​

ContentPosition

Returns ​

string | undefined

biomeTags() ​

biomeTags(at): readonly string[]

Defined in: packages/prismarine/src/content/world/adapter.ts:264

The biome tags at a position, which is what a spawn rule's has_biome_tag compares.

Bedrock's own bare names - overworld, animal, bee_habitat - out of the biome's definition, not Java's namespaced #minecraft:is_forest tags. Empty where ContentBlockAccess.biome has no answer.

Parameters ​
at ​

ContentPosition

Returns ​

readonly string[]

blockChunkAt()? ​

optional blockChunkAt(at): ContentBlockChunk | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:137

The loaded chunk holding a block, or undefined when it is not loaded: its identity and its block revision from one lookup, where ContentBlockAccess.blockChunkIdentityAt and ContentBlockAccess.blockChunkRevisionAt take one each. A cache spanning ticks prefers it.

Parameters ​
at ​

ContentPosition

Returns ​

ContentBlockChunk | undefined

blockChunkIdentityAt()? ​

optional blockChunkIdentityAt(at): object | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:139

The loaded chunk object holding a block, for caches that span ticks.

Parameters ​
at ​

ContentPosition

Returns ​

object | undefined

blockChunkRevisionAt()? ​

optional blockChunkRevisionAt(at): number | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:141

The loaded chunk's block mutation revision, or undefined when it is not loaded.

Parameters ​
at ​

ContentPosition

Returns ​

number | undefined

blockLight()? ​

optional blockLight(at): number

Defined in: packages/prismarine/src/content/world/adapter.ts:211

Block light at a position, 0 to 15; absent when the host cannot separate it from sky light.

Parameters ​
at ​

ContentPosition

Returns ​

number

blockRevision()? ​

optional blockRevision(): number

Defined in: packages/prismarine/src/content/world/adapter.ts:130

The dimension's monotonic block-write version, when the host can provide one.

Returns ​

number

data() ​

data(at): BlockEntityData | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:201

A block entity's stored data, or undefined when the position has none.

Parameters ​
at ​

ContentPosition

Returns ​

BlockEntityData | undefined

destroy()? ​

optional destroy(at, options?): boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:172

Takes a block out: raises its onBreak and puts what Java's table rolls on the ground.

The write is still the caller's and has to come afterwards, because a family reads the block entity it is about to lose. src/world/blockDestroy.ts is the one place that knows how, and this is how a content package reaches it: a piston popping a torch and a falling anvil clearing a flower both go through here rather than guessing that a block drops one of itself.

Left out by an adapter with no live world behind it, which sends the caller back to the drop it would have made on its own.

Parameters ​
at ​

ContentPosition

The block to destroy.

options? ​

BlockDestroyOptions

Whether the block's own loot is rolled. Defaults to true.

Returns ​

boolean

True when the world took the drops, so the caller owes nothing more for them.

directSignal()? ​

optional directSignal(at, directionToSource): number

Defined in: packages/prismarine/src/content/world/adapter.ts:226

The strong signal from a block, where direction points from the receiver to this source.

Parameters ​
at ​

ContentPosition

directionToSource ​

"south" | "west" | "north" | "east" | "down" | "up"

Returns ​

number

executeEntityEvent()? ​

optional executeEntityEvent(at, entity, name): void

Defined in: packages/prismarine/src/content/world/adapter.ts:205

Executes a named event on the block at a position, with the entity that raised it.

Parameters ​
at ​

ContentPosition

entity ​

ContentEntity

name ​

string

Returns ​

void

get() ​

get(at): ContentBlock | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:118

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

Parameters ​
at ​

ContentPosition

Returns ​

ContentBlock | undefined

isLoaded() ​

isLoaded(at): boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:230

Whether the chunk holding a position is loaded.

Parameters ​
at ​

ContentPosition

Returns ​

boolean

isRedstoneConductor()? ​

optional isRedstoneConductor(at): boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:228

Whether a block carries redstone power through its direct signal.

Parameters ​
at ​

ContentPosition

Returns ​

boolean

light() ​

light(at): number

Defined in: packages/prismarine/src/content/world/adapter.ts:207

The light level at a position, 0 to 15, as the growth, melt and spawn rules read it.

Parameters ​
at ​

ContentPosition

Returns ​

number

lightningRodNear()? ​

optional lightningRodNear(at, radius): ContentPosition | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:249

The closest lightning rod within radius blocks of a position that is the highest block of its column, Java's ServerLevel.findLightningRod, in the loaded chunks. Left out by a host with no chunks.

Parameters ​
at ​

ContentPosition

radius ​

number

Returns ​

ContentPosition | undefined

Java See ​

ServerLevel.findLightningRod

lightReady()? ​

optional lightReady(chunkX, chunkZ): boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:216

Whether a chunk's light is final, which is what a natural spawn waits for. Absent on a host whose light is never still arriving.

Parameters ​
chunkX ​

number

chunkZ ​

number

Returns ​

boolean

liquid()? ​

optional liquid(at): ContentBlock | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:123

The liquid a position holds in its second storage layer, which is where Bedrock keeps a waterlogged block's water, or undefined when there is none or its chunk is not loaded.

Parameters ​
at ​

ContentPosition

Returns ​

ContentBlock | undefined

motionBlockingY()? ​

optional motionBlockingY(x, z): number | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:241

Java's MOTION_BLOCKING heightmap for one column: one above the highest block that blocks motion or holds a fluid, leaves included, and the dimension's floor in an empty column. Undefined when the column is not loaded, and left out by a host with no chunks.

Parameters ​
x ​

number

z ​

number

Returns ​

number | undefined

move()? ​

optional move(from, to): void

Defined in: packages/prismarine/src/content/world/adapter.ts:155

Moves a block and its block entity without running placement hooks.

Parameters ​
from ​

ContentPosition

to ​

ContentPosition

Returns ​

void

notifyNeighbor()? ​

optional notifyNeighbor(at, from): void

Defined in: packages/prismarine/src/content/world/adapter.ts:184

Tells the block at at that its neighbor at from changed, and no other block, Java's Level.neighborChanged. Left out by an adapter that dispatches no block hooks.

Parameters ​
at ​

ContentPosition

from ​

ContentPosition

Returns ​

void

notifyNeighbors() ​

notifyNeighbors(at, previous?): void

Defined in: packages/prismarine/src/content/world/adapter.ts:179

Tells the six neighbors of a position that it changed.

Parameters ​
at ​

ContentPosition

previous? ​

ContentBlock

The block the change replaced, when the caller knows it, which a neighbor reads to tell a plant cut off beyond it from one that never had more of itself there.

Returns ​

void

power() ​

power(at): number

Defined in: packages/prismarine/src/content/world/adapter.ts:218

The redstone power reaching a position, 0 to 15.

Parameters ​
at ​

ContentPosition

Returns ​

number

powerToWire()? ​

optional powerToWire(at): number

Defined in: packages/prismarine/src/content/world/adapter.ts:220

The power reaching a redstone wire at a position from everything but other wires, 0 to 15.

Parameters ​
at ​

ContentPosition

Returns ​

number

runtimeIdAt()? ​

optional runtimeIdAt(at): number | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:143

The block's runtime id without constructing a block record.

Parameters ​
at ​

ContentPosition

Returns ​

number | undefined

set() ​

set(at, block, notifyNeighbors, placement?): void

Defined in: packages/prismarine/src/content/world/adapter.ts:153

Replaces the block at a position.

Parameters ​
at ​

ContentPosition

block ​

ContentBlock

The whole block, not a patch; absent states take the block's defaults.

notifyNeighbors ​

boolean

Whether to run the neighbor updates the write causes. This is Java's flag 1 in setBlockAndUpdate against the bare write a diode uses for its own state, and both callers exist, so it has no default.

placement? ​

BlockPlacementContext

Player and hit details for a placement that raises onPlace.

Returns ​

void

setData() ​

setData(at, data): void

Defined in: packages/prismarine/src/content/world/adapter.ts:203

Replaces a block entity's data whole.

Parameters ​
at ​

ContentPosition

data ​

BlockEntityData

Returns ​

void

setLiquid()? ​

optional setLiquid(at, liquid): void

Defined in: packages/prismarine/src/content/world/adapter.ts:128

Writes the liquid a position holds in its second storage layer, or takes it away for undefined, notifying no neighbor; the caller does that once it has written everything.

Parameters ​
at ​

ContentPosition

liquid ​

ContentBlock | undefined

Returns ​

void

signal()? ​

optional signal(at, directionToSource): number

Defined in: packages/prismarine/src/content/world/adapter.ts:224

The signal from a block, where direction points from the receiver to this source.

Parameters ​
at ​

ContentPosition

directionToSource ​

"south" | "west" | "north" | "east" | "down" | "up"

Returns ​

number

skyLight()? ​

optional skyLight(at): number

Defined in: packages/prismarine/src/content/world/adapter.ts:209

Sky light at a position, 0 to 15; absent when the host cannot separate it from block light.

Parameters ​
at ​

ContentPosition

Returns ​

number

surfaceY() ​

surfaceY(x, z): number | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:235

The lowest y an entity may stand on in one column, which is the position the surface spawn pass tries. Undefined when the column is not loaded.

Parameters ​
x ​

number

z ​

number

Returns ​

number | undefined

updateNeighborForOutputSignal()? ​

optional updateNeighborForOutputSignal(at): void

Defined in: packages/prismarine/src/content/world/adapter.ts:191

Tells the comparators that read a position that what they read may have changed, Java's Level.updateNeighbourForOutputSignal. Left out by an adapter that dispatches no block hooks.

Parameters ​
at ​

ContentPosition

Returns ​

void

Java See ​

Level.updateNeighbourForOutputSignal

updateShape()? ​

optional updateShape(at): void

Defined in: packages/prismarine/src/content/world/adapter.ts:199

Settles the block at a position against its six neighbors, which is Java's Block.updateFromNeighbourShapes as LevelChunk.postProcessGeneration runs it on a newly generated chunk. What the block's families write tells no neighbor and drops nothing.

Left out by an adapter that dispatches no block hooks.

Parameters ​
at ​

ContentPosition

Returns ​

void

wireShape()? ​

optional wireShape(at): Readonly<Record<"north" | "south" | "west" | "east", "none" | "side" | "up">>

Defined in: packages/prismarine/src/content/world/adapter.ts:222

How a redstone wire at a position meets each horizontal side: none, side or up.

Parameters ​
at ​

ContentPosition

Returns ​

Readonly<Record<"north" | "south" | "west" | "east", "none" | "side" | "up">>


ContentBlockChunk ​

Defined in: packages/prismarine/src/content/world/adapter.ts:110

A loaded chunk as a block cache that spans ticks keys it: the object, and its block revision.

Methods ​

getBlockRevision() ​

getBlockRevision(): number

Defined in: packages/prismarine/src/content/world/adapter.ts:112

A number that changes whenever a block in the chunk does.

Returns ​

number


ContentEffectSink ​

Defined in: packages/prismarine/src/content/world/adapter.ts:323

Plays the things a content package emits but never reads back.

Methods ​

emitGameEvent() ​

emitGameEvent(event, at, sourceId?): void

Defined in: packages/prismarine/src/content/world/adapter.ts:344

Emits a game event, which is what a warden's vibration listener hears.

Parameters ​
event ​

string

at ​

ContentPosition

sourceId? ​

number

Returns ​

void

playBlockSound()? ​

optional playBlockSound(at, sound, source?): void

Defined in: packages/prismarine/src/content/world/adapter.ts:335

Plays the sound of the block standing at a position, which its material decides.

Parameters ​
at ​

ContentPosition

sound ​

ContentBlockSound

source? ​

string

The runtime id of the player whose click made it, as a decimal string, whose Java client plays it itself.

Returns ​

void

playRecord()? ​

optional playRecord(at, record): void

Defined in: packages/prismarine/src/content/world/adapter.ts:340

Starts a music disc's song at a jukebox, or stops the one there, by the record's sound event, such as record.cat; undefined stops it.

Parameters ​
at ​

ContentPosition

record ​

string | undefined

Returns ​

void

playSound() ​

playSound(at, sound, options?): void

Defined in: packages/prismarine/src/content/world/adapter.ts:329

Plays a sound event at the center of a block, such as minecraft:block.lever.click, at the volume and pitch given, and names the player whose click made it, whose Java client plays it itself.

Parameters ​
at ​

ContentPosition

sound ​

string

options? ​

ContentSoundOptions

Returns ​

void

redstoneActivated()? ​

optional redstoneActivated(activation): void

Defined in: packages/prismarine/src/content/world/adapter.ts:346

Tells the server a redstone component acted, which a script's world events hear.

Parameters ​
activation ​

RedstoneActivation

Returns ​

void

spawnParticle() ​

spawnParticle(at, particle): void

Defined in: packages/prismarine/src/content/world/adapter.ts:342

Emits a particle effect, such as minecraft:crop_growth_emitter.

Parameters ​
at ​

ContentPosition

particle ​

string

Returns ​

void


ContentEntity ​

Defined in: packages/prismarine/src/content/world/adapter.ts:74

One entity as the content packages see one.

Properties ​

creative? ​

readonly optional creative?: boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:84

Whether this player is in creative mode; absent for non-players.

id ​

readonly id: number

Defined in: packages/prismarine/src/content/world/adapter.ts:76

The runtime id, unique for the length of the session.

identifier ​

readonly identifier: string

Defined in: packages/prismarine/src/content/world/adapter.ts:78

The namespaced entity identifier, such as minecraft:zombie.

pitch? ​

readonly optional pitch?: number

Defined in: packages/prismarine/src/content/world/adapter.ts:97

This player's head pitch, in degrees; absent when the host does not say.

position ​

readonly position: ContentPosition

Defined in: packages/prismarine/src/content/world/adapter.ts:80

Position at the bottom of the entity's body, including for players whose network position is their eyes.

spectator? ​

readonly optional spectator?: boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:86

Whether this player is in spectator mode; absent for non-players.

tags? ​

readonly optional tags?: readonly string[]

Defined in: packages/prismarine/src/content/world/adapter.ts:82

Dynamic string tags used by entity filters such as has_tag.

timeSinceRest? ​

readonly optional timeSinceRest?: number

Defined in: packages/prismarine/src/content/world/adapter.ts:93

Ticks since this player last slept or died, Java's Stats.TIME_SINCE_REST, which the phantom spawner reads; absent for non-players and read as 0.

Java See ​

Stats.TIME_SINCE_REST

yaw? ​

readonly optional yaw?: number

Defined in: packages/prismarine/src/content/world/adapter.ts:95

Where this player's head faces, in degrees; absent when the host does not say.


ContentEntityAccess ​

Defined in: packages/prismarine/src/content/world/adapter.ts:268

Spawns, removes and counts the entities of one dimension.

Methods ​

at() ​

at(position): readonly ContentEntity[]

Defined in: packages/prismarine/src/content/world/adapter.ts:270

Every entity whose position is inside the block at a position.

Parameters ​
position ​

ContentPosition

Returns ​

readonly ContentEntity[]

countOfType() ​

countOfType(identifier, at, radius): number

Defined in: packages/prismarine/src/content/world/adapter.ts:299

How many entities of one type stand within a radius of a position.

Parameters ​
identifier ​

string

at ​

ContentPosition

radius ​

number

Returns ​

number

drop() ​

drop(at, item): void

Defined in: packages/prismarine/src/content/world/adapter.ts:297

Drops an item stack as an entity at a position.

Parameters ​
at ​

ContentPosition

item ​

ItemDrop

Returns ​

void

minecartContents()? ​

optional minecartContents(id): MinecartContents | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:307

What a minecart carries for a comparator behind a detector rail, by runtime id: a container minecart's slots or a command block minecart's success count. Left out where the entities keep no contents, and undefined for any entity that is not such a minecart.

Parameters ​
id ​

number

Returns ​

MinecartContents | undefined

move()? ​

optional move(id, by): void

Defined in: packages/prismarine/src/content/world/adapter.ts:295

Moves an entity by an offset, as a piston carries one. Absent where entities cannot be moved.

Parameters ​
id ​

number

by ​

ContentPosition

Returns ​

void

near() ​

near(center, radius): readonly ContentEntity[]

Defined in: packages/prismarine/src/content/world/adapter.ts:272

Every entity within a radius of a position, nearest first.

Parameters ​
center ​

ContentPosition

radius ​

number

Returns ​

readonly ContentEntity[]

players() ​

players(): readonly ContentEntity[]

Defined in: packages/prismarine/src/content/world/adapter.ts:274

Every player in the dimension.

Returns ​

readonly ContentEntity[]

remove() ​

remove(id): void

Defined in: packages/prismarine/src/content/world/adapter.ts:293

Removes an entity by its runtime id.

Parameters ​
id ​

number

Returns ​

void

ringBell()? ​

optional ringBell(at): void

Defined in: packages/prismarine/src/content/world/adapter.ts:301

Tells the entities around a bell that it rang, which sends villagers to hide.

Parameters ​
at ​

ContentPosition

Returns ​

void

spawn() ​

spawn(identifier, at, data?, options?): number

Defined in: packages/prismarine/src/content/world/adapter.ts:286

Spawns an entity.

Parameters ​
identifier ​

string

at ​

ContentPosition

Where the entity stands, exactly: a block's position spawns it on that block's corner, so a caller spawning on a block passes the point Java uses, such as the middle of its floor.

data? ​

BlockEntityData

The entity's own stored data, such as the block a falling block carries.

options? ​

How the entity starts: the event it runs as it spawns, the way it faces and the name it carries.

event? ​

string

name? ​

string

yaw? ​

number

Returns ​

number

The runtime id ContentEntityAccess.remove takes.


ContentGenerationAccess ​

Defined in: packages/prismarine/src/content/world/adapter.ts:542

What a feature decorating one chunk reads and writes.

Methods ​

featureWorld() ​

featureWorld(chunkX, chunkZ): FeatureWorld

Defined in: packages/prismarine/src/content/world/adapter.ts:550

The world a feature decorates, for one chunk.

Generation time, not live world: the chunk is still being built, the states are Java states rather than Bedrock ones, and the region is gone once decoration finishes. That is why it is a factory here rather than a member of the live adapter.

Parameters ​
chunkX ​

number

chunkZ ​

number

Returns ​

FeatureWorld


ContentItemAccess ​

Defined in: packages/prismarine/src/content/world/adapter.ts:453

The item-behavior half of the world, which no other package asks for.

Kept apart from the core groups because every member is about an item in a hand rather than about a place in the world, and because @jsprismarine/item-behaviors is the one package whose effects arrive as one tagged union instead of as methods.

Methods ​

boostMount()? ​

optional boostMount(source, item): boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:487

Boosts the mount the user steers with the item and says whether it did, when the world has mounts.

Parameters ​
source ​

ItemSource

item ​

string

Returns ​

boolean

canDyeEntity()? ​

optional canDyeEntity(target, color): boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:491

Whether a target entity accepts this dye, when the actor port can answer.

Parameters ​
target ​

ItemSource

color ​

string

Returns ​

boolean

canNameEntity()? ​

optional canNameEntity(target): boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:489

Whether a target entity accepts a name tag, when the actor port can answer.

Parameters ​
target ​

ItemSource

Returns ​

boolean

effectsOf() ​

effectsOf(potion): readonly EffectApplication[]

Defined in: packages/prismarine/src/content/world/adapter.ts:485

The effects one potion identifier applies. Java keeps this table in code, in Potions, so the server answers rather than the item package.

Parameters ​
potion ​

string

Returns ​

readonly EffectApplication[]

entityFits()? ​

optional entityFits(identifier, position): boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:507

Whether a new entity of a type would stand clear at a position; see WorldActions.entityFits.

Parameters ​
identifier ​

string

position ​

BlockPosition

Returns ​

boolean

environment() ​

environment(): EnvironmentState

Defined in: packages/prismarine/src/content/world/adapter.ts:457

Everything a behavior reads about the world around it.

Returns ​

EnvironmentState

eyesInEntity()? ​

optional eyesInEntity(source): boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:505

Whether the source's eyes are inside an entity it could pick; see WorldActions.eyesInEntity.

Parameters ​
source ​

ItemSource

Returns ​

boolean

fertilize() ​

fertilize(block): boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:480

Bone meals a block through its family's onBoneMeal, Java's BoneMealItem.useOn.

Parameters ​
block ​

ContentBlock & object

Returns ​

boolean

True when the block took the bone meal; false when it is no target.

Java See ​

BoneMealItem.useOn

hangPainting()? ​

optional hangPainting(position, face): boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:497

Hangs a painting against a block's face when a picture fits there.

Parameters ​
position ​

BlockPosition

face ​

"south" | "west" | "north" | "east" | "down" | "up"

Returns ​

boolean

includes() ​

includes(set, member): boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:461

Whether an identifier is in a holder set, resolving #tag, single and list forms alike.

Parameters ​
set ​

HolderSet

member ​

string

Returns ​

boolean

instrumentSound()? ​

optional instrumentSound(instrument): string | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:501

The sound event an instrument plays, from its registry entry.

Parameters ​
instrument ​

string

Returns ​

string | undefined

locate()? ​

optional locate(destination, origin): BlockPosition | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:499

The nearest structure in a structure tag, when the world has a structure search.

Parameters ​
destination ​

string

origin ​

BlockPosition

Returns ​

BlockPosition | undefined

perform() ​

perform(action): void

Defined in: packages/prismarine/src/content/world/adapter.ts:511

Does one thing to the world.

Parameters ​
action ​

ItemWorldAction

Returns ​

void

placeEndCrystal()? ​

optional placeEndCrystal(base): boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:493

Places an end crystal when its support and spawn box are valid.

Parameters ​
base ​

BlockPosition

Returns ​

boolean

stateOf() ​

stateOf(source): SourceState

Defined in: packages/prismarine/src/content/world/adapter.ts:455

Everything a behavior reads about the entity using the item.

Parameters ​
source ​

ItemSource

Returns ​

SourceState

supports()? ​

optional supports(action): boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:509

Whether an action of this kind is performed, so a behavior can keep its item when not.

Parameters ​
action ​

"map" | "ignite" | "brush" | "blocking" | "fishing" | "signal" | "place-block" | "break-block" | "spawn-entity" | "launch-firework" | "launch-projectile" | "play-sound" | "play-block-sound" | "apply-effects" | "remove-effects" | "damage-entity" | "feed" | "teleport-randomly" | "grant-experience" | "start-cooldown" | "consume-durability" | "give-item" | "equip" | "name-entity" | "attach-lead" | "dye-entity" | "shear-entity" | "disable-shield" | "open-screen"

Returns ​

boolean

targetOf() ​

targetOf(source): ItemSource | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:459

The entity an interaction landed on, or undefined when it landed on a block or nothing.

Parameters ​
source ​

ItemSource

Returns ​

ItemSource | undefined

tieLeashes()? ​

optional tieLeashes(source, fence): boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:495

Ties every mob a player leads near a fence to a knot on it, and says whether any was.

Parameters ​
source ​

ItemSource

fence ​

BlockPosition

Returns ​

boolean

transform() ​

transform(transformer, block, face): BlockPlacement | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:468

What a minecraft:block_transformer turns a block into: the axe's stripping, the shovel's path and the hoe's tilling.

Parameters ​
transformer ​

string

block ​

ContentBlock & object

face ​

"south" | "west" | "north" | "east" | "down" | "up"

Returns ​

BlockPlacement | undefined

The replacement, or undefined when the transformer has no rule for the block.

viewHit()? ​

optional viewHit(source, fluid): ViewHit | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:503

Where the source's view first meets a block, stopping at the fluids named; see WorldActions.viewHit.

Parameters ​
source ​

ItemSource

fluid ​

FluidClip

Returns ​

ViewHit | undefined


ContentLevelFacts ​

Defined in: packages/prismarine/src/content/world/adapter.ts:365

What one dimension is, and what its clock and weather say.

Properties ​

ambientLight? ​

readonly optional ambientLight?: number

Defined in: packages/prismarine/src/content/world/adapter.ts:387

The dimension's minimum ambient brightness, from its Java ambient_light value.

attributes? ​

readonly optional attributes?: ReadonlyMap<string, unknown>

Defined in: packages/prismarine/src/content/world/adapter.ts:385

The dimension type's environment attributes, such as minecraft:gameplay/bed_rule, keyed by their identifiers, as DimensionTypeDefinition carries them.

dimension ​

readonly dimension: string

Defined in: packages/prismarine/src/content/world/adapter.ts:367

The namespaced dimension identifier, such as minecraft:overworld.

hasFixedTime? ​

readonly optional hasFixedTime?: boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:380

Whether the dimension clock is fixed, which prevents Java from being bright outside.

hasSkyLight ​

readonly hasSkyLight: boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:373

Whether the dimension has sky light, which the nether does not.

javaDataVersion? ​

readonly optional javaDataVersion?: number

Defined in: packages/prismarine/src/content/world/adapter.ts:378

The data version of the Java release the server runs, from its JavaDataTarget, which picks the release's copies of Java code that changed. Undefined runs the oldest release's.

maxY ​

readonly maxY: number

Defined in: packages/prismarine/src/content/world/adapter.ts:371

One past the highest block y. The overworld is 320, the nether 128.

minY ​

readonly minY: number

Defined in: packages/prismarine/src/content/world/adapter.ts:369

The lowest block y, inclusive. The overworld is -64.

seaLevel ​

readonly seaLevel: number

Defined in: packages/prismarine/src/content/world/adapter.ts:396

The sea level, which worldgen's relative_to_sea_level anchors resolve against.

seed ​

readonly seed: bigint

Defined in: packages/prismarine/src/content/world/adapter.ts:398

The world seed.

skyLightFactor? ​

readonly optional skyLightFactor?: number

Defined in: packages/prismarine/src/content/world/adapter.ts:389

The visual contribution of sky light, when the dimension type defines one.

waterEvaporates? ​

readonly optional waterEvaporates?: boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:394

Whether water poured here evaporates, the dimension type's minecraft:gameplay/water_evaporates attribute, which only the Nether sets. Left out reads as false.

Methods ​

dayTime() ​

dayTime(): number

Defined in: packages/prismarine/src/content/world/adapter.ts:402

Ticks into the current day, 0 to 23999.

Returns ​

number

difficulty() ​

difficulty(): "normal" | "peaceful" | "easy" | "hard"

Defined in: packages/prismarine/src/content/world/adapter.ts:403

Returns ​

"normal" | "peaceful" | "easy" | "hard"

fluidReplacement()? ​

optional fluidReplacement(): FluidReplacement

Defined in: packages/prismarine/src/content/world/adapter.ts:432

Which edition decides what a flowing fluid destroys, the server's fluid-replacement setting. Absent where no server config stands behind the level, which takes the default.

Returns ​

FluidReplacement

gameRule() ​

gameRule(name): number | boolean | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:427

One game rule's value.

Named by any spelling @jsprismarine/commands' gamerule registry knows: the 1.21.11 id minecraft:mob_griefing, the pre-1.21.11 mobGriefing, or Bedrock's mobgriefing. import('./gameRules') names the rules the content path reads, and resolves each through that registry rather than spelling it a second time.

Parameters ​
name ​

string

Returns ​

number | boolean | undefined

The value, or undefined when this world carries no rule of that name. A world that never registered a rule and a world that turned it off are different answers, so each caller says what it does without one.

gameTime() ​

gameTime(): number

Defined in: packages/prismarine/src/content/world/adapter.ts:400

Ticks since the world was created.

Returns ​

number

inhabitedTime()? ​

optional inhabitedTime(at): number

Defined in: packages/prismarine/src/content/world/adapter.ts:409

Ticks players have spent in the chunk that holds a block position, Java's LevelChunk.getInhabitedTime, which ramps the regional difficulty there. Left out by a level that keeps none, which reads as a new chunk.

Parameters ​
at ​

ContentPosition

Returns ​

number

isRainingAt() ​

isRainingAt(at): boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:412

Whether rain is falling on a position, which needs the host's heightmap.

Parameters ​
at ​

ContentPosition

Returns ​

boolean

runCommand()? ​

optional runCommand(at, command, name, entityId?): CommandRun | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:442

Runs a command as a command block at a position, from the middle of the block.

Parameters ​
at ​

ContentPosition

command ​

string

name ​

string

The name the command runs as.

entityId? ​

number

The runtime id of the entity the command runs as, a command block minecart, which also places it; left out for a command block.

Returns ​

CommandRun | undefined

What it reported, or undefined where command blocks do not run: no command layer stands behind the level, or its commandblocksenabled game rule is off.

spawnPosition() ​

spawnPosition(): ContentPosition

Defined in: packages/prismarine/src/content/world/adapter.ts:414

The world spawn point, which a compass points at.

Returns ​

ContentPosition

weather() ​

weather(): "thunder" | "clear" | "rain"

Defined in: packages/prismarine/src/content/world/adapter.ts:410

Returns ​

"thunder" | "clear" | "rain"


ContentPosition ​

Defined in: packages/prismarine/src/content/world/adapter.ts:59

An integer block position in world coordinates, within one dimension.

Properties ​

x ​

readonly x: number

Defined in: packages/prismarine/src/content/world/adapter.ts:60

y ​

readonly y: number

Defined in: packages/prismarine/src/content/world/adapter.ts:61

z ​

readonly z: number

Defined in: packages/prismarine/src/content/world/adapter.ts:62


ContentSoundOptions ​

Defined in: packages/prismarine/src/content/world/adapter.ts:314

How a content sound plays: a block family's options, and the entity it follows.

Extends ​

Properties ​

follows? ​

readonly optional follows?: string

Defined in: packages/prismarine/src/content/world/adapter.ts:319

The runtime id of the entity the sound comes from and follows, as a decimal string, which a Java client tracking the entity is told it by.

pitch? ​

readonly optional pitch?: number

Defined in: packages/block-behaviors/src/world.ts:249

A multiplier on the sound's pitch; 1 when absent.

Inherited from ​

SoundOptions.pitch

source? ​

readonly optional source?: string

Defined in: packages/block-behaviors/src/world.ts:257

The runtime id of the player whose click made the sound, as WorldActions.playBlockSound takes it. Java's block classes play such a sound with Level.playSound(player, ...), which leaves that player out because a Java client plays the sound of its own click itself.

Java See ​

Level.playSound(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/core/BlockPos;Lnet/minecraft/sounds/SoundEvent;Lnet/minecraft/sounds/SoundSource;FF)V

Inherited from ​

SoundOptions.source

volume? ​

readonly optional volume?: number

Defined in: packages/block-behaviors/src/world.ts:247

A multiplier on the sound's volume; 1 when absent.

Inherited from ​

SoundOptions.volume


ContentSpawnAccess ​

Defined in: packages/prismarine/src/content/world/adapter.ts:515

The facts a spawn rule asks for that nothing else does.

Methods ​

mobEventActive() ​

mobEventActive(event): boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:521

Whether a named mob event, such as minecraft:pillager_patrols_event, is running.

Parameters ​
event ​

string

Returns ​

boolean

poolCount() ​

poolCount(pool): number

Defined in: packages/prismarine/src/content/world/adapter.ts:519

How many entities of one population pool stand in the spawn region now.

Parameters ​
pool ​

string

Returns ​

number

site() ​

site(flag, at): boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:517

A boolean fact about one position, named by the spawn rule component that reads it.

Parameters ​
flag ​

"lava" | "bubble_column" | "surface" | "underground" | "underwater" | "snow_covered"

at ​

ContentPosition

Returns ​

boolean

structureSpawnOverrideAt()? ​

optional structureSpawnOverrideAt(identifier, at): boolean | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:528

Whether Java reserves this entity type for a structure spawn override at one position.

Parameters ​
identifier ​

string

at ​

ContentPosition

Returns ​

boolean | undefined

villageBorderDistance()? ​

optional villageBorderDistance(at): number | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:526

How far a position is from the nearest village border, negative inside it and undefined when no village is near.

Parameters ​
at ​

ContentPosition

Returns ​

number | undefined


ContentTickScheduler ​

Defined in: packages/prismarine/src/content/world/adapter.ts:350

The two scheduled tick lists, block and fluid.

Methods ​

isScheduled() ​

isScheduled(kind, at, type): boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:359

Whether a tick is already queued for this position and type.

Parameters ​
kind ​

TickKind

at ​

ContentPosition

type ​

string

Returns ​

boolean

runsThisTick() ​

runsThisTick(kind, at, type): boolean

Defined in: packages/prismarine/src/content/world/adapter.ts:361

Whether a queued tick is in the batch the current game tick will run.

Parameters ​
kind ​

TickKind

at ​

ContentPosition

type ​

string

Returns ​

boolean

schedule() ​

schedule(kind, at, type, delay, priority?): void

Defined in: packages/prismarine/src/content/world/adapter.ts:357

Schedules a tick, ignored when one is already queued for the same position and type.

Parameters ​
kind ​

TickKind

at ​

ContentPosition

type ​

string

delay ​

number

Game ticks from now, at least 1.

priority? ​

number

Java's TickPriority, -3 through 3, defaulting to 0.

Returns ​

void


RandomSource ​

Defined in: packages/predicates/src/random.ts:8

The only source of randomness the evaluator uses. Injecting it is what makes a loot roll, a random_chance check or a uniform provider reproducible in a test.

Methods ​

nextFloat() ​

nextFloat(): number

Defined in: packages/predicates/src/random.ts:10

Returns a float in the half-open interval [0, 1).

Returns ​

number

nextInt() ​

nextInt(bound): number

Defined in: packages/predicates/src/random.ts:12

Returns an integer in the half-open interval [0, bound).

Parameters ​
bound ​

number

Returns ​

number


ServerWorldAdapter ​

Defined in: packages/prismarine/src/content/world/adapter.ts:561

Everything the content packages do to one dimension.

The six required groups are the facts and effects more than one package asks for. The five optional groups each serve exactly one package and are left out until their owning subsystem supplies them; see CONTENT_AREAS for who owns which.

Properties ​

ai? ​

readonly optional ai?: ContentAiAccess

Defined in: packages/prismarine/src/content/world/adapter.ts:574

Owned by the entities subsystem.

blocks ​

readonly blocks: ContentBlockAccess

Defined in: packages/prismarine/src/content/world/adapter.ts:563

commands? ​

readonly optional commands?: CommandHost

Defined in: packages/prismarine/src/content/world/adapter.ts:587

Owned by the command subsystem; see serverCommandHost.

The real interface rather than a structural stand-in: this package takes the dependency now that the command layer is wired. Nothing projects the group yet, so no content behavior can run a command - which is the one direction the command layer deliberately does not open until a behavior asks for it.

effects ​

readonly effects: ContentEffectSink

Defined in: packages/prismarine/src/content/world/adapter.ts:565

entities ​

readonly entities: ContentEntityAccess

Defined in: packages/prismarine/src/content/world/adapter.ts:564

generation? ​

readonly optional generation?: ContentGenerationAccess

Defined in: packages/prismarine/src/content/world/adapter.ts:576

Owned by the world subsystem.

items? ​

readonly optional items?: ContentItemAccess

Defined in: packages/prismarine/src/content/world/adapter.ts:570

Owned by the blocks and items subsystem.

level ​

readonly level: ContentLevelFacts

Defined in: packages/prismarine/src/content/world/adapter.ts:562

random ​

readonly random: RandomSource

Defined in: packages/prismarine/src/content/world/adapter.ts:568

Where every chance a content package rolls comes from, so a test can seed it.

spawning? ​

readonly optional spawning?: ContentSpawnAccess

Defined in: packages/prismarine/src/content/world/adapter.ts:572

Owned by the entities subsystem.

ticks ​

readonly ticks: ContentTickScheduler

Defined in: packages/prismarine/src/content/world/adapter.ts:566


ServerWorldSource ​

Defined in: packages/prismarine/src/content/world/adapter.ts:597

The dimensions the content packages can reach.

A behavior resolves the dimension of the thing it acts on once per event, so the one portal family that looks at the other side can, without every other family paying for a dimension argument.

Extended by ​

Methods ​

at() ​

at(dimension, level?): ServerWorldAdapter

Defined in: packages/prismarine/src/content/world/adapter.ts:603

The adapter for one dimension, such as minecraft:overworld.

Parameters ​
dimension ​

string

level? ​

string

The level's name, for a world of a level other than the default. A source with one level ignores it.

Returns ​

ServerWorldAdapter

goalWorld()? ​

optional goalWorld(entity): GoalWorld | undefined

Defined in: packages/prismarine/src/content/world/adapter.ts:609

Resolves a goal world from the runtime that owns this entity, when the source can see every dimension. This avoids binding entities in secondary dimensions to at()'s default adapter.

Parameters ​
entity ​

EntityInstance

Returns ​

GoalWorld | undefined

Type Aliases ​

BlockProperties ​

BlockProperties = Parameters<typeof create>[0]

Defined in: packages/block-behaviors/src/world.ts:162

The per-state facts the overlay's jsprismarine:block_properties component carries, derived from the component factory that declares them so the field names and the push_reaction domain have one source.


ContentBlockSound ​

ContentBlockSound = BlockSound | BlockSound

Defined in: packages/prismarine/src/content/world/adapter.ts:311

A sound of a block's own material, which an item or a block family asks for by its event.


ContentItemDrop ​

ContentItemDrop = ItemDrop

Defined in: packages/prismarine/src/content/world/adapter.ts:107

An item stack leaving a block or an entity.

@jsprismarine/block-behaviors's own drop, rather than a second declaration of it. The two were separate copies of { identifier, count }, and widening one without the other would have dropped a stack's enchantments at whichever seam still held the narrow copy.


Difficulty ​

Difficulty = typeof DIFFICULTIES[number]

Defined in: packages/engine-systems/src/world.ts:142

One of DIFFICULTIES.


TickKind ​

TickKind = "block" | "fluid"

Defined in: packages/engine-systems/src/world.ts:151

Which of the two Java tick lists a scheduled tick belongs to.


Weather ​

Weather = typeof WEATHER[number]

Defined in: packages/engine-systems/src/world.ts:148

One of WEATHER.

Functions ​

singleDimension() ​

singleDimension(adapter): ServerWorldSource

Defined in: packages/prismarine/src/content/world/adapter.ts:613

Presents one adapter as a ServerWorldSource with a single dimension.

Parameters ​

adapter ​

ServerWorldAdapter

Returns ​

ServerWorldSource