Pumpkin/crates/pumpkin-protocol/src/java/client/play/update_entity_rot.rs
2026-08-20 22:39:16 +02:00

42 lines
1015 B
Rust

use pumpkin_data::packet::clientbound::play::MOVE_ENTITY_ROT;
use pumpkin_macros::java_packet;
use crate::ClientPacket;
use crate::VarInt;
use crate::ser::NetworkWriteExt;
use pumpkin_util::version::JavaMinecraftVersion;
#[java_packet(MOVE_ENTITY_ROT)]
pub struct CUpdateEntityRot {
pub entity_id: VarInt,
pub yaw: u8,
pub pitch: u8,
pub on_ground: bool,
}
impl CUpdateEntityRot {
#[must_use]
pub const fn new(entity_id: VarInt, yaw: u8, pitch: u8, on_ground: bool) -> Self {
Self {
entity_id,
yaw,
pitch,
on_ground,
}
}
}
impl ClientPacket for CUpdateEntityRot {
fn write_packet_data(
&self,
mut write: impl std::io::Write,
_version: &JavaMinecraftVersion,
) -> Result<(), crate::ser::WritingError> {
write.write_var_int(&self.entity_id)?;
write.write_u8(self.yaw)?;
write.write_u8(self.pitch)?;
write.write_bool(self.on_ground)?;
Ok(())
}
}