Skip to content

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 ​

readonly action: string

entity ​

readonly entity: bigint

guard ​

readonly guard: 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 ​

readonly data: number

entity ​

readonly entity: bigint

event ​

readonly event: ActorEvent

item? ​

readonly optional item?: 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 ​

readonly entity: bigint

sound ​

readonly sound: LevelSoundEvent

type ​

readonly type: string

The entity's type, which tells a client whose sound to play.

x ​

readonly x: number

y ​

readonly y: number

z ​

readonly z: number

animate ​

animate: object

Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:219

An entity's animation, such as swinging an arm.

action ​

readonly action: number

data ​

readonly data: number

What the action carries, zero for the ones that carry nothing.

entity ​

readonly entity: bigint

swingSource ​

readonly swingSource: 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 ​

readonly type: number

value ​

readonly value: number

x ​

readonly x: number

y ​

readonly y: number

z ​

readonly z: 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 ​

readonly block: number

x ​

readonly x: number

y ​

readonly y: number

z ​

readonly z: 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 ​

readonly block: number

The runtime id of the block that made it.

except ​

readonly except: bigint | null

A player whose own client already plays it, or null when everybody near hears it.

madeBy ​

readonly madeBy: 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 ​

readonly sound: LevelSoundEvent

x ​

readonly x: number

y ​

readonly y: number

z ​

readonly z: 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 ​

readonly attacker: bigint

critical ​

readonly critical: boolean

Whether the blow was a critical hit.

magic ​

readonly magic: boolean

Whether the weapon's enchantments added damage.

target ​

readonly target: bigint

x ​

readonly x: number

Where the target stood.

y ​

readonly y: number

z ​

readonly z: 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 ​

readonly entity: bigint

stage ​

readonly stage: DeathStage

emote ​

emote: object

Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:377

An entity's emote.

emote ​

readonly emote: string

The emote piece's uuid.

entity ​

readonly entity: bigint

flags ​

readonly flags: number

lengthTicks ​

readonly lengthTicks: number

platformId ​

readonly platformId: string

xuid ​

readonly xuid: 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 ​

readonly blockCount: number

How many blocks it broke.

large ​

readonly large: boolean

Whether it is the large kind: one that breaks blocks, with a radius of 2 or more.

radius ​

readonly radius: number

x ​

readonly x: number

y ​

readonly y: number

z ​

readonly z: 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 ​

readonly cause: bigint | null

The entity answerable for the blow, or null.

damageType ​

readonly damageType: string

The Java damage type the blow stands for, such as minecraft:player_attack.

direct ​

readonly direct: bigint | null

What landed the blow, or null.

entity ​

readonly entity: bigint

yaw ​

readonly yaw: 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 ​

readonly entity: bigint

x ​

readonly x: number

y ​

readonly y: number

z ​

readonly z: 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 ​

readonly name: string

x ​

readonly x: number

y ​

readonly y: number

z ​

readonly z: 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? ​

readonly optional follows?: bigint

The entity it comes from and follows as it moves, which a Java client tracking it is told.

madeBy ​

readonly madeBy: bigint | null

The player whose click made it, whose Java client plays it itself, or null.

name ​

readonly name: string

pitch ​

readonly pitch: number

A multiplier on the definition's pitch.

radius? ​

readonly optional radius?: number

How far away, in blocks, players are sent it, when not the usual sound radius.

volume ​

readonly volume: number

A multiplier on the definition's volume.

x ​

readonly x: number

y ​

readonly y: number

z ​

readonly z: 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 ​

readonly entity: 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 ​

readonly actor: bigint

The entity the sound belongs to, or -1 for none.

baby ​

readonly baby: boolean

data ​

readonly data: number

firedAt ​

readonly firedAt: { x: number; y: number; z: number; } | null

Where a projectile sound was fired from, or null.

global ​

readonly global: boolean

sender ​

readonly sender: bigint

The player whose client made it, which already played it.

sound ​

readonly sound: number

The sound, or -1 for a name outside the server's enum.

type ​

readonly type: string

x ​

readonly x: number

y ​

readonly y: number

z ​

readonly z: 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 ​

readonly container: string

The container, as an inventory-slot entry names it.

entity ​

readonly entity: bigint

The player that carries the slot.

slot ​

readonly slot: 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 ​

readonly change: "add" | "remove" | "update"

effect ​

readonly effect: object

The effect as it now is, or as it was for one taken off.

effect.ambient ​

readonly ambient: boolean

effect.amplifier ​

readonly amplifier: number

effect.durationTicks ​

readonly durationTicks: number

effect.id ​

readonly id: string

effect.showIcon ​

readonly showIcon: boolean

effect.showParticles ​

readonly showParticles: boolean

entity ​

readonly entity: 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 ​

readonly entity: bigint

x ​

readonly x: number

y ​

readonly y: number

z ​

readonly z: 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 ​

readonly data: number

effect ​

readonly effect: LevelEvent

madeBy? ​

readonly optional madeBy?: bigint | null

The player whose own client already played it, such as the one that broke the block, or null.

position ​

readonly position: { 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 ​

readonly change: "enter" | "leave"

Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:118

Whether the chunk entered or left.

kind ​

readonly kind: "chunk"

Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:116

x ​

readonly x: number

Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:120

The chunk's x coordinate, in chunks.

z ​

readonly z: 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's die broadcasts entity event 3.
  • gone: the animation ran its 20 ticks and the body vanishes in a puff of smoke. Java's tickDeath broadcasts 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 ​

readonly address: Address

Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:17

Which field of the world the entry changed.

value ​

readonly value: 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 ​

readonly change: "enter" | "leave"

Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:101

Whether the entity entered or left.

entity ​

readonly entity: EntityId

Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:103

Which entity.

kind ​

readonly kind: "membership"

Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:99

saved ​

readonly saved: 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 ​

FieldKey

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 ​

StateEntry

The entry to undo.

Returns ​

StateEntry

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 ​

ChangeEntry

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 ​

ChangeEntry

The entry.

Returns ​

boolean

Whether the next tick takes it.