diff options
| author | mat <github@matdoes.dev> | 2022-05-14 20:43:25 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-05-14 20:43:25 -0500 |
| commit | c16e958d0be671a17edf060aee9850faccbcfe14 (patch) | |
| tree | ff4996b89d6f34c7c452d1b2950e53d512bce3c1 /azalea-protocol | |
| parent | 9fc71ab2d1e669fb3533f3012921b1e8dbacd257 (diff) | |
| download | azalea-drasl-c16e958d0be671a17edf060aee9850faccbcfe14.tar.xz | |
ClientboundLevelParticlesPacket works
Diffstat (limited to 'azalea-protocol')
| -rw-r--r-- | azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs b/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs index 43c3b31a..a3538598 100644 --- a/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs @@ -1,7 +1,9 @@ -use crate::mc_buf::ParticleData; -use packet_macros::{GamePacket, McBuf}; +use std::io::{Read, Write}; -#[derive(Clone, Debug, McBuf, GamePacket)] +use crate::mc_buf::{McBufReadable, McBufWritable, ParticleData}; +use packet_macros::GamePacket; + +#[derive(Clone, Debug, GamePacket)] pub struct ClientboundLevelParticlesPacket { pub particle_id: u32, pub override_limiter: bool, @@ -15,3 +17,40 @@ pub struct ClientboundLevelParticlesPacket { pub count: i32, pub data: ParticleData, } + +impl McBufReadable for ClientboundLevelParticlesPacket { + fn read_into(buf: &mut impl Read) -> Result<Self, String> { + let particle_id = u32::read_into(buf)?; + let override_limiter = bool::read_into(buf)?; + let x = f64::read_into(buf)?; + let y = f64::read_into(buf)?; + let z = f64::read_into(buf)?; + let x_dist = f32::read_into(buf)?; + let y_dist = f32::read_into(buf)?; + let z_dist = f32::read_into(buf)?; + let max_speed = f32::read_into(buf)?; + let count = i32::read_into(buf)?; + + let data = ParticleData::read_from_particle_id(buf, particle_id)?; + + Ok(Self { + particle_id, + override_limiter, + x, + y, + z, + x_dist, + y_dist, + z_dist, + max_speed, + count, + data, + }) + } +} + +impl McBufWritable for ClientboundLevelParticlesPacket { + fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + todo!(); + } +} |
