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
readonlycanFly:boolean
Defined in: packages/prismarine/src/network/replica/firstSight.ts:103
Whether the player's metadata lets it fly.
commandLevel
readonlycommandLevel:CommandPermissionLevel
Defined in: packages/prismarine/src/network/replica/firstSight.ts:106
flying
readonlyflying:boolean
Defined in: packages/prismarine/src/network/replica/firstSight.ts:104
gamemode
readonlygamemode:Gametype
Defined in: packages/prismarine/src/network/replica/firstSight.ts:101
op
readonlyop:boolean
Defined in: packages/prismarine/src/network/replica/firstSight.ts:105
runtimeId
readonlyruntimeId: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
readonlycommandLevel:CommandPermissionLevel
Defined in: packages/prismarine/src/network/replica/firstSight.ts:57
The command level the player runs at.
device
readonlydevice:Device|null
Defined in: packages/prismarine/src/network/replica/firstSight.ts:53
name
readonlyname:string
Defined in: packages/prismarine/src/network/replica/firstSight.ts:51
op
readonlyop:boolean
Defined in: packages/prismarine/src/network/replica/firstSight.ts:55
Whether the permission service lists the player as an operator.
platformChatId
readonlyplatformChatId:string
Defined in: packages/prismarine/src/network/replica/firstSight.ts:52
skinParts?
readonlyoptionalskinParts?:number
Defined in: packages/prismarine/src/network/replica/firstSight.ts:61
The parts of its skin a Java player shows.
textures?
readonlyoptionaltextures?:object
Defined in: packages/prismarine/src/network/replica/firstSight.ts:59
A Java player's signed textures property.
signature
readonlysignature:string|null
value
readonlyvalue:string
uuid
readonlyuuid: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
readonlyequipment:ViewableEquipment
identifier
readonlyidentifier:string
The type the client draws.
kind
readonlykind:"actor"
metadata
readonlymetadata:Metadata
runtimeId
readonlyruntimeId:bigint
view
readonlyview:EntityView
Type Literal
{ kind: "item"; metadata: Metadata; runtimeId: bigint; stack: Item | undefined; view: EntityView; }
kind
readonlykind:"item"
metadata
readonlymetadata:Metadata
runtimeId
readonlyruntimeId:bigint
stack
readonlystack:Item|undefined
The stack lying there, or undefined for a stack with nothing in it, which is not shown.
view
readonlyview: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
Returns
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
context
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
context
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
context
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
change
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.