1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 23:44:38 +00:00
azalea/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs
2022-06-26 00:34:45 -05:00

32 lines
731 B
Rust

use azalea_buf::McBuf;
use azalea_core::Vec3;
use azalea_entity::Entity;
use packet_macros::GamePacket;
use uuid::Uuid;
/// This packet is sent by the server when a player comes into visible range, not when a player joins.
#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundAddPlayerPacket {
#[var]
pub id: u32,
pub uuid: Uuid,
pub x: f64,
pub y: f64,
pub z: f64,
pub x_rot: i8,
pub y_rot: i8,
}
impl From<&ClientboundAddPlayerPacket> for Entity {
fn from(p: &ClientboundAddPlayerPacket) -> Self {
Self::new(
p.id,
p.uuid,
Vec3 {
x: p.x,
y: p.y,
z: p.z,
},
)
}
}