API reference / @jsprismarine/prismarine / world/changelog/ChangeEntry
world/changelog/ChangeEntry
Interfaces
FieldKinds
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:28
Every kind of field a field entry can change, by name.
Adding a field kind is adding a member here and a coalescing key in FIELD_KEYS below. The log, spans, inversion and the reader handle every kind the same way, so none of them changes.
Properties
block
block:
FieldKindShape<{layer:number;x:number;y:number;z:number; },number>
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:32
The block at a position, on one storage layer, as a block runtime id.
block-entity
block-entity:
FieldKindShape<{field:string;x:number;y:number;z:number; },PlainData>
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:42
One field of the block entity at a position.
block-update
block-update:
FieldKindShape<{x:number;y:number;z:number; },number|null>
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:51
A position waiting for a block update, as the tick it comes due, or nothing. The queue runs in the order positions were first queued, which a reader that applies the entries in order keeps.
entity
entity:
FieldKindShape<{entity:bigint;field:string; },PlainData>
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:30
One field of one entity, such as position or health.
inventory-slot
inventory-slot:
FieldKindShape<{container:string;entity:bigint;slot:number; },PlainRecord|null>
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:37
One slot of one of an entity's containers, holding an item's saved form or nothing.
scheduled-tick
scheduled-tick:
FieldKindShape<{list:"block"|"fluid";type:string;x:number;y:number;z:number; }, {priority:number;subTickOrder:number;triggerTick:number; } |null>
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:56
A scheduled block or fluid tick, addressed by its list, its position and the block or fluid it runs for, holding its timing, or nothing.
OccurrenceKinds
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:152
Every kind of one-shot occurrence, by name, with its data.
An occurrence changes no state. It is in the log because replication has to send it and nothing in the state afterwards would show it happened. Adding a kind is adding a member here. Replication owns what each kind carries and extends these when it reads them.
Properties
action-rejected
action-rejected:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:391
A staged action that a guard vetoed, which is all the log holds of it (ADR 0013).
action
readonlyaction:string
entity
readonlyentity:bigint
guard
readonlyguard:string
actor-event
actor-event:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:154
An actor event on one entity, such as being hurt, dying or eating.
data
readonlydata:number
entity
readonlyentity:bigint
event
readonlyevent:ActorEvent
item?
readonlyoptionalitem?:string
An item identifier whose runtime id in each viewer's protocol goes out as the data, for the events that carry an item, such as FEED. Item ids differ between protocols.
actor-sound
actor-sound:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:289
An entity made a noise, such as being hit or swinging at something, where it stood.
entity
readonlyentity:bigint
sound
readonlysound:LevelSoundEvent
type
readonlytype:string
The entity's type, which tells a client whose sound to play.
x
readonlyx:number
y
readonlyy:number
z
readonlyz:number
animate
animate:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:219
An entity's animation, such as swinging an arm.
action
readonlyaction:number
data
readonlydata:number
What the action carries, zero for the ones that carry nothing.
entity
readonlyentity:bigint
swingSource
readonlyswingSource:string|null
What caused a swing, by name, or null.
block-event
block-event:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:281
A block-defined event, such as a chest lid opening, whose type and value the block reads.
type
readonlytype:number
value
readonlyvalue:number
x
readonlyx:number
y
readonlyy:number
z
readonlyz:number
block-shown
block-shown:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:340
Clients are told what stands at a position although it did not change, such as for a client that drew a placement the server refused. It carries the block runtime id it shows, since replication keeps no copy of the blocks.
block
readonlyblock:number
x
readonlyx:number
y
readonlyy:number
z
readonlyz:number
block-sound
block-sound:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:231
A block made a noise, such as a hit while it is mined. The position is the block's, and replication centers the sound in it.
block
readonlyblock:number
The runtime id of the block that made it.
except
readonlyexcept:bigint|null
A player whose own client already plays it, or null when everybody near hears it.
madeBy
readonlymadeBy:bigint|null
The player whose action made it, such as the one who placed the block, or null for none. A client of an edition that plays its own player's sound of that kind leaves it out.
sound
readonlysound:LevelSoundEvent
x
readonlyx:number
y
readonlyy:number
z
readonlyz:number
critical
critical:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:183
An attacker landed a critical hit, which bursts in stars around the target, or a blow its weapon's enchantments added damage to, which Java bursts in magic stars.
attacker
readonlyattacker:bigint
critical
readonlycritical:boolean
Whether the blow was a critical hit.
magic
readonlymagic:boolean
Whether the weapon's enchantments added damage.
target
readonlytarget:bigint
x
readonlyx:number
Where the target stood.
y
readonlyy:number
z
readonlyz:number
death
death:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:217
A step of an entity's death, which each edition shows its own way: see DeathStage.
entity
readonlyentity:bigint
stage
readonlystage:DeathStage
emote
emote:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:377
An entity's emote.
emote
readonlyemote:string
The emote piece's uuid.
entity
readonlyentity:bigint
flags
readonlyflags:number
lengthTicks
readonlylengthTicks:number
platformId
readonlyplatformId:string
xuid
readonlyxuid:string
The account the emote belongs to, as the server knows it.
explosion
explosion:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:206
An explosion went off, which clients near it draw.
blockCount
readonlyblockCount:number
How many blocks it broke.
large
readonlylarge:boolean
Whether it is the large kind: one that breaks blocks, with a radius of 2 or more.
radius
readonlyradius:number
x
readonlyx:number
y
readonlyy:number
z
readonlyz:number
hurt
hurt:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:168
An entity took a blow that hurt it: it flashes and plays its hurt sound, and a player's camera tilts toward the blow.
cause
readonlycause:bigint|null
The entity answerable for the blow, or null.
damageType
readonlydamageType:string
The Java damage type the blow stands for, such as minecraft:player_attack.
direct
readonlydirect:bigint|null
What landed the blow, or null.
entity
readonlyentity:bigint
yaw
readonlyyaw:number
Which way the blow came from, in degrees from where the entity faces.
impulse
impulse:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:324
An impulse aimed at a body whose client owns its movement, such as a blow's knockback on a player: the server cannot move that body, so the client is asked to (ADR 0008).
entity
readonlyentity:bigint
x
readonlyx:number
y
readonlyy:number
z
readonlyz:number
named-particle
named-particle:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:265
A particle effect by its identifier, such as minecraft:crop_growth_emitter, at a point.
name
readonlyname:string
x
readonlyx:number
y
readonlyy:number
z
readonlyz:number
named-sound
named-sound:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:248
A sound by its client definition's name, such as random.chestopen, at a point.
follows?
readonlyoptionalfollows?:bigint
The entity it comes from and follows as it moves, which a Java client tracking it is told.
madeBy
readonlymadeBy:bigint|null
The player whose click made it, whose Java client plays it itself, or null.
name
readonlyname:string
pitch
readonlypitch:number
A multiplier on the definition's pitch.
radius?
readonlyoptionalradius?:number
How far away, in blocks, players are sent it, when not the usual sound radius.
volume
readonlyvolume:number
A multiplier on the definition's volume.
x
readonlyx:number
y
readonlyy:number
z
readonlyz:number
needs-sync
needs-sync:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:334
A body the server moves itself changed course sharply: a jump, a knockback or a push added to its velocity, or a dropped stack landing. Replication sends such an entity's movement on that tick rather than at its next update interval, as Java's Entity.needsSync makes ServerEntity.sendChanges do.
entity
readonlyentity:bigint
Java See
Entity.needsSync
Java See
ServerEntity.sendChanges
relayed-sound
relayed-sound:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:302
A sound a client reported making, passed on to the players near it with the fields the client sent.
actor
readonlyactor:bigint
The entity the sound belongs to, or -1 for none.
baby
readonlybaby:boolean
data
readonlydata:number
firedAt
readonlyfiredAt: {x:number;y:number;z:number; } |null
Where a projectile sound was fired from, or null.
global
readonlyglobal:boolean
sender
readonlysender:bigint
The player whose client made it, which already played it.
sound
readonlysound:number
The sound, or -1 for a name outside the server's enum.
type
readonlytype:string
x
readonlyx:number
y
readonlyy:number
z
readonlyz:number
slot-shown
slot-shown:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:351
A player's client is told what one of its own slots holds although no write is logged for it: the slot's write was undone, and the stack written back carries a new network id, which the client has to learn before it can name the stack in a request.
container
readonlycontainer:string
The container, as an inventory-slot entry names it.
entity
readonlyentity:bigint
The player that carries the slot.
slot
readonlyslot:number
status-effect
status-effect:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:363
One of an entity's status effects was added, changed or taken off. The entity's statusEffects field carries the whole list, and this says which effect changed and how, which is what clients are sent.
change
readonlychange:"add"|"remove"|"update"
effect
readonlyeffect:object
The effect as it now is, or as it was for one taken off.
effect.ambient
readonlyambient:boolean
effect.amplifier
readonlyamplifier:number
effect.durationTicks
readonlydurationTicks:number
effect.id
readonlyid:string
effect.showIcon
readonlyshowIcon:boolean
effect.showParticles
readonlyshowParticles:boolean
entity
readonlyentity:bigint
transient-block
transient-block:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:199
A falling block came to rest as the block at a position, which the players tracking the falling block are shown at once.
entity
readonlyentity:bigint
x
readonlyx:number
y
readonlyy:number
z
readonlyz:number
world-effect
world-effect:
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:272
A numbered level event, such as a block's cracks or a splash, at a point or for the whole world.
data
readonlydata:number
effect
readonlyeffect:LevelEvent
madeBy?
readonlyoptionalmadeBy?:bigint|null
The player whose own client already played it, such as the one that broke the block, or null.
position
readonlyposition: {x:number;y:number;z:number; } |null
Where, or null for the world as a whole.
Type Aliases
ChangeEntry
ChangeEntry =
FieldEntry|MembershipEntry|ChunkEntry|OccurrenceEntry
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:414
One entry of the change log (ADR 0012).
Every entry is PlainData, so a sealed tick can be handed to another thread as it is. Checking kind narrows to one of the four entry types.
ChunkEntry
ChunkEntry =
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:115
A chunk entered or left the world.
It names the chunk and does not carry its content: a loaded or generated chunk arrives as an input, so the input record holds the content. Because of that, a chunk entry has no inverse, and history cannot be read backward past one.
Properties
change
readonlychange:"enter"|"leave"
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:118
Whether the chunk entered or left.
kind
readonlykind:"chunk"
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:116
x
readonlyx:number
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:120
The chunk's x coordinate, in chunks.
z
readonlyz:number
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:122
The chunk's z coordinate, in chunks.
DeathStage
DeathStage =
"dying"|"gone"|"revived"
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:138
A step of a living entity's death, as Java's LivingEntity runs it.
dying: it died, and stays in the world for its death animation. Java'sdiebroadcasts entity event 3.gone: the animation ran its 20 ticks and the body vanishes in a puff of smoke. Java'stickDeathbroadcasts entity event 60. A mob leaves the world right after; a dead player stays in it, out of sight, until it respawns.revived: a dead player came back alive, and the players who saw it die see it standing again.
Java See
LivingEntity.tickDeath
EntityId
EntityId =
bigint
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:7
An entity's runtime id, the only way an entry refers to an entity.
FieldEntry
FieldEntry<
K> ={ [P in K]: { address: FieldKinds[P]["address"]; after: FieldKinds[P]["value"]; before: FieldKinds[P]["value"]; field: P; kind: "field" } }[K]
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:77
One field changed from before to after. Its inverse writes before back.
FieldEntry alone is the union over every kind, and checking field narrows address and the values to that kind's types.
Type Parameters
K
K extends FieldKind = FieldKind
FieldKey
FieldKey =
string|number|bigint
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:462
A key that identifies one field within its kind, for coalescing.
FieldKind
FieldKind = keyof
FieldKinds
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:69
The name of a field kind.
FieldKindShape
FieldKindShape<
Address,Value> =object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:15
The address and value types of one field kind.
The constraints are the plain-data check: a field kind whose address or value is not PlainData does not compile.
Type Parameters
Address
Address extends PlainRecord
Value
Value extends PlainData
Properties
address
readonlyaddress:Address
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:17
Which field of the world the entry changed.
value
readonlyvalue:Value
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:19
What the field holds.
MembershipEntry
MembershipEntry =
object
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:98
An entity entered or left the world's store.
It carries the entity's saved form, which is the state the entity had at that moment, so the inverse of a departure can add the entity back. The inverse of an arrival is a departure with the same saved form.
Properties
change
readonlychange:"enter"|"leave"
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:101
Whether the entity entered or left.
entity
readonlyentity:EntityId
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:103
Which entity.
kind
readonlykind:"membership"
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:99
saved
readonlysaved:PlainRecord
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:105
The entity's saved form at the moment it entered or left.
OccurrenceEntry
OccurrenceEntry<
K> ={ [P in K]: { data: OccurrenceKinds[P]; kind: "occurrence"; occurrence: P } }[K]
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:398
A one-shot occurrence. It changes no state, so its inverse is nothing.
Type Parameters
K
K extends OccurrenceKind = OccurrenceKind
OccurrenceKind
OccurrenceKind = keyof
OccurrenceKinds
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:395
The name of an occurrence kind.
OccurrenceShape
OccurrenceShape<
Data> =Data
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:143
The data of one occurrence kind, checked to be plain data where it is declared.
Type Parameters
Data
Data extends PlainRecord
StateEntry
StateEntry =
FieldEntry|MembershipEntry
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:441
An entry that changes authoritative state and has an inverse: what a store applies.
Functions
fieldKey()
fieldKey<
K>(entry):FieldKey
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:480
Returns the key of the field entry changed. Two entries of the same kind change the same field exactly when their keys are equal.
Type Parameters
K
K extends keyof FieldKinds
Parameters
entry
FieldEntry<K>
The entry.
Returns
The field's key within its kind.
inverseOf()
inverseOf(
entry):StateEntry
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:452
Returns the entry that undoes entry.
A field entry's inverse writes the before-value, and a membership entry's inverse reverses the direction with the same saved form. Applying an entry and then its inverse leaves the state where it was, and the inverse of the inverse equals the original.
Parameters
entry
The entry to undo.
Returns
The entry that undoes it.
isBlockEntry()
isBlockEntry(
entry):boolean
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:422
Whether an entry is one replication sends blocks from: a block, a block entity field or a shown block.
Parameters
entry
The entry.
Returns
boolean
Whether it is about blocks.
isCarriedEntry()
isCarriedEntry(
entry):boolean
Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:433
Whether an entry made between ticks is held for the next tick, which is when replication sends it, rather than counted as unlogged: a state entry, or an occurrence replication sends. A vetoed action is a record and not a send, so it is not held, and neither is a chunk.
Parameters
entry
The entry.
Returns
boolean
Whether the next tick takes it.