diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2025-09-30 10:56:34 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-30 10:56:34 -0500 |
| commit | 643fcb98c0e6cdc63218dd39960d9053b209d9a6 (patch) | |
| tree | 6bddb7fe39b8fcc3ab3fb2665574533bb227898a /azalea-buf/src | |
| parent | a80d8d1b242430c4a251876fa67bfd26af7a0de9 (diff) | |
| download | azalea-drasl-643fcb98c0e6cdc63218dd39960d9053b209d9a6.tar.xz | |
1.21.9 (#235)
* start updating to 25w33a
* 1.21.9-pre2
* clippy
* cleanup, and fix c_explode and c_player_rotation
* mc update should be in Changed section in the changelog
* 1.21.9
Diffstat (limited to 'azalea-buf/src')
| -rw-r--r-- | azalea-buf/src/read.rs | 9 | ||||
| -rw-r--r-- | azalea-buf/src/write.rs | 6 |
2 files changed, 13 insertions, 2 deletions
diff --git a/azalea-buf/src/read.rs b/azalea-buf/src/read.rs index 771b917c..95dc79ac 100644 --- a/azalea-buf/src/read.rs +++ b/azalea-buf/src/read.rs @@ -135,6 +135,12 @@ where fn azalea_read_limited(buf: &mut Cursor<&[u8]>, limit: usize) -> Result<Self, BufReadError>; } +impl AzaleaRead for () { + fn azalea_read(_buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + Ok(()) + } +} + impl AzaleaRead for i32 { fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { Ok(buf.read_i32::<BE>()?) @@ -142,9 +148,9 @@ impl AzaleaRead for i32 { } impl AzaleaReadVar for i32 { - // fast varints modified from https://github.com/luojia65/mc-varint/blob/master/src/lib.rs#L67 /// Read a single varint from the reader and return the value fn azalea_read_var(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + // fast varint impl based on https://github.com/luojia65/mc-varint/blob/master/src/lib.rs#L67 let mut buffer = [0]; let mut ans = 0; for i in 0..5 { @@ -159,7 +165,6 @@ impl AzaleaReadVar for i32 { } impl AzaleaReadVar for i64 { - // fast varints modified from https://github.com/luojia65/mc-varint/blob/master/src/lib.rs#L54 fn azalea_read_var(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { let mut buffer = [0]; let mut ans = 0; diff --git a/azalea-buf/src/write.rs b/azalea-buf/src/write.rs index 7b9ad496..8c2d88ea 100644 --- a/azalea-buf/src/write.rs +++ b/azalea-buf/src/write.rs @@ -29,6 +29,12 @@ pub trait AzaleaWriteVar { fn azalea_write_var(&self, buf: &mut impl Write) -> io::Result<()>; } +impl AzaleaWrite for () { + fn azalea_write(&self, _buf: &mut impl Write) -> io::Result<()> { + Ok(()) + } +} + impl AzaleaWrite for i32 { fn azalea_write(&self, buf: &mut impl Write) -> io::Result<()> { WriteBytesExt::write_i32::<BigEndian>(buf, *self) |
