Skip to content

API reference / @jsprismarine/prismarine / world/chunk/BlockStorage / BlockWriteCounter

Class: BlockWriteCounter ​

Defined in: packages/prismarine/src/world/chunk/BlockStorage.ts:103

Counts the block writes and storage swaps under one chunk.

BlockStorage.writeEpoch moves on a write anywhere in the process, so a fluid flowing in one chunk made every other chunk sum its section revisions again. A chunk hands its counter to each sub chunk it holds, which hands it to each storage, and reads its own count instead.

Constructors ​

Constructor ​

new BlockWriteCounter(): BlockWriteCounter

Returns ​

BlockWriteCounter

Properties ​

count ​

count: number = 0

Defined in: packages/prismarine/src/world/chunk/BlockStorage.ts:105

Writes and swaps counted so far.


shared ​

shared: boolean = false

Defined in: packages/prismarine/src/world/chunk/BlockStorage.ts:110

Set once a sub chunk or storage was handed a second counter. Writes then reach only the last counter, so neither can vouch for its chunk and both fall back to the revisions.

Methods ​

attach() ​

static attach(current, next): BlockWriteCounter

Defined in: packages/prismarine/src/world/chunk/BlockStorage.ts:113

The counter an object holds after being handed next, marking both shared when it held another.

Parameters ​

current ​

BlockWriteCounter | undefined

next ​

BlockWriteCounter

Returns ​

BlockWriteCounter