steel_protocol/packets/game/
c_set_entity_motion.rs1use std::io::{Result, Write};
4
5use glam::DVec3;
6use steel_macros::ClientPacket;
7use steel_registry::packets::play::C_SET_ENTITY_MOTION;
8use steel_utils::{codec::VarInt, serial::WriteTo};
9
10use super::write_lp_vec3;
11
12#[derive(ClientPacket, Clone, Debug)]
21#[packet_id(Play = C_SET_ENTITY_MOTION)]
22pub struct CSetEntityMotion {
23 pub entity_id: i32,
25 pub vel: DVec3,
27}
28
29impl CSetEntityMotion {
30 #[must_use]
32 pub const fn new(entity_id: i32, vel: DVec3) -> Self {
33 Self { entity_id, vel }
34 }
35}
36
37impl WriteTo for CSetEntityMotion {
38 fn write(&self, writer: &mut impl Write) -> Result<()> {
39 VarInt(self.entity_id).write(writer)?;
40 write_lp_vec3(writer, self.vel)
41 }
42}