forked from Quozul/PicoLimbo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlegacy_chat_message_packet.rs
More file actions
29 lines (27 loc) · 922 Bytes
/
legacy_chat_message_packet.rs
File metadata and controls
29 lines (27 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use minecraft_protocol::prelude::*;
use pico_text_component::prelude::Component;
/// This packet has no equivalent since 1.19 included
/// It has been split into 3 packets:
/// - Disguised Chat Message
/// - Player Chat Message
/// - System Chat Message
#[derive(PacketOut)]
pub struct LegacyChatMessagePacket {
/// JSON encoded text component
content: String,
/// 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar)
#[pvn(47..)]
position: u8,
/// Used by the Notchian client for the disableChat launch option. Setting both longs to 0 will always display the message regardless of the setting.
#[pvn(735..)]
sender: UuidAsString,
}
impl LegacyChatMessagePacket {
pub fn component(component: &Component) -> Self {
Self {
content: component.to_json(),
position: 1,
sender: UuidAsString::default(),
}
}
}