valence_protocol/packets/play/
player_spawn_s2c.rs

1use uuid::Uuid;
2use valence_math::DVec3;
3
4use crate::{ByteAngle, Decode, Encode, Packet, VarInt};
5
6/// This packet is sent by the server when a player comes into visible range,
7/// not when a player joins.
8///
9/// This packet must be sent after the Player Info Update packet that adds the
10/// player data for the client to use when spawning a player. If the Player Info
11/// for the player spawned by this packet is not present when this packet
12/// arrives, Notchian clients will not spawn the player entity. The Player Info
13/// packet includes skin/cape data.
14///
15/// Servers can, however, safely spawn player entities for players not in
16/// visible range. The client appears to handle it correctly.
17///
18/// wiki : [Spawn Player](https://wiki.vg/Protocol#Spawn_Player)
19#[derive(Copy, Clone, Debug, Encode, Decode, Packet)]
20pub struct PlayerSpawnS2c {
21    /// A unique integer ID mostly used in the protocol to identify the player.
22    pub entity_id: VarInt,
23    pub player_uuid: Uuid,
24    pub position: DVec3,
25    pub yaw: ByteAngle,
26    pub pitch: ByteAngle,
27}