1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00
azalea/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs
mat e9f88ce546 Publish everything* to crates.io
Except azalea-client since it's not ready yet
2022-09-05 10:36:48 -05:00

40 lines
882 B
Rust

use azalea_buf::McBuf;
use azalea_core::Vec3;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::entity::EntityData;
use uuid::Uuid;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundAddEntityPacket {
/// The id of the entity.
#[var]
pub id: u32,
pub uuid: Uuid,
// TODO: have an entity type enum/struct
#[var]
pub entity_type: i32,
pub x: f64,
pub y: f64,
pub z: f64,
pub x_rot: i8,
pub y_rot: i8,
pub y_head_rot: i8,
#[var]
pub data: i32,
pub x_vel: i16,
pub y_vel: i16,
pub z_vel: i16,
}
impl From<&ClientboundAddEntityPacket> for EntityData {
fn from(p: &ClientboundAddEntityPacket) -> Self {
Self::new(
p.uuid,
Vec3 {
x: p.x,
y: p.y,
z: p.z,
},
)
}
}