From 9a66cb97a659ed1f0e52ba3d9438de1d9b78d64a Mon Sep 17 00:00:00 2001 From: EightFactorial Date: Wed, 25 Jan 2023 09:51:27 -0800 Subject: Fix test and packets (#60) * Fix test and packets * Fix bug, fix a couple more packets * add tests and fix stuff * fix warnings Co-authored-by: Ubuntu --- azalea-buf/src/write.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'azalea-buf/src/write.rs') diff --git a/azalea-buf/src/write.rs b/azalea-buf/src/write.rs index e00ddce9..161f8645 100755 --- a/azalea-buf/src/write.rs +++ b/azalea-buf/src/write.rs @@ -132,15 +132,16 @@ impl McBufVarWritable for i64 { fn var_write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { let mut buffer = [0]; let mut value = *self; + if value == 0 { + buf.write_all(&buffer).unwrap(); + } while value != 0 { buffer[0] = (value & 0b0111_1111) as u8; value = (value >> 7) & (i64::max_value() >> 6); if value != 0 { buffer[0] |= 0b1000_0000; } - // this only writes a single byte, so write_all isn't necessary - // the let _ = is so clippy doesn't complain - let _ = buf.write(&buffer)?; + buf.write_all(&buffer)?; } Ok(()) } -- cgit v1.2.3