diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2025-02-22 21:45:26 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-22 21:45:26 -0600 |
| commit | e21e1b97bf9337e9f4747cd1b545b1b3a03e2ce7 (patch) | |
| tree | add6f8bfce40d0c07845d8aa4c9945a0b918444c /azalea-client/src/respawn.rs | |
| parent | f8130c3c92946d2293634ba4e252d6bc93026c3c (diff) | |
| download | azalea-drasl-e21e1b97bf9337e9f4747cd1b545b1b3a03e2ce7.tar.xz | |
Refactor azalea-client (#205)
* start organizing packet_handling more by moving packet handlers into their own functions
* finish writing all the handler functions for packets
* use macro for generating match statement for packet handler functions
* fix set_entity_data
* update config state to also use handler functions
* organize az-client file structure by moving things into plugins directory
* fix merge issues
Diffstat (limited to 'azalea-client/src/respawn.rs')
| -rw-r--r-- | azalea-client/src/respawn.rs | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/azalea-client/src/respawn.rs b/azalea-client/src/respawn.rs deleted file mode 100644 index 41d1c470..00000000 --- a/azalea-client/src/respawn.rs +++ /dev/null @@ -1,34 +0,0 @@ -use azalea_protocol::packets::game::s_client_command::{self, ServerboundClientCommand}; -use bevy_app::{App, Plugin, Update}; -use bevy_ecs::prelude::*; - -use crate::packet_handling::game::{SendPacketEvent, handle_send_packet_event}; - -/// Tell the server that we're respawning. -#[derive(Event, Debug, Clone)] -pub struct PerformRespawnEvent { - pub entity: Entity, -} - -/// A plugin that makes [`PerformRespawnEvent`] send the packet to respawn. -pub struct RespawnPlugin; -impl Plugin for RespawnPlugin { - fn build(&self, app: &mut App) { - app.add_event::<PerformRespawnEvent>() - .add_systems(Update, perform_respawn.before(handle_send_packet_event)); - } -} - -pub fn perform_respawn( - mut events: EventReader<PerformRespawnEvent>, - mut send_packets: EventWriter<SendPacketEvent>, -) { - for event in events.read() { - send_packets.send(SendPacketEvent::new( - event.entity, - ServerboundClientCommand { - action: s_client_command::Action::PerformRespawn, - }, - )); - } -} |
