Skip to main content

azalea_protocol/packets/game/
c_set_entity_data.rs

1use azalea_buf::AzBuf;
2use azalea_core::entity_id::MinecraftEntityId;
3use azalea_entity::EntityMetadataItems;
4use azalea_protocol_macros::ClientboundGamePacket;
5
6#[derive(AzBuf, ClientboundGamePacket, Clone, Debug, PartialEq)]
7pub struct ClientboundSetEntityData {
8    #[var]
9    pub id: MinecraftEntityId,
10    pub packed_items: EntityMetadataItems,
11}
12
13#[cfg(test)]
14mod tests {
15    use std::io::Cursor;
16
17    use azalea_buf::AzBuf;
18
19    use crate::packets::game::ClientboundSetEntityData;
20
21    #[test]
22    fn read_set_entity_data() {
23        // from hypixel
24        #[rustfmt::skip]
25        let contents = [173, 179, 148, 8, 10, 17, 1, 28, 38, 124, 175, 198, 255];
26        let mut buf = Cursor::new(contents.as_slice());
27        let _packet = ClientboundSetEntityData::azalea_read(&mut buf).unwrap();
28
29        assert_eq!(buf.position(), contents.len() as u64);
30    }
31}