diff options
| author | mat <git@matdoes.dev> | 2025-09-29 02:01:50 +0700 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-09-29 02:01:50 +0700 |
| commit | a80d8d1b242430c4a251876fa67bfd26af7a0de9 (patch) | |
| tree | e683100c2f68fed0729dbaa12e7ef189189350be /azalea-client/src/plugins/packet | |
| parent | 2c8b7c5c2c9297273abfba8f7743f1bc25f166b1 (diff) | |
| download | azalea-drasl-a80d8d1b242430c4a251876fa67bfd26af7a0de9.tar.xz | |
rename SendPacketEvent to SendGamePacketEvent and PingEvent to GamePingEvent
Diffstat (limited to 'azalea-client/src/plugins/packet')
| -rw-r--r-- | azalea-client/src/plugins/packet/game/events.rs | 10 | ||||
| -rw-r--r-- | azalea-client/src/plugins/packet/game/mod.rs | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/azalea-client/src/plugins/packet/game/events.rs b/azalea-client/src/plugins/packet/game/events.rs index 4ae51734..cb9a5e07 100644 --- a/azalea-client/src/plugins/packet/game/events.rs +++ b/azalea-client/src/plugins/packet/game/events.rs @@ -18,7 +18,7 @@ use crate::{client::InGameState, connection::RawConnection, player::PlayerInfo}; /// ``` /// # use azalea_client::packet::game::ReceiveGamePacketEvent; /// # use azalea_protocol::packets::game::ClientboundGamePacket; -/// # use bevy_ecs::event::MessageReader; +/// # use bevy_ecs::message::MessageReader; /// /// fn handle_packets(mut events: MessageReader<ReceiveGamePacketEvent>) { /// for ReceiveGamePacketEvent { entity, packet } in events.read() { @@ -41,12 +41,12 @@ pub struct ReceiveGamePacketEvent { /// An event for sending a packet to the server while we're in the `game` state. #[derive(EntityEvent, Clone, Debug)] -pub struct SendPacketEvent { +pub struct SendGamePacketEvent { #[event_target] pub sent_by: Entity, pub packet: ServerboundGamePacket, } -impl SendPacketEvent { +impl SendGamePacketEvent { pub fn new(sent_by: Entity, packet: impl Packet<ServerboundGamePacket>) -> Self { let packet = packet.into_variant(); Self { sent_by, packet } @@ -54,7 +54,7 @@ impl SendPacketEvent { } pub fn handle_outgoing_packets_observer( - trigger: On<SendPacketEvent>, + trigger: On<SendGamePacketEvent>, mut query: Query<(&mut RawConnection, Option<&InGameState>)>, ) { let event = trigger.event(); @@ -152,7 +152,7 @@ pub struct InstanceLoadedEvent { /// [`ClientboundPing`]: azalea_protocol::packets::game::ClientboundPing /// [`ConfigPingEvent`]: crate::packet::config::ConfigPingEvent #[derive(EntityEvent, Debug, Clone)] -pub struct PingEvent { +pub struct GamePingEvent { pub entity: Entity, pub packet: azalea_protocol::packets::game::ClientboundPing, } diff --git a/azalea-client/src/plugins/packet/game/mod.rs b/azalea-client/src/plugins/packet/game/mod.rs index dbdc8e26..ed45ab61 100644 --- a/azalea-client/src/plugins/packet/game/mod.rs +++ b/azalea-client/src/plugins/packet/game/mod.rs @@ -420,11 +420,11 @@ impl GamePacketHandler<'_> { physics.set_old_pos(*position); // send the relevant packets - commands.trigger(SendPacketEvent::new( + commands.trigger(SendGamePacketEvent::new( self.player, ServerboundAcceptTeleportation { id: p.id }, )); - commands.trigger(SendPacketEvent::new( + commands.trigger(SendGamePacketEvent::new( self.player, ServerboundMovePlayerPosRot { pos: **position, @@ -964,7 +964,7 @@ impl GamePacketHandler<'_> { entity: self.player, id: p.id, }); - commands.trigger(SendPacketEvent::new( + commands.trigger(SendGamePacketEvent::new( self.player, ServerboundKeepAlive { id: p.id }, )); @@ -1278,7 +1278,7 @@ impl GamePacketHandler<'_> { debug!("Got ping packet {p:?}"); as_system::<Commands>(self.ecs, |mut commands| { - commands.trigger(PingEvent { + commands.trigger(GamePingEvent { entity: self.player, packet: p.clone(), }); @@ -1443,7 +1443,7 @@ impl GamePacketHandler<'_> { }; raw_conn.state = ConnectionProtocol::Configuration; - commands.trigger(SendPacketEvent::new( + commands.trigger(SendGamePacketEvent::new( self.player, ServerboundConfigurationAcknowledged, )); |
