API reference / @jsprismarine/prismarine / world/World
world/World
Classes
Interfaces
AudienceOptions
Defined in: prismarine/src/world/World.ts:521
How a broadcast narrows its audience beyond "everyone who can see the place".
Properties
exclude?
optionalexclude?:Pick<ShownActor,"getRuntimeId"> | readonlyPick<ShownActor,"getRuntimeId">[]
Defined in: prismarine/src/world/World.ts:533
Recipients left out whatever the geometry says, usually whoever caused the event, matched by entity id.
radius?
optionalradius?:number
Defined in: prismarine/src/world/World.ts:528
A cap in blocks, tighter than the recipient's view distance.
For things that should not carry as far as a client can see - a block breaking is audible for about sixteen blocks, not for a hundred and sixty.
BlockBreaker
Defined in: prismarine/src/world/World.ts:516
The player who broke a block, as World.breakBlock reads one: the break's three reads and its id.
Extends
Breaker
Properties
gamemode
readonlygamemode:number
Defined in: prismarine/src/world/blockBreak.ts:80
The mode they are in, because creative takes a block away and leaves nothing behind.
Inherited from
Breaker.gamemode
Methods
getInventory()
getInventory():
object
Defined in: prismarine/src/world/blockBreak.ts:81
Returns
object
getItemInHand()
getItemInHand():
Item
Returns
Item
Inherited from
Breaker.getInventory
getPosition()
getPosition():
object
Defined in: prismarine/src/world/blockBreak.ts:82
Returns
object
getX()
getX():
number
Returns
number
getY()
getY():
number
Returns
number
getZ()
getZ():
number
Returns
number
Inherited from
Breaker.getPosition
getRuntimeId()
getRuntimeId():
bigint
Defined in: prismarine/src/world/World.ts:517
Returns
bigint
LevelData
Defined in: prismarine/src/config/JsonConfigTypes.ts:298
Legacy shape imported once from older worlds' level.json files.
Title
JSPrismarine world level data
Deprecated
World state is stored by the world provider.
Properties
entities?
optionalentities?:object[]
Defined in: prismarine/src/config/JsonConfigTypes.ts:308
position
position:
object
position.headYaw?
optionalheadYaw?:number
position.pitch?
optionalpitch?:number
position.x
x:
number
position.y
y:
number
position.yaw?
optionalyaw?:number
position.z
z:
number
type
type:
string
gameRules?
optionalgameRules?: [string, [number|boolean,boolean]][]
Defined in: prismarine/src/config/JsonConfigTypes.ts:300
spawn?
optionalspawn?:object
Defined in: prismarine/src/config/JsonConfigTypes.ts:299
x
x:
number
y
y:
number
z
z:
number
weather?
optionalweather?:unknown
Defined in: prismarine/src/config/JsonConfigTypes.ts:307
Java's WeatherData: the three counters and the two flags.
Unknown rather than a record type, because what is in the file is whatever was last written there; savedWeatherOf is the check that turns it into a record.
StoredPlayerAttribute
Defined in: prismarine/src/config/JsonConfigTypes.ts:432
The live definition and value of one player attribute at save time.
Properties
base
readonlybase:number
Defined in: prismarine/src/config/JsonConfigTypes.ts:435
current
readonlycurrent:number
Defined in: prismarine/src/config/JsonConfigTypes.ts:436
max
readonlymax:number
Defined in: prismarine/src/config/JsonConfigTypes.ts:434
min
readonlymin:number
Defined in: prismarine/src/config/JsonConfigTypes.ts:433
WorldData
Defined in: prismarine/src/world/World.ts:469
Properties
blockTickHandlers?
optionalblockTickHandlers?:Readonly<Record<string, (at) =>void>>
Defined in: prismarine/src/world/World.ts:510
What to run when a scheduled block tick lands on a block, keyed by block identifier.
Migrated content hooks answer before the engine fallback. Ticks still owned by the engine stay on that path. Left out, every scheduled tick goes straight to the engine.
completionQueue?
optionalcompletionQueue?:ChunkCompletionScheduler
Defined in: prismarine/src/world/World.ts:483
Shared ticker queue for lighting chunks that are still background work.
config?
optionalconfig?:Partial<WorldData>
Defined in: prismarine/src/world/World.ts:484
dimension?
optionaldimension?:DimensionType
Defined in: prismarine/src/world/World.ts:486
Defaults to the level's resolved type for the stem, or the Overworld when it has none.
generator
generator:
Generator
Defined in: prismarine/src/world/World.ts:481
The generator the level's factories built for WorldData.stem.
level
level:
Level
Defined in: prismarine/src/world/World.ts:477
The level this world is one dimension of, which owns the provider, the seed, the clock, the game rules, the weather, the spawn and the player records.
name
name:
string
Defined in: prismarine/src/world/World.ts:470
path
path:
string
Defined in: prismarine/src/world/World.ts:471
randomTickHandlers?
optionalrandomTickHandlers?:Readonly<Record<string, (at,block) =>void>>
Defined in: prismarine/src/world/World.ts:503
What to run when a random tick lands on a block, keyed by block identifier.
The world draws the positions and @jsprismarine/engine-systems filters them; what a crop, a fire or a melting block then does is the behavior families' business, so it arrives from outside. Left out, the draws still happen and nothing answers them.
redstoneUpdateHandlers?
optionalredstoneUpdateHandlers?:ContentRedstoneUpdateHandlers
Defined in: prismarine/src/world/World.ts:512
Content redstone hooks and their power cache lifecycle.
server
server:
Server
Defined in: prismarine/src/world/World.ts:472
startRegion?
optionalstartRegion?:"deferred"|"prepared"
Defined in: prismarine/src/world/World.ts:495
Whether World.enable settles the spawn and generates the chunks around it.
prepared, the default, is for a world built as its level opens: the first player arrives into generated terrain. deferred is for a world the level builds on its first visit, from inside a server tick: enabling does neither, the travel path loads the chunks the arrival needs, and a spawn is searched for only if something asks for one.
stem
stem:
LevelStem
Defined in: prismarine/src/world/World.ts:479
The stem this world was built from: its dimension type and its generator definition.
WorldPlayerData
Defined in: prismarine/src/config/JsonConfigTypes.ts:325
Player state saved by a world provider, or in a JSON fallback file.
Title
JSPrismarine fallback player data
Properties
advancements?
optionaladvancements?:Readonly<Record<string,AdvancementProgressJson>>
Defined in: prismarine/src/config/JsonConfigTypes.ts:357
Advancement progress: advancement id to the criteria the player has completed, each with the instant it was granted.
Stored here rather than in a file of its own so that whatever a provider does with player data - the LevelDB provider writes a player_server_ record, the file provider a JSON file - carries the progress with it.
attributes?
optionalattributes?:Readonly<Record<string,StoredPlayerAttribute>>
Defined in: prismarine/src/config/JsonConfigTypes.ts:395
Every live attribute, keyed by its namespaced identifier.
Keeping the definition beside the value lets the player record preserve attributes added by content without teaching the provider a new field for each one.
dimension?
optionaldimension?:string
Defined in: prismarine/src/config/JsonConfigTypes.ts:348
The Java id of the dimension the player was in, such as minecraft:the_nether.
The LevelDB provider also writes it as Bedrock's DimensionId integer. Absent on a record written before this field existed, which reads as the Overworld.
enchantmentSeed?
optionalenchantmentSeed?:number
Defined in: prismarine/src/config/JsonConfigTypes.ts:366
The player's enchantment seed.
Java drives all three rows of an enchanting table from one generator seeded with this, which is what keeps the rows still while a player puts an item in and takes it out again. Kept across a login for the same reason: a table that redrew on every join would be a different table.
experience?
optionalexperience?:object
Defined in: prismarine/src/config/JsonConfigTypes.ts:385
Experience, as the two numbers Bedrock carries: whole levels, and how far along the current level the bar is.
level
level:
number
progress
progress:
number
flying?
optionalflying?:boolean
Defined in: prismarine/src/config/JsonConfigTypes.ts:333
Whether the player was flying when this record was saved.
food?
optionalfood?:number
Defined in: prismarine/src/config/JsonConfigTypes.ts:378
The food bar, out of twenty.
gamemode
gamemode:
string
Defined in: prismarine/src/config/JsonConfigTypes.ts:331
The saved game mode, normally Survival, Creative, Adventure, or Spectator.
health?
optionalhealth?:number
Defined in: prismarine/src/config/JsonConfigTypes.ts:376
Half-hearts, out of the player's maximum.
inventory?
optionalinventory?:StoredInventory
Defined in: prismarine/src/config/JsonConfigTypes.ts:374
Everything the player was carrying: the 36 main slots, the hand slot, the four armor slots, the off hand and the 27 ender chest slots.
Absent until this was written, so a logout threw away every item a player held along with its durability, its name and its enchantments.
portalCooldown?
optionalportalCooldown?:number
Defined in: prismarine/src/config/JsonConfigTypes.ts:412
Ticks left before the player may enter a portal again, Bedrock's PortalCooldown.
Set when a player changes dimension, so logging out inside the arrival portal and back in does not send them straight back. Absent on a record written before this field existed, which reads as no cooldown.
position
position:
object
Defined in: prismarine/src/config/JsonConfigTypes.ts:334
headYaw
headYaw:
number
pitch
pitch:
number
x
x:
number
y
y:
number
yaw
yaw:
number
z
z:
number
saturation?
optionalsaturation?:number
Defined in: prismarine/src/config/JsonConfigTypes.ts:380
The hidden buffer that is spent before food is.
savedAt?
optionalsavedAt?:number
Defined in: prismarine/src/config/JsonConfigTypes.ts:428
When this record was written, in milliseconds since the epoch.
Written so a tool or a later migration can tell two copies of a record apart. Absent on a record written before this field existed. Which world a returning player lands in is dimension's job: see import('../world/PlayerRecords').lastPlayerRecord.
seenCredits?
optionalseenCredits?:boolean
Defined in: prismarine/src/config/JsonConfigTypes.ts:420
Whether this player has watched the end credits, Bedrock's HasSeenCredits.
Set when the credits start rolling on a first exit through the End's portal, so a later exit transfers at once. Absent on a record written before this field existed, which reads as not seen.
spawn?
optionalspawn?:StoredSpawnPoint
Defined in: prismarine/src/config/JsonConfigTypes.ts:404
Where this player comes back after a death, or absent for the world spawn.
Nothing modeled one before this: every respawn answered with the world spawn, which is also why /spawnpoint was left out of the command registry. See import('../world/RespawnPoint').resolveRespawn for when a stored point stops being used.
username?
optionalusername?:string
Defined in: prismarine/src/config/JsonConfigTypes.ts:329
Written for the same reason as uuid.
uuid?
optionaluuid?:string
Defined in: prismarine/src/config/JsonConfigTypes.ts:327
Written so the file says who it belongs to; the file is found by key, not by this.
Type Aliases
WorldConfig
WorldConfig =
Partial<WorldData>
Defined in: prismarine/src/config/JsonConfigTypes.ts:89
The subset of world settings read by a generator or provider.
Variables
SIMULATION_DISTANCE
constSIMULATION_DISTANCE:10=10
Defined in: prismarine/src/world/World.ts:241
How far from a player the world simulates, in chunks.
Java Edition's simulation-distance default, and a separate thing from how far a client is sent chunks: a player sees terrain they are not simulating. A chunk outside every player's radius stays in memory and stays still, which is Java's own rule and the reason an empty server costs nothing to run.
Functions
structureNameMatches()
structureNameMatches(
name,structure):boolean
Defined in: prismarine/src/world/World.ts:197
Whether a structure identifier is what a player meant by a name.
Bedrock's /locate structure names a family - village, ruinedportal - where Java has one identifier per variant, so an exact comparison would find none of them. Three spellings are accepted, from most to least specific: the full identifier, the path on its own, and the path with a variant suffix, which is what makes village find minecraft:village_plains.
Underscores are dropped from the comparison so Bedrock's ruinedportal reaches Java's ruined_portal.
Parameters
name
string
What the player typed.
structure
string
A structure identifier the generator knows.
Returns
boolean