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?
readonlyoptionaldrops?: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?
readonlyoptionalcapacity?:number
Defined in: packages/block-behaviors/src/world.ts:106
How many slots the container has, which the comparator divides by.
items?
readonlyoptionalitems?: readonly (ItemDrop|undefined)[]
Defined in: packages/block-behaviors/src/world.ts:104
One entry per slot, undefined for an empty one.
pistonArm?
readonlyoptionalpistonArm?:object
Defined in: packages/block-behaviors/src/world.ts:112
Bedrock's piston-arm state, stored as native PistonArm block-entity tags.
lastProgress
readonlylastProgress:number
Previous extension progress, 0 when retracted and 1 when extended.
newState
readonlynewState:number
Bedrock piston state the arm is moving toward.
progress
readonlyprogress:number
Current extension progress, 0 when retracted and 1 when extended.
state
readonlystate:number
Bedrock piston state used to draw the arm.
sticky
readonlysticky:boolean
Whether the piston is sticky.
sealed?
readonlyoptionalsealed?:boolean
Defined in: packages/block-behaviors/src/world.ts:110
True once wax or a similar seal makes the block entity read-only.
text?
readonlyoptionaltext?: readonlystring[]
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
Returns
brainWorld()
brainWorld():
BrainWorld
Defined in: packages/prismarine/src/content/world/adapter.ts:538
The level the twenty Java brain mobs read.
Returns
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
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
readonlyidentifier:string
Defined in: packages/prismarine/src/content/world/adapter.ts:68
The namespaced Bedrock block identifier, such as minecraft:oak_stairs.
states
readonlystates: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
Returns
string | undefined
biomeTags()
biomeTags(
at): readonlystring[]
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
Returns
readonly string[]
blockChunkAt()?
optionalblockChunkAt(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
Returns
ContentBlockChunk | undefined
blockChunkIdentityAt()?
optionalblockChunkIdentityAt(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
Returns
object | undefined
blockChunkRevisionAt()?
optionalblockChunkRevisionAt(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
Returns
number | undefined
blockLight()?
optionalblockLight(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
Returns
number
blockRevision()?
optionalblockRevision():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
Returns
BlockEntityData | undefined
destroy()?
optionaldestroy(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
The block to destroy.
options?
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()?
optionaldirectSignal(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
directionToSource
"south" | "west" | "north" | "east" | "down" | "up"
Returns
number
executeEntityEvent()?
optionalexecuteEntityEvent(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
entity
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
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
Returns
boolean
isRedstoneConductor()?
optionalisRedstoneConductor(at):boolean
Defined in: packages/prismarine/src/content/world/adapter.ts:228
Whether a block carries redstone power through its direct signal.
Parameters
at
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
Returns
number
lightningRodNear()?
optionallightningRodNear(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
radius
number
Returns
ContentPosition | undefined
Java See
ServerLevel.findLightningRod
lightReady()?
optionallightReady(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()?
optionalliquid(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
Returns
ContentBlock | undefined
motionBlockingY()?
optionalmotionBlockingY(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()?
optionalmove(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
to
Returns
void
notifyNeighbor()?
optionalnotifyNeighbor(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
from
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
previous?
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
Returns
number
powerToWire()?
optionalpowerToWire(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
Returns
number
runtimeIdAt()?
optionalruntimeIdAt(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
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
block
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?
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
data
Returns
void
setLiquid()?
optionalsetLiquid(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
liquid
ContentBlock | undefined
Returns
void
signal()?
optionalsignal(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
directionToSource
"south" | "west" | "north" | "east" | "down" | "up"
Returns
number
skyLight()?
optionalskyLight(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
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()?
optionalupdateNeighborForOutputSignal(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
Returns
void
Java See
Level.updateNeighbourForOutputSignal
updateShape()?
optionalupdateShape(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
Returns
void
wireShape()?
optionalwireShape(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
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
sourceId?
number
Returns
void
playBlockSound()?
optionalplayBlockSound(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
sound
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()?
optionalplayRecord(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
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
sound
string
options?
Returns
void
redstoneActivated()?
optionalredstoneActivated(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
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
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?
readonlyoptionalcreative?:boolean
Defined in: packages/prismarine/src/content/world/adapter.ts:84
Whether this player is in creative mode; absent for non-players.
id
readonlyid:number
Defined in: packages/prismarine/src/content/world/adapter.ts:76
The runtime id, unique for the length of the session.
identifier
readonlyidentifier:string
Defined in: packages/prismarine/src/content/world/adapter.ts:78
The namespaced entity identifier, such as minecraft:zombie.
pitch?
readonlyoptionalpitch?: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
readonlyposition: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?
readonlyoptionalspectator?:boolean
Defined in: packages/prismarine/src/content/world/adapter.ts:86
Whether this player is in spectator mode; absent for non-players.
tags?
readonlyoptionaltags?: readonlystring[]
Defined in: packages/prismarine/src/content/world/adapter.ts:82
Dynamic string tags used by entity filters such as has_tag.
timeSinceRest?
readonlyoptionaltimeSinceRest?: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?
readonlyoptionalyaw?: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): readonlyContentEntity[]
Defined in: packages/prismarine/src/content/world/adapter.ts:270
Every entity whose position is inside the block at a position.
Parameters
position
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
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
item
Returns
void
minecartContents()?
optionalminecartContents(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()?
optionalmove(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
Returns
void
near()
near(
center,radius): readonlyContentEntity[]
Defined in: packages/prismarine/src/content/world/adapter.ts:272
Every entity within a radius of a position, nearest first.
Parameters
center
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()?
optionalringBell(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
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
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?
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
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()?
optionalboostMount(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
item
string
Returns
boolean
canDyeEntity()?
optionalcanDyeEntity(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
color
string
Returns
boolean
canNameEntity()?
optionalcanNameEntity(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
Returns
boolean
effectsOf()
effectsOf(
potion): readonlyEffectApplication[]
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()?
optionalentityFits(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
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
eyesInEntity()?
optionaleyesInEntity(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
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()?
optionalhangPainting(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
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
member
string
Returns
boolean
instrumentSound()?
optionalinstrumentSound(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()?
optionallocate(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
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
Returns
void
placeEndCrystal()?
optionalplaceEndCrystal(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
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
Returns
supports()?
optionalsupports(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
Returns
ItemSource | undefined
tieLeashes()?
optionaltieLeashes(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
fence
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()?
optionalviewHit(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
fluid
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?
readonlyoptionalambientLight?:number
Defined in: packages/prismarine/src/content/world/adapter.ts:387
The dimension's minimum ambient brightness, from its Java ambient_light value.
attributes?
readonlyoptionalattributes?: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
readonlydimension:string
Defined in: packages/prismarine/src/content/world/adapter.ts:367
The namespaced dimension identifier, such as minecraft:overworld.
hasFixedTime?
readonlyoptionalhasFixedTime?: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
readonlyhasSkyLight:boolean
Defined in: packages/prismarine/src/content/world/adapter.ts:373
Whether the dimension has sky light, which the nether does not.
javaDataVersion?
readonlyoptionaljavaDataVersion?: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
readonlymaxY: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
readonlyminY:number
Defined in: packages/prismarine/src/content/world/adapter.ts:369
The lowest block y, inclusive. The overworld is -64.
seaLevel
readonlyseaLevel: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
readonlyseed:bigint
Defined in: packages/prismarine/src/content/world/adapter.ts:398
The world seed.
skyLightFactor?
readonlyoptionalskyLightFactor?:number
Defined in: packages/prismarine/src/content/world/adapter.ts:389
The visual contribution of sky light, when the dimension type defines one.
waterEvaporates?
readonlyoptionalwaterEvaporates?: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()?
optionalfluidReplacement():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
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()?
optionalinhabitedTime(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
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
Returns
boolean
runCommand()?
optionalrunCommand(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
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
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
readonlyx:number
Defined in: packages/prismarine/src/content/world/adapter.ts:60
y
readonlyy:number
Defined in: packages/prismarine/src/content/world/adapter.ts:61
z
readonlyz: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?
readonlyoptionalfollows?: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?
readonlyoptionalpitch?:number
Defined in: packages/block-behaviors/src/world.ts:249
A multiplier on the sound's pitch; 1 when absent.
Inherited from
source?
readonlyoptionalsource?: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
volume?
readonlyoptionalvolume?:number
Defined in: packages/block-behaviors/src/world.ts:247
A multiplier on the sound's volume; 1 when absent.
Inherited from
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
Returns
boolean
structureSpawnOverrideAt()?
optionalstructureSpawnOverrideAt(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
Returns
boolean | undefined
villageBorderDistance()?
optionalvillageBorderDistance(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
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
at
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
at
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
at
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?
readonlyoptionalai?:ContentAiAccess
Defined in: packages/prismarine/src/content/world/adapter.ts:574
Owned by the entities subsystem.
blocks
readonlyblocks:ContentBlockAccess
Defined in: packages/prismarine/src/content/world/adapter.ts:563
commands?
readonlyoptionalcommands?: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
readonlyeffects:ContentEffectSink
Defined in: packages/prismarine/src/content/world/adapter.ts:565
entities
readonlyentities:ContentEntityAccess
Defined in: packages/prismarine/src/content/world/adapter.ts:564
generation?
readonlyoptionalgeneration?:ContentGenerationAccess
Defined in: packages/prismarine/src/content/world/adapter.ts:576
Owned by the world subsystem.
items?
readonlyoptionalitems?:ContentItemAccess
Defined in: packages/prismarine/src/content/world/adapter.ts:570
Owned by the blocks and items subsystem.
level
readonlylevel:ContentLevelFacts
Defined in: packages/prismarine/src/content/world/adapter.ts:562
random
readonlyrandom: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?
readonlyoptionalspawning?:ContentSpawnAccess
Defined in: packages/prismarine/src/content/world/adapter.ts:572
Owned by the entities subsystem.
ticks
readonlyticks: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
goalWorld()?
optionalgoalWorld(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
Returns
GoalWorld | undefined
Type Aliases
BlockProperties
BlockProperties =
Parameters<typeofcreate>[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.