aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src/packets/login
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-protocol/src/packets/login')
-rwxr-xr-xazalea-protocol/src/packets/login/clientbound_game_profile_packet.rs4
-rwxr-xr-xazalea-protocol/src/packets/login/clientbound_hello_packet.rs9
-rwxr-xr-xazalea-protocol/src/packets/login/clientbound_login_compression_packet.rs9
3 files changed, 14 insertions, 8 deletions
diff --git a/azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs b/azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs
index bcdcd105..dd077ced 100755
--- a/azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs
+++ b/azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs
@@ -1,4 +1,4 @@
-use std::io::Read;
+use std::io::{Read, Write};
use super::LoginPacket;
use crate::mc_buf::{Readable, Writable};
@@ -17,7 +17,7 @@ impl ClientboundGameProfilePacket {
LoginPacket::ClientboundGameProfilePacket(self)
}
- pub fn write(&self, buf: &mut Vec<u8>) -> Result<(), std::io::Error> {
+ pub fn write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
for n in self.game_profile.uuid.to_int_array() {
buf.write_int(n as i32).unwrap();
}
diff --git a/azalea-protocol/src/packets/login/clientbound_hello_packet.rs b/azalea-protocol/src/packets/login/clientbound_hello_packet.rs
index 06f346c2..f7de4c21 100755
--- a/azalea-protocol/src/packets/login/clientbound_hello_packet.rs
+++ b/azalea-protocol/src/packets/login/clientbound_hello_packet.rs
@@ -1,4 +1,7 @@
-use std::{hash::Hash, io::Read};
+use std::{
+ hash::Hash,
+ io::{Read, Write},
+};
use super::LoginPacket;
use crate::mc_buf::Readable;
@@ -15,11 +18,11 @@ impl ClientboundHelloPacket {
LoginPacket::ClientboundHelloPacket(self)
}
- pub fn write(&self, _buf: &mut Vec<u8>) -> Result<(), std::io::Error> {
+ pub fn write(&self, _buf: &mut impl Write) -> Result<(), std::io::Error> {
panic!("ClientboundHelloPacket::write not implemented")
}
- pub fn read(buf: &mut impl Read) -> Result<LoginPacket, String> {
+ pub fn read(buf: &mut impl Read) -> Result<LoginPacket, String> {
let server_id = buf.read_utf_with_len(20)?;
let public_key = buf.read_byte_array()?;
let nonce = buf.read_byte_array()?;
diff --git a/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs b/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs
index a5ab78bb..b1323f50 100755
--- a/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs
+++ b/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs
@@ -1,4 +1,7 @@
-use std::{hash::Hash, io::Read};
+use std::{
+ hash::Hash,
+ io::{Read, Write},
+};
use crate::mc_buf::{Readable, Writable};
@@ -14,12 +17,12 @@ impl ClientboundLoginCompressionPacket {
LoginPacket::ClientboundLoginCompressionPacket(self)
}
- pub fn write(&self, buf: &mut Vec<u8>) -> Result<(), std::io::Error> {
+ pub fn write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
buf.write_varint(self.compression_threshold).unwrap();
Ok(())
}
- pub fn read(buf: &mut impl Read) -> Result<LoginPacket, String> {
+ pub fn read(buf: &mut impl Read) -> Result<LoginPacket, String> {
let compression_threshold = buf.read_varint()?;
Ok(ClientboundLoginCompressionPacket {