azalea_protocol/packets/game/
c_level_particles.rs1use 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 = [
31 0, 0, 64, 156, 51, 153, 153, 153, 153, 154, 192, 64, 140, 204, 204, 204, 204, 205, 63, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 13, 255, 0, 255, 255, 63, 128, 0, 0
32 ];
33 let mut bytes = Cursor::new(slice.as_slice());
34
35 let packet = ClientboundLevelParticles::azalea_read(&mut bytes).unwrap();
36 println!("{packet:?}");
37 assert_eq!(bytes.position(), slice.len() as u64);
38 }
39}