diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2023-12-05 10:59:05 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-05 10:59:05 -0600 |
| commit | 7857a014b92e64361ee237ceae7ef1acc185ac46 (patch) | |
| tree | 5d70ea6b41943493873810e6a03c3483ff90a235 /azalea-protocol/src/packets/game/clientbound_explode_packet.rs | |
| parent | ea3e8600126a58f5666d50fbf70dff8209d8979f (diff) | |
| download | azalea-drasl-7857a014b92e64361ee237ceae7ef1acc185ac46.tar.xz | |
1.20.3 (#110)
* 23w40a
* 23w41a
* 23w42a
* 23w43a
* 23w44a
* serialize FormattedText as nbt in network
* use azalea-nbt/serde in azalea-chat
* 23w45a
* fix 23w45a to compile
* handle Object in codegen
* 1.20.3-pre2
* remove unused clientbound_resource_pack_packet.rs
* merge main and make azalea-chat use simdnbt
* 1.20.3-rc1
* fix tests
* use simdnbt 0.3
* fix ServerboundSetJigsawBlockPacket
* 1.20.3
Diffstat (limited to 'azalea-protocol/src/packets/game/clientbound_explode_packet.rs')
| -rwxr-xr-x | azalea-protocol/src/packets/game/clientbound_explode_packet.rs | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/azalea-protocol/src/packets/game/clientbound_explode_packet.rs b/azalea-protocol/src/packets/game/clientbound_explode_packet.rs index 720f06a4..ae39135a 100755 --- a/azalea-protocol/src/packets/game/clientbound_explode_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_explode_packet.rs @@ -1,8 +1,11 @@ use std::io::{Cursor, Write}; -use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable}; +use azalea_buf::{ + BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable, +}; use azalea_core::position::BlockPos; use azalea_protocol_macros::ClientboundGamePacket; +use azalea_registry::{ParticleKind, SoundEvent}; #[derive(Clone, Debug, PartialEq, ClientboundGamePacket)] pub struct ClientboundExplodePacket { @@ -14,6 +17,18 @@ pub struct ClientboundExplodePacket { pub knockback_x: f32, pub knockback_y: f32, pub knockback_z: f32, + pub block_interaction: BlockInteraction, + pub small_explosion_particles: ParticleKind, + pub large_explosion_particles: ParticleKind, + pub explosion_sound: SoundEvent, +} + +#[derive(Clone, Copy, Debug, PartialEq, McBuf)] +pub enum BlockInteraction { + Keep, + Destroy, + DestroyWithDecay, + TriggerBlock, } impl McBufReadable for ClientboundExplodePacket { @@ -41,6 +56,11 @@ impl McBufReadable for ClientboundExplodePacket { let knockback_y = f32::read_from(buf)?; let knockback_z = f32::read_from(buf)?; + let block_interaction = BlockInteraction::read_from(buf)?; + let small_explosion_particles = ParticleKind::read_from(buf)?; + let large_explosion_particles = ParticleKind::read_from(buf)?; + let explosion_sound = SoundEvent::read_from(buf)?; + Ok(Self { x, y, @@ -50,6 +70,10 @@ impl McBufReadable for ClientboundExplodePacket { knockback_x, knockback_y, knockback_z, + block_interaction, + small_explosion_particles, + large_explosion_particles, + explosion_sound, }) } } @@ -80,6 +104,12 @@ impl McBufWritable for ClientboundExplodePacket { self.knockback_x.write_into(buf)?; self.knockback_y.write_into(buf)?; self.knockback_z.write_into(buf)?; + + self.block_interaction.write_into(buf)?; + self.small_explosion_particles.write_into(buf)?; + self.large_explosion_particles.write_into(buf)?; + self.explosion_sound.write_into(buf)?; + Ok(()) } } @@ -110,6 +140,10 @@ mod tests { knockback_x: 1_000.0, knockback_y: 2_000.0, knockback_z: 3_000.0, + block_interaction: BlockInteraction::Destroy, + small_explosion_particles: ParticleKind::Explosion, + large_explosion_particles: ParticleKind::ExplosionEmitter, + explosion_sound: SoundEvent::EntityGenericExplode, }; let mut buf = Vec::new(); packet.write_into(&mut buf).unwrap(); |
