Skip to content

API reference / @jsprismarine/prismarine / network/contentAdapter

network/contentAdapter ​

Interfaces ​

ContentEffectAudience ​

Defined in: packages/prismarine/src/network/contentAdapter.ts:31

Who hears one dimension's effects.

One method, because every effect this group plays is "send these bytes to whoever is near here", and a port that narrow is what lets the three members below be tested against a list. replicatorEffectAudience builds one over the real replicator.

Properties ​

dimension ​

readonly dimension: number

Defined in: packages/prismarine/src/network/contentAdapter.ts:33

The dimension id SpawnParticleEffectPacket names.

Methods ​

near() ​

near(position, packet, radius): void

Defined in: packages/prismarine/src/network/contentAdapter.ts:39

Sends one packet to the players within radius blocks of a position.

Parameters ​
position ​

ContentPosition

packet ​

NetworkPacket<unknown>

radius ​

number

A cap in blocks, tighter than a recipient's view distance.

Returns ​

void


ContentEffectsOptions ​

Defined in: packages/prismarine/src/network/contentAdapter.ts:52

What createContentEffectsGroup is built over.

Properties ​

audience ​

readonly audience: ContentEffectAudience

Defined in: packages/prismarine/src/network/contentAdapter.ts:53

onGameEvent? ​

readonly optional onGameEvent?: (event) => void

Defined in: packages/prismarine/src/network/contentAdapter.ts:61

Where a game event goes.

Bedrock has no game event packet. The prismarine host hands events to its server-side vibration listeners, so this group has nothing to send. A caller that leaves this callback out drops the event.

Parameters ​
event ​

ContentGameEvent

Returns ​

void


ContentGameEvent ​

Defined in: packages/prismarine/src/network/contentAdapter.ts:43

A game event one content package emitted, as ContentEffectsOptions.onGameEvent sees it.

Properties ​

at ​

readonly at: ContentPosition

Defined in: packages/prismarine/src/network/contentAdapter.ts:46

event ​

readonly event: string

Defined in: packages/prismarine/src/network/contentAdapter.ts:45

The Java game event identifier, such as minecraft:block_open.

sourceId? ​

readonly optional sourceId?: number

Defined in: packages/prismarine/src/network/contentAdapter.ts:48

The runtime id of the entity that caused it, when one did.


EffectReplicator ​

Defined in: packages/prismarine/src/network/contentAdapter.ts:111

What replicatorEffectAudience needs of NetworkWorldReplicator.

Methods ​

sendAround() ​

sendAround(position, packet, options?): void

Defined in: packages/prismarine/src/network/contentAdapter.ts:112

Parameters ​
position ​

Vector3

packet ​

NetworkPacket<unknown>

options? ​
radius? ​

number

Returns ​

void

Functions ​

createContentEffectsGroup() ​

createContentEffectsGroup(__namedParameters): ContentEffectSink

Defined in: packages/prismarine/src/network/contentAdapter.ts:72

Builds the effects group of one dimension.

Parameters ​

__namedParameters ​

ContentEffectsOptions

Returns ​

ContentEffectSink

The three members ContentEffectSink declares.


replicatorEffectAudience() ​

replicatorEffectAudience(replicator, dimension): ContentEffectAudience

Defined in: packages/prismarine/src/network/contentAdapter.ts:124

Presents one world's replicator as a ContentEffectAudience.

The replicator already owns the "who is near enough to care" question for every other broadcast the server makes, so the content effects ask it the same way rather than resolving an audience of their own.

Parameters ​

replicator ​

EffectReplicator

dimension ​

number

The dimension id of the world the replicator serves.

Returns ​

ContentEffectAudience