Skip to content

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

network/replica/firstSight ​

Interfaces ​

AbilityTarget ​

Defined in: packages/prismarine/src/network/replica/firstSight.ts:99

What the abilities packet says about a player.

Properties ​

canFly ​

readonly canFly: boolean

Defined in: packages/prismarine/src/network/replica/firstSight.ts:103

Whether the player's metadata lets it fly.

commandLevel ​

readonly commandLevel: CommandPermissionLevel

Defined in: packages/prismarine/src/network/replica/firstSight.ts:106

flying ​

readonly flying: boolean

Defined in: packages/prismarine/src/network/replica/firstSight.ts:104

gamemode ​

readonly gamemode: Gametype

Defined in: packages/prismarine/src/network/replica/firstSight.ts:101

op ​

readonly op: boolean

Defined in: packages/prismarine/src/network/replica/firstSight.ts:105

runtimeId ​

readonly runtimeId: bigint

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


SightIdentity ​

Defined in: packages/prismarine/src/network/replica/firstSight.ts:49

Who a player is, as the session that speaks for it holds it, which no log entry carries.

Properties ​

commandLevel ​

readonly commandLevel: CommandPermissionLevel

Defined in: packages/prismarine/src/network/replica/firstSight.ts:57

The command level the player runs at.

device ​

readonly device: Device | null

Defined in: packages/prismarine/src/network/replica/firstSight.ts:53

name ​

readonly name: string

Defined in: packages/prismarine/src/network/replica/firstSight.ts:51

op ​

readonly op: boolean

Defined in: packages/prismarine/src/network/replica/firstSight.ts:55

Whether the permission service lists the player as an operator.

platformChatId ​

readonly platformChatId: string

Defined in: packages/prismarine/src/network/replica/firstSight.ts:52

skinParts? ​

readonly optional skinParts?: number

Defined in: packages/prismarine/src/network/replica/firstSight.ts:61

The parts of its skin a Java player shows.

textures? ​

readonly optional textures?: object

Defined in: packages/prismarine/src/network/replica/firstSight.ts:59

A Java player's signed textures property.

signature ​

readonly signature: string | null

value ​

readonly value: string

uuid ​

readonly uuid: UUIDValue

Defined in: packages/prismarine/src/network/replica/firstSight.ts:50

Type Aliases ​

FirstSight ​

FirstSight = { equipment: ViewableEquipment; identifier: string; kind: "actor"; metadata: Metadata; runtimeId: bigint; view: EntityView; } | { kind: "item"; metadata: Metadata; runtimeId: bigint; stack: Item | undefined; view: EntityView; } | { kind: "painting"; painting: PaintingSight; runtimeId: bigint; } | { equipment: ViewableEquipment; identity: SightIdentity; kind: "player"; metadata: Metadata; player: ShownPlayerState; runtimeId: bigint; view: EntityView; }

Defined in: packages/prismarine/src/network/replica/firstSight.ts:65

What a client is shown when an entity first comes into its view.

Union Members ​

Type Literal ​

{ equipment: ViewableEquipment; identifier: string; kind: "actor"; metadata: Metadata; runtimeId: bigint; view: EntityView; }

equipment ​

readonly equipment: ViewableEquipment

identifier ​

readonly identifier: string

The type the client draws.

kind ​

readonly kind: "actor"

metadata ​

readonly metadata: Metadata

runtimeId ​

readonly runtimeId: bigint

view ​

readonly view: EntityView


Type Literal ​

{ kind: "item"; metadata: Metadata; runtimeId: bigint; stack: Item | undefined; view: EntityView; }

kind ​

readonly kind: "item"

metadata ​

readonly metadata: Metadata

runtimeId ​

readonly runtimeId: bigint

stack ​

readonly stack: Item | undefined

The stack lying there, or undefined for a stack with nothing in it, which is not shown.

view ​

readonly view: EntityView


Type Literal ​

{ kind: "painting"; painting: PaintingSight; runtimeId: bigint; }


Type Literal ​

{ equipment: ViewableEquipment; identity: SightIdentity; kind: "player"; metadata: Metadata; player: ShownPlayerState; runtimeId: bigint; view: EntityView; }

Functions ​

abilitiesPacket() ​

abilitiesPacket(target): UpdateAbilitiesPacket

Defined in: packages/prismarine/src/network/replica/firstSight.ts:372

UpdateAbilitiesPacket describing one player.

One BASE layer carries every ability, derived from the game mode and op state, with walk speed 0.1, fly speed 0.05 and vertical fly speed 1, the client's own defaults. The target id is the player's runtime id, which the server also uses as its unique id.

Parameters ​

target ​

AbilityTarget

Returns ​

UpdateAbilitiesPacket


armorPackets() ​

armorPackets(runtimeEntityId, worn, context): NetworkPacket<unknown>[]

Defined in: packages/prismarine/src/network/replica/firstSight.ts:316

What a human is wearing and holding in the off hand.

All four armor pieces at once, empty ones included as air: the packet is positional. Body is the body armor slot, which HumanInventory does not model, so it is always air. It used to carry the off-hand item, which the client took for body armor. The off hand goes out as a MobEquipmentPacket for the offhand container, the way the client reports its own off-hand changes, and its single slot makes both slot fields zero.

Parameters ​

runtimeEntityId ​

bigint

worn ​

ViewableEquipment

context ​

ProtocolContext

Returns ​

NetworkPacket<unknown>[]


equipmentPackets() ​

equipmentPackets(runtimeEntityId, worn, context, offhandEmptied?): NetworkPacket<unknown>[]

Defined in: packages/prismarine/src/network/replica/firstSight.ts:270

Everything one entity is holding and wearing, as a mob is shown it.

Both packets go out whatever the entity is wearing, rather than only the occupied slots. MobArmorEquipmentPacket is positional, so a client sent three pieces reads the next packet's bytes as the fourth, and an empty slot has to travel as air. The main hand is a separate packet because that is the one the client reads a held item from, with zero for both slots, as a mob has no inventory to name one in; the off hand follows only when something is in it, the way vanilla sends it, or as air when offhandEmptied says a client may still draw one there.

Parameters ​

runtimeEntityId ​

bigint

worn ​

ViewableEquipment

context ​

ProtocolContext

offhandEmptied? ​

boolean = false

Whether the viewers were last shown something in the off hand that is gone now. An update says so, and a first sight never does.

Returns ​

NetworkPacket<unknown>[]


firstSightPackets() ​

firstSightPackets(sight, context): NetworkPacket<unknown>[]

Defined in: packages/prismarine/src/network/replica/firstSight.ts:121

The packets that show one client an entity, in the order a client is sent them.

Parameters ​

sight ​

FirstSight

context ​

ProtocolContext

The receiving codec's context, which numbers the items.

Returns ​

NetworkPacket<unknown>[]


statusEffectPacket() ​

statusEffectPacket(runtimeId, effect, change, tick): MobEffectPacket | undefined

Defined in: packages/prismarine/src/network/replica/firstSight.ts:343

One status effect change of an entity.

Parameters ​

runtimeId ​

bigint

effect ​

StatusEffect

change ​

StatusEffectChange

tick ​

bigint

The client's last input tick when the entity is its own player, else zero.

Returns ​

MobEffectPacket | undefined

The packet, or undefined for an effect Bedrock has no id for.