aboutsummaryrefslogtreecommitdiff
path: root/minecraft-protocol/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2021-12-15 18:50:10 -0600
committermat <github@matdoes.dev>2021-12-15 18:50:10 -0600
commit2e11f5a564e6c5687ebe1d4eab26d6eb841f8406 (patch)
tree80652f00d2a88fd966ff7eeb81871fa049e36e93 /minecraft-protocol/src
parent1c9e089b7268fe4ffeeee5e594bb2d708470d2a1 (diff)
downloadazalea-drasl-2e11f5a564e6c5687ebe1d4eab26d6eb841f8406.tar.xz
start implementing other packets and stuff
Diffstat (limited to 'minecraft-protocol/src')
-rw-r--r--minecraft-protocol/src/packets/login/clientbound_custom_query_packet.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/minecraft-protocol/src/packets/login/clientbound_custom_query_packet.rs b/minecraft-protocol/src/packets/login/clientbound_custom_query_packet.rs
new file mode 100644
index 00000000..54f3dd14
--- /dev/null
+++ b/minecraft-protocol/src/packets/login/clientbound_custom_query_packet.rs
@@ -0,0 +1,39 @@
+use std::hash::Hash;
+use tokio::io::BufReader;
+
+use crate::mc_buf;
+
+use super::LoginPacket;
+
+#[derive(Hash, Clone, Debug)]
+pub struct ClientboundCustomQueryPacket {
+ pub transacton_id: u32,
+ // TODO: this should be a resource location
+ pub identifier: String,
+ pub data: Vec<u8>,
+}
+
+impl ClientboundHelloPacket {
+ pub fn get(self) -> LoginPacket {
+ LoginPacket::ClientboundHelloPacket(self)
+ }
+
+ pub fn write(&self, _buf: &mut Vec<u8>) {
+ panic!("ClientboundHelloPacket::write not implemented")
+ }
+
+ pub async fn read<T: tokio::io::AsyncRead + std::marker::Unpin + std::marker::Send>(
+ buf: &mut BufReader<T>,
+ ) -> Result<LoginPacket, String> {
+ // let server_id = mc_buf::read_utf_with_len(buf, 20).await?;
+ // let public_key = mc_buf::read_byte_array(buf).await?;
+ // let nonce = mc_buf::read_byte_array(buf).await?;
+
+ // Ok(ClientboundHelloPacket {
+ // server_id,
+ // public_key,
+ // nonce,
+ // }
+ // .get())
+ }
+}