azalea_protocol/packets/game/
c_level_particles.rs

1use azalea_buf::AzBuf;
2use azalea_core::position::Vec3;
3use azalea_entity::particle::Particle;
4use azalea_protocol_macros::ClientboundGamePacket;
5
6#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
7pub struct ClientboundLevelParticles {
8    pub override_limiter: bool,
9    pub always_show: bool,
10    pub pos: Vec3,
11    pub x_dist: f32,
12    pub y_dist: f32,
13    pub z_dist: f32,
14    pub max_speed: f32,
15    pub count: u32,
16    pub particle: Particle,
17}
18
19#[cfg(test)]
20mod tests {
21    use std::io::Cursor;
22
23    use azalea_buf::AzaleaRead;
24
25    use super::*;
26
27    #[test]
28    fn test_c_level_particles_packet() {
29        #[rustfmt::skip]
30        let slice = [0, 0, 192, 159, 104, 133, 28, 126, 5, 107, 192, 59, 0, 0, 0, 0, 0, 0, 64, 140, 27, 255, 120, 249, 188, 204, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 47, 1, 251, 245, 15, 64, 29, 194, 144, 12];
31        let mut bytes = Cursor::new(slice.as_slice());
32
33        let packet = ClientboundLevelParticles::azalea_read(&mut bytes).unwrap();
34        println!("{packet:?}");
35        assert_eq!(bytes.position(), slice.len() as u64);
36    }
37}