azalea_client/plugins/
tick_end.rs1use azalea_core::tick::GameTick;
4use azalea_entity::LocalEntity;
5use azalea_physics::PhysicsSet;
6use azalea_protocol::packets::game::ServerboundClientTickEnd;
7use azalea_world::InstanceName;
8use bevy_app::{App, Plugin};
9use bevy_ecs::prelude::*;
10
11use crate::{mining::MiningSet, packet::game::SendPacketEvent};
12
13pub struct TickEndPlugin;
16impl Plugin for TickEndPlugin {
17 fn build(&self, app: &mut App) {
18 app.add_systems(
19 GameTick,
20 game_tick_packet
22 .after(PhysicsSet)
23 .after(MiningSet)
24 .after(crate::movement::send_position),
25 );
26 }
27}
28
29pub fn game_tick_packet(
30 query: Query<Entity, (With<LocalEntity>, With<InstanceName>)>,
31 mut commands: Commands,
32) {
33 for entity in query.iter() {
34 commands.trigger(SendPacketEvent::new(entity, ServerboundClientTickEnd));
35 }
36}