From 79bb50c28abd7672800a2bcb3f1ee51f64e61b68 Mon Sep 17 00:00:00 2001 From: MeexReay Date: Sun, 14 Jul 2024 01:24:03 +0300 Subject: [PATCH] uuid length does not writes now --- Cargo.toml | 2 +- src/lib.rs | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fc01c0a..05c245c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ license-file = "LICENSE" readme = "README.md" keywords = ["minecraft", "protocol", "packets", "lightweight"] -version = "0.1.8" +version = "0.1.9" edition = "2021" [dependencies] diff --git a/src/lib.rs b/src/lib.rs index 1d9b2b0..ce3061e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -175,8 +175,7 @@ pub trait DataBufferReader { } } fn read_uuid(&mut self) -> Result { - let length = self.read_usize_varint()?; - match self.read_bytes(length)?.try_into() { + match self.read_bytes(16)?.try_into() { Ok(i) => Ok(Uuid::from_bytes(i)), Err(_) => Err(ProtocolError::ReadError), } @@ -227,9 +226,7 @@ pub trait DataBufferWriter { self.write_bytes(bytes) } fn write_uuid(&mut self, val: &Uuid) -> Result<(), ProtocolError> { - let bytes = val.as_bytes(); - self.write_usize_varint(bytes.len())?; - self.write_bytes(bytes) + self.write_bytes(val.as_bytes()) } fn write_unsigned_short(&mut self, val: u16) -> Result<(), ProtocolError> { match self.write_bytes(&val.to_be_bytes()) {