Skip to main content

terraria_protocol/packets/
update_minion_target.rs

1use crate::packets::PacketBody;
2use crate::structures::Vec2;
3use crate::SliceCursor;
4
5/// Update Minion Target.
6///
7/// Direction: Server <-> Client (Sync).
8#[derive(Debug)]
9pub struct UpdateMinionTarget {
10    pub player_id: u8,
11    pub target: Vec2,
12}
13
14impl PacketBody for UpdateMinionTarget {
15    const TAG: u8 = 99;
16
17    fn write_body(&self, cursor: &mut SliceCursor) {
18        cursor.write(&self.player_id);
19        cursor.write(&self.target);
20    }
21
22    fn from_body(cursor: &mut SliceCursor) -> Self {
23        Self {
24            player_id: cursor.read(),
25            target: cursor.read(),
26        }
27    }
28}