aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-26 13:45:48 -0500
committermat <github@matdoes.dev>2022-05-26 13:45:48 -0500
commit1e145a82b80fb0402e8a64624454d9bfee77bc72 (patch)
treeffb016cd6369bf0fbbf3545408f6278d47509a86 /azalea-client/src
parent3fbbb61c30f0833dd1e07802419ee91ef6cad8e3 (diff)
downloadazalea-drasl-1e145a82b80fb0402e8a64624454d9bfee77bc72.tar.xz
1.19
Diffstat (limited to 'azalea-client/src')
-rwxr-xr-xazalea-client/src/connect.rs34
1 files changed, 26 insertions, 8 deletions
diff --git a/azalea-client/src/connect.rs b/azalea-client/src/connect.rs
index b8b6e372..a0001804 100755
--- a/azalea-client/src/connect.rs
+++ b/azalea-client/src/connect.rs
@@ -4,7 +4,8 @@ use azalea_protocol::{
connect::{GameConnection, HandshakeConnection},
packets::{
game::{
- clientbound_chat_packet::ClientboundChatPacket,
+ clientbound_player_chat_packet::ClientboundPlayerChatPacket,
+ clientbound_system_chat_packet::ClientboundSystemChatPacket,
serverbound_custom_payload_packet::ServerboundCustomPayloadPacket,
serverbound_keep_alive_packet::ServerboundKeepAlivePacket, GamePacket,
},
@@ -44,9 +45,24 @@ pub struct Client {
}
#[derive(Debug, Clone)]
+pub enum ChatPacket {
+ System(ClientboundSystemChatPacket),
+ Player(ClientboundPlayerChatPacket),
+}
+
+// impl ChatPacket {
+// pub fn message(&self) -> &str {
+// match self {
+// ChatPacket::System(p) => &p.content,
+// ChatPacket::Player(p) => &p.message,
+// }
+// }
+// }
+
+#[derive(Debug, Clone)]
pub enum Event {
Login,
- Chat(ClientboundChatPacket),
+ Chat(ChatPacket),
}
/// Whether we should ignore errors when decoding packets.
@@ -75,6 +91,7 @@ impl Client {
conn.write(
ServerboundHelloPacket {
username: account.username.clone(),
+ public_key: None,
}
.get(),
)
@@ -290,9 +307,6 @@ impl Client {
GamePacket::ClientboundLightUpdatePacket(p) => {
println!("Got light update packet {:?}", p);
}
- GamePacket::ClientboundAddMobPacket(p) => {
- println!("Got add mob packet {:?}", p);
- }
GamePacket::ClientboundAddEntityPacket(p) => {
println!("Got add entity packet {:?}", p);
}
@@ -357,9 +371,13 @@ impl Client {
GamePacket::ClientboundRemoveEntitiesPacket(p) => {
println!("Got remove entities packet {:?}", p);
}
- GamePacket::ClientboundChatPacket(p) => {
- println!("Got chat packet {:?}", p);
- tx.send(Event::Chat(p.clone())).unwrap();
+ GamePacket::ClientboundPlayerChatPacket(p) => {
+ println!("Got player chat packet {:?}", p);
+ tx.send(Event::Chat(ChatPacket::Player(p.clone()))).unwrap();
+ }
+ GamePacket::ClientboundSystemChatPacket(p) => {
+ println!("Got system chat packet {:?}", p);
+ tx.send(Event::Chat(ChatPacket::System(p.clone()))).unwrap();
}
GamePacket::ClientboundSoundPacket(p) => {
println!("Got sound packet {:?}", p);