diff options
| author | mat <git@matdoes.dev> | 2025-12-16 09:42:54 -0200 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-12-16 09:42:54 -0200 |
| commit | 6f2fe2c9e5af1f2fa2c1b99c3d4ea0a7e90ae16c (patch) | |
| tree | b01afabf10b51e3024dfdc139803b590a36b08c2 /azalea-client/src/plugins/packet | |
| parent | 9bd529277f5025805da95f081657c180972e487e (diff) | |
| download | azalea-drasl-6f2fe2c9e5af1f2fa2c1b99c3d4ea0a7e90ae16c.tar.xz | |
change KnockbackEvent to an EntityEvent and fix ClientboundExplode representation
ty mahtog for pointing out the latter issue <3
Diffstat (limited to 'azalea-client/src/plugins/packet')
| -rw-r--r-- | azalea-client/src/plugins/packet/game/mod.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/azalea-client/src/plugins/packet/game/mod.rs b/azalea-client/src/plugins/packet/game/mod.rs index f39a9f8f..edb755c9 100644 --- a/azalea-client/src/plugins/packet/game/mod.rs +++ b/azalea-client/src/plugins/packet/game/mod.rs @@ -34,7 +34,7 @@ use crate::{ interact::BlockStatePredictionHandler, inventory::{ClientsideCloseContainerEvent, MenuOpenedEvent, SetContainerContentEvent}, local_player::{Hunger, InstanceHolder, LocalGameMode, TabList}, - movement::{KnockbackEvent, KnockbackType}, + movement::{KnockbackData, KnockbackEvent}, packet::{as_system, declare_packet_handlers}, player::{GameProfileComponent, PlayerInfo}, tick_counter::TicksConnected, @@ -738,14 +738,13 @@ impl GamePacketHandler<'_> { // this is to make sure the same entity velocity update doesn't get sent // multiple times when in swarms - let knockback = KnockbackType::Set(p.delta.to_vec3()); + let data = KnockbackData::Set(p.delta.to_vec3()); commands.entity(entity).queue(RelativeEntityUpdate::new( instance_holder.partial_instance.clone(), move |entity_mut| { - entity_mut.world_scope(|world| { - world.write_message(KnockbackEvent { entity, knockback }) - }); + entity_mut + .world_scope(|world| world.trigger(KnockbackEvent { entity, data })); }, )); }, @@ -1262,13 +1261,13 @@ impl GamePacketHandler<'_> { pub fn delete_chat(&mut self, _p: &ClientboundDeleteChat) {} pub fn explode(&mut self, p: &ClientboundExplode) { - trace!("Got explode packet {p:?}"); + println!("Got explode packet {p:?}"); - as_system::<MessageWriter<_>>(self.ecs, |mut knockback_events| { + as_system::<Commands>(self.ecs, |mut knockback_events| { if let Some(knockback) = p.player_knockback { - knockback_events.write(KnockbackEvent { + knockback_events.trigger(KnockbackEvent { entity: self.player, - knockback: KnockbackType::Set(knockback), + data: KnockbackData::Set(knockback), }); } }); |
