steel_protocol/packets/game/
c_set_entity_link.rs1use steel_macros::{ClientPacket, WriteTo};
4use steel_registry::packets::play::C_SET_ENTITY_LINK;
5
6#[derive(ClientPacket, WriteTo, Clone, Debug, PartialEq, Eq)]
8#[packet_id(Play = C_SET_ENTITY_LINK)]
9pub struct CSetEntityLink {
10 pub source_id: i32,
12 pub dest_id: i32,
14}
15
16impl CSetEntityLink {
17 #[must_use]
19 pub const fn new(source_id: i32, dest_id: i32) -> Self {
20 Self { source_id, dest_id }
21 }
22}
23
24#[cfg(test)]
25mod tests {
26 use steel_utils::serial::WriteTo as _;
27
28 use super::*;
29
30 #[test]
31 fn entity_link_packet_uses_vanilla_raw_ints() {
32 let packet = CSetEntityLink::new(42, 7);
33 let mut bytes = Vec::new();
34
35 packet.write(&mut bytes).expect("packet should encode");
36
37 assert_eq!(bytes, vec![0, 0, 0, 42, 0, 0, 0, 7]);
38 }
39}