diff options
| author | mat <github@matdoes.dev> | 2021-12-15 19:10:44 -0600 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2021-12-15 19:10:44 -0600 |
| commit | ff8e3f2d9e4752cf3ecf8ed80041ab352cceb870 (patch) | |
| tree | 42c418be99e4badf650c7f9a9cf6e130ad310a3f /minecraft-protocol/src/read.rs | |
| parent | 2e11f5a564e6c5687ebe1d4eab26d6eb841f8406 (diff) | |
| download | azalea-drasl-ff8e3f2d9e4752cf3ecf8ed80041ab352cceb870.tar.xz | |
reading packets is now friendlier
Diffstat (limited to 'minecraft-protocol/src/read.rs')
| -rw-r--r-- | minecraft-protocol/src/read.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/minecraft-protocol/src/read.rs b/minecraft-protocol/src/read.rs index f0c82641..6f242e8b 100644 --- a/minecraft-protocol/src/read.rs +++ b/minecraft-protocol/src/read.rs @@ -1,6 +1,6 @@ use tokio::{io::BufReader, net::TcpStream}; -use crate::{connect::PacketFlow, mc_buf, packets::ProtocolPacket}; +use crate::{connect::PacketFlow, mc_buf::Readable, packets::ProtocolPacket}; pub async fn read_packet<P: ProtocolPacket>( flow: &PacketFlow, @@ -15,10 +15,10 @@ pub async fn read_packet<P: ProtocolPacket>( // the first thing minecraft sends us is the length as a varint, which can be up to 5 bytes long let mut buf = BufReader::with_capacity(4 * 1024 * 1024, stream); - let (_packet_size, _packet_size_varint_size) = mc_buf::read_varint(&mut buf).await?; + let (_packet_size, _packet_size_varint_size) = buf.read_varint().await?; // then, minecraft tells us the packet id as a varint - let (packet_id, _packet_id_size) = mc_buf::read_varint(&mut buf).await?; + let (packet_id, _packet_id_size) = buf.read_varint().await?; // if we recognize the packet id, parse it |
