Add Clientbound Play Disconnect

This commit is contained in:
Snowiiii committed 2024-08-04 12:23:28 +02:00
1 parent a0d92fe45c
commit 30cdab5d09
5 files changed
+43 -4

No files matched your search

+3
View File
@@ -15,6 +15,9 @@ serde_json = "1.0"
thiserror = "1.0.63"
log = "0.4"
# for text component
fastnbt = { git = "https://github.com/owengage/fastnbt.git" }
# encryption
aes = "0.8.4"
cfb8 = "0.8.1"
+19 -1
View File
@@ -1,4 +1,4 @@
use crate::{bytebuf::ByteBuffer, BitSet, ClientPacket, VarInt};
use crate::{bytebuf::ByteBuffer, text::Text, BitSet, ClientPacket, VarInt};
pub struct SetHeldItem {
slot: i8,
@@ -44,6 +44,24 @@ impl ClientPacket for CPlayerAbilities {
}
}
pub struct CPlayDisconnect {
reason: Text,
}
impl CPlayDisconnect {
pub fn new(reason: Text) -> Self {
Self { reason }
}
}
impl<'a> ClientPacket for CPlayDisconnect {
const PACKET_ID: VarInt = 0x1D;
fn write(&self, bytebuf: &mut ByteBuffer) {
bytebuf.put_slice(&self.reason.encode());
}
}
pub struct CChangeDifficulty {
difficulty: u8,
locked: bool,