Skip to content

API reference / @jsprismarine/prismarine / network/replica/BlockReplica / BlockReplica

Class: BlockReplica ​

Defined in: packages/prismarine/src/network/replica/BlockReplica.ts:72

The block entities of one world as replication last read them, by chunk.

Constructors ​

Constructor ​

new BlockReplica(): BlockReplica

Returns ​

BlockReplica

Methods ​

chunkEntered() ​

chunkEntered(x, z, blockEntities): void

Defined in: packages/prismarine/src/network/replica/BlockReplica.ts:84

Takes the block entities of a chunk that entered the world, replacing whatever the replica held for it.

Parameters ​

x ​

number

The chunk's x, in chunks.

z ​

number

The chunk's z, in chunks.

blockEntities ​

Iterable<NBTTagCompound>

The chunk's block entities as the chunk serializes them.

Returns ​

void


chunkLeft() ​

chunkLeft(x, z): void

Defined in: packages/prismarine/src/network/replica/BlockReplica.ts:100

Forgets a chunk that left the world.

Parameters ​

x ​

number

The chunk's x, in chunks.

z ​

number

The chunk's z, in chunks.

Returns ​

void


compound() ​

compound(at): NBTTagCompound | null

Defined in: packages/prismarine/src/network/replica/BlockReplica.ts:146

The compound of the block entity at a position, folded from its fields, in the form the block entity itself serializes to.

Parameters ​

at ​

BlockAt

The position.

Returns ​

NBTTagCompound | null

The compound, or null when no block entity stands there.


counts() ​

counts(): BlockReplicaCounts

Defined in: packages/prismarine/src/network/replica/BlockReplica.ts:162

What the replica holds and what it has done.

Returns ​

BlockReplicaCounts


read() ​

read(sealed): BlockTickChanges

Defined in: packages/prismarine/src/network/replica/BlockReplica.ts:111

Reads the block entries of one sealed tick: notes each block's last runtime id and writes each block entity field into the replica. A block entity field in a chunk the replica does not hold is passed over, since no client holds that chunk either.

Parameters ​

sealed ​

SealedTick

The tick, read once.

Returns ​

BlockTickChanges

What changed, for the flush.