diff options
| author | mat <git@matdoes.dev> | 2026-02-04 03:50:35 +0400 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2026-02-04 03:50:35 +0400 |
| commit | f8ddefa70cc53e6385785fb56e7a688a389cf0ab (patch) | |
| tree | 1aeb54c20bddb542d0b70430ebb00563d0627298 | |
| parent | 26f3474f835a586af8b4383fdc9b83ebc54da299 (diff) | |
| download | azalea-drasl-f8ddefa70cc53e6385785fb56e7a688a389cf0ab.tar.xz | |
fix ClientboundSetEquipment failing to deserialize if using animal armor slots
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | azalea-inventory/src/components/mod.rs | 2 | ||||
| -rw-r--r-- | azalea-protocol/src/packets/game/c_set_equipment.rs | 19 |
3 files changed, 22 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 08fc176f..1376e4d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ is breaking anyways, semantic versioning is not followed. - The pathfinder now avoids magma blocks. - Fixed several panics, OOMs, and memory leaks in `azalea-protocol`. - Click events in chat messages were missing. +- `ClientboundSetEquipment` failed to deserialize if a packet used animal armor slots. ## [0.15.1+mc1.21.11] - 2026-02-03 diff --git a/azalea-inventory/src/components/mod.rs b/azalea-inventory/src/components/mod.rs index 3d13725a..908db28f 100644 --- a/azalea-inventory/src/components/mod.rs +++ b/azalea-inventory/src/components/mod.rs @@ -1132,6 +1132,8 @@ impl EquipmentSlot { 3 => Self::Legs, 4 => Self::Chest, 5 => Self::Head, + 6 => Self::Body, + 7 => Self::Saddle, _ => return None, }; Some(value) diff --git a/azalea-protocol/src/packets/game/c_set_equipment.rs b/azalea-protocol/src/packets/game/c_set_equipment.rs index 11ee8b3a..15856ad7 100644 --- a/azalea-protocol/src/packets/game/c_set_equipment.rs +++ b/azalea-protocol/src/packets/game/c_set_equipment.rs @@ -52,3 +52,22 @@ impl AzBuf for EquipmentSlots { Ok(()) } } + +#[cfg(test)] +mod tests { + use std::io::Cursor; + + use azalea_buf::AzBuf; + + use super::*; + + #[test] + fn test_read_lifesteal_net_set_equipment() { + let contents = [1, 128, 0, 129, 0, 130, 0, 131, 0, 132, 0, 133, 0, 7, 0]; + let mut buf = Cursor::new(contents.as_slice()); + let packet = ClientboundSetEquipment::azalea_read(&mut buf).unwrap(); + println!("{packet:?}"); + + assert_eq!(buf.position(), contents.len() as u64); + } +} |
