diff options
| author | mat <git@matdoes.dev> | 2026-03-18 16:28:46 -1030 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2026-03-20 04:21:58 -0200 |
| commit | 25cd1c0b60604655b70d70f8ec33a54853905eea (patch) | |
| tree | 28911045f6d69b2fffcb8d9c5a92fe32657b5e4b /azalea-client/src/plugins | |
| parent | b03d2942e1bef98e13acadde5cbb8856a3f8c74d (diff) | |
| download | azalea-drasl-25cd1c0b60604655b70d70f8ec33a54853905eea.tar.xz | |
optimize pathfinder swarms and write perf guide
Diffstat (limited to 'azalea-client/src/plugins')
| -rw-r--r-- | azalea-client/src/plugins/packet/config/mod.rs | 4 | ||||
| -rw-r--r-- | azalea-client/src/plugins/packet/game/events.rs | 2 | ||||
| -rw-r--r-- | azalea-client/src/plugins/packet/game/mod.rs | 30 | ||||
| -rw-r--r-- | azalea-client/src/plugins/packet/mod.rs | 1 |
4 files changed, 18 insertions, 19 deletions
diff --git a/azalea-client/src/plugins/packet/config/mod.rs b/azalea-client/src/plugins/packet/config/mod.rs index f59b8c23..5d0532d5 100644 --- a/azalea-client/src/plugins/packet/config/mod.rs +++ b/azalea-client/src/plugins/packet/config/mod.rs @@ -128,8 +128,8 @@ impl ConfigPacketHandler<'_> { self.player ); - as_system::<(Commands, MessageWriter<_>)>(self.ecs, |(mut commands, mut events)| { - events.write(KeepAliveEvent { + as_system::<Commands>(self.ecs, |mut commands| { + commands.trigger(KeepAliveEvent { entity: self.player, id: p.id, }); diff --git a/azalea-client/src/plugins/packet/game/events.rs b/azalea-client/src/plugins/packet/game/events.rs index bc070ec8..02be26f3 100644 --- a/azalea-client/src/plugins/packet/game/events.rs +++ b/azalea-client/src/plugins/packet/game/events.rs @@ -113,7 +113,7 @@ pub struct DeathEvent { /// A KeepAlive packet is sent from the server to verify that the client is /// still connected. -#[derive(Clone, Debug, Message)] +#[derive(Clone, Debug, EntityEvent)] pub struct KeepAliveEvent { pub entity: Entity, /// The ID of the keepalive. diff --git a/azalea-client/src/plugins/packet/game/mod.rs b/azalea-client/src/plugins/packet/game/mod.rs index 81eac46b..e7e709e8 100644 --- a/azalea-client/src/plugins/packet/game/mod.rs +++ b/azalea-client/src/plugins/packet/game/mod.rs @@ -925,19 +925,16 @@ impl GamePacketHandler<'_> { pub fn keep_alive(&mut self, p: &ClientboundKeepAlive) { debug!("Got keep alive packet {p:?} for {:?}", self.player); - as_system::<(MessageWriter<KeepAliveEvent>, Commands)>( - self.ecs, - |(mut keepalive_events, mut commands)| { - keepalive_events.write(KeepAliveEvent { - entity: self.player, - id: p.id, - }); - commands.trigger(SendGamePacketEvent::new( - self.player, - ServerboundKeepAlive { id: p.id }, - )); - }, - ); + as_system::<Commands>(self.ecs, |mut commands| { + commands.trigger(KeepAliveEvent { + entity: self.player, + id: p.id, + }); + commands.trigger(SendGamePacketEvent::new( + self.player, + ServerboundKeepAlive { id: p.id }, + )); + }); } pub fn remove_entities(&mut self, p: &ClientboundRemoveEntities) { @@ -1674,11 +1671,14 @@ fn move_entity( let Some(entity) = entity else { // often triggered by hypixel :( - debug!("Got move move entity packet for unknown entity id {entity_id}"); + debug!("Got move entity packet for unknown entity id {entity_id}"); return; }; - let (mut physics, mut position, mut look_direction) = entity_query.get_mut(entity).unwrap(); + let Ok((mut physics, mut position, mut look_direction)) = entity_query.get_mut(entity) else { + debug!("Got move entity packet for entity with missing components {entity_id}"); + return; + }; if !should_apply_entity_update( &mut commands, diff --git a/azalea-client/src/plugins/packet/mod.rs b/azalea-client/src/plugins/packet/mod.rs index e758ae5f..d7b0d9df 100644 --- a/azalea-client/src/plugins/packet/mod.rs +++ b/azalea-client/src/plugins/packet/mod.rs @@ -48,7 +48,6 @@ impl Plugin for PacketPlugin { .add_message::<game::UpdatePlayerEvent>() .add_message::<ChatReceivedEvent>() .add_message::<game::DeathEvent>() - .add_message::<game::KeepAliveEvent>() .add_message::<game::ResourcePackEvent>() .add_message::<game::WorldLoadedEvent>() .add_message::<login::ReceiveCustomQueryEvent>(); |
