Skip to content

Synchronization and Network Protocol

JohnSmith474 edited this page Jun 12, 2026 · 1 revision

The framework dictates state synchronization through defined operational scopes and authoritative network boundaries.

Scope Authority

Properties assigned the LEVEL or GLOBAL operational scope submit to authoritative server state control. The local disk serialization acts exclusively as a client-side cache or server-side baseline. Properties assigned CLIENT or scopes reject network synchronization attempts and maintain local authority.

Payload Construction

Network data transmission necessitates serialization to the NBT format. The framework executes this conversion via the Codec<T> instance bound to the property during the builder sequence.

  • encodeValueToNbt(): Translates the active memory state into an NBT payload for outbound transmission.

  • decodeValueFromNbt(Tag tag): Parses inbound NBT payloads and mutates the active memory state to match.

Network Hooks and State Pipelines

Properties implement explicit execution pipelines to handle varying synchronization vectors.

  • acceptAuthoritativeUpdate(Tag tag): Forces a localized state override originating from a server command or authorized operator modification.

  • onSync(T serverValue): Applies a deserialized network state sequence transmitted by the authoritative server to the local runtime value and sets internal synchronization flags.

  • onDisconnect(): Executes local state teardown upon severing connection with the authoritative server, purging network-assigned runtime values and dropping dynamic instances.

Clone this wiki locally