From 249fa55a53d3011cd0223c0dc5673e9a7b81db8e Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 13 Mar 2025 20:52:29 +0000 Subject: fix wrong Potion data component --- azalea-inventory/src/components.rs | 1 + azalea-protocol/src/packets/game/c_set_entity_data.rs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/azalea-inventory/src/components.rs b/azalea-inventory/src/components.rs index 2ff00d5b..1d92faf3 100644 --- a/azalea-inventory/src/components.rs +++ b/azalea-inventory/src/components.rs @@ -512,6 +512,7 @@ pub struct PotionContents { pub potion: Option, pub custom_color: Option, pub custom_effects: Vec, + pub custom_name: Option, } impl DataComponent for PotionContents { const KIND: DataComponentKind = DataComponentKind::PotionContents; diff --git a/azalea-protocol/src/packets/game/c_set_entity_data.rs b/azalea-protocol/src/packets/game/c_set_entity_data.rs index fb77163b..a7042417 100755 --- a/azalea-protocol/src/packets/game/c_set_entity_data.rs +++ b/azalea-protocol/src/packets/game/c_set_entity_data.rs @@ -31,4 +31,21 @@ mod tests { packet.write(&mut buf).unwrap(); assert_eq!(buf, contents); } + + #[test] + fn test_read_hypixel_entity_data_2() { + let contents = [ + 161, 21, 2, 6, 0, 5, 8, 0, 6, 21, 0, 7, 1, 0, 1, 1, 172, 2, 3, 8, 0, 4, 8, 0, 9, 1, 0, + 0, 0, 0, 8, 7, 1, 186, 9, 2, 0, 5, 10, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 1, + 8, 0, 5, 99, 111, 108, 111, 114, 0, 9, 100, 97, 114, 107, 95, 97, 113, 117, 97, 1, 0, + 4, 98, 111, 108, 100, 1, 8, 0, 4, 116, 101, 120, 116, 0, 18, 67, 108, 111, 117, 100, + 32, 82, 101, 103, 101, 110, 101, 114, 97, 116, 105, 111, 110, 0, 8, 0, 4, 116, 101, + 120, 116, 0, 0, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 0, 41, 1, 31, 0, 0, 0, 255, + ]; + let mut buf = Cursor::new(contents.as_slice()); + let packet = ClientboundSetEntityData::azalea_read(&mut buf).unwrap(); + println!("{:?}", packet); + + assert_eq!(buf.position(), contents.len() as u64); + } } -- cgit v1.2.3