diff options
Diffstat (limited to 'azalea-client/src/plugins/attack.rs')
| -rw-r--r-- | azalea-client/src/plugins/attack.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/azalea-client/src/plugins/attack.rs b/azalea-client/src/plugins/attack.rs index 7d730bb7..47e45896 100644 --- a/azalea-client/src/plugins/attack.rs +++ b/azalea-client/src/plugins/attack.rs @@ -19,7 +19,7 @@ use crate::{ pub struct AttackPlugin; impl Plugin for AttackPlugin { fn build(&self, app: &mut App) { - app.add_event::<AttackEvent>() + app.add_message::<AttackEvent>() .add_systems( Update, handle_attack_event @@ -45,7 +45,7 @@ impl Plugin for AttackPlugin { impl Client { /// Attack the entity with the given id. pub fn attack(&self, entity: Entity) { - self.ecs.lock().send_event(AttackEvent { + self.ecs.lock().write_message(AttackEvent { entity: self.entity, target: entity, }); @@ -148,14 +148,14 @@ pub fn handle_attack_queued( /// Queues up an attack packet for next tick by inserting the [`AttackQueued`] /// component to our client. -#[derive(Event)] +#[derive(Message)] pub struct AttackEvent { /// Our client entity that will send the packets to attack. pub entity: Entity, /// The entity that will be attacked. pub target: Entity, } -pub fn handle_attack_event(mut events: EventReader<AttackEvent>, mut commands: Commands) { +pub fn handle_attack_event(mut events: MessageReader<AttackEvent>, mut commands: Commands) { for event in events.read() { commands.entity(event.entity).insert(AttackQueued { target: event.target, |
