1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 14:26:04 +00:00

fix wrong Potion data component

This commit is contained in:
mat 2025-03-13 20:52:29 +00:00
parent 65fe072151
commit 249fa55a53
2 changed files with 18 additions and 0 deletions

View file

@ -512,6 +512,7 @@ pub struct PotionContents {
pub potion: Option<Potion>,
pub custom_color: Option<i32>,
pub custom_effects: Vec<MobEffectInstance>,
pub custom_name: Option<String>,
}
impl DataComponent for PotionContents {
const KIND: DataComponentKind = DataComponentKind::PotionContents;

View file

@ -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);
}
}