Skip to content

Commit

Permalink
make scoreboard systems run before UpdateLayersPreClientSet
Browse files Browse the repository at this point in the history
  • Loading branch information
dyc3 committed Aug 5, 2023
1 parent 0b1392d commit 773268b
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions crates/valence_scoreboard/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use valence_core::__private::VarInt;
use valence_core::despawn::Despawned;
use valence_core::text::IntoText;
use valence_entity::EntityLayerId;
use valence_layer::EntityLayer;
use valence_layer::{EntityLayer, UpdateLayersPreClientSet};
pub use valence_packet::packets::play::scoreboard_display_s2c::ScoreboardPosition;
use valence_packet::packets::play::scoreboard_display_s2c::*;
pub use valence_packet::packets::play::scoreboard_objective_update_s2c::ObjectiveRenderType;
Expand All @@ -45,24 +45,34 @@ pub struct ScoreboardPlugin;

impl Plugin for ScoreboardPlugin {
fn build(&self, app: &mut App) {
app.configure_set(PostUpdate, ScoreboardSet.before(UpdateLayersPreClientSet));

app.add_systems(
PostUpdate,
(
create_or_update_objectives,
display_objectives.after(create_or_update_objectives),
),
)
.in_set(ScoreboardSet),
)
.add_systems(PostUpdate, remove_despawned_objectives)
.add_systems(PostUpdate, handle_new_clients)
.add_systems(
PostUpdate,
remove_despawned_objectives.in_set(ScoreboardSet),
)
.add_systems(PostUpdate, handle_new_clients.in_set(ScoreboardSet))
.add_systems(
PostUpdate,
update_scores
.after(create_or_update_objectives)
.after(handle_new_clients),
.after(handle_new_clients)
.in_set(ScoreboardSet),
);
}
}

#[derive(SystemSet, Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub struct ScoreboardSet;

fn create_or_update_objectives(
objectives: Query<
(
Expand Down

0 comments on commit 773268b

Please sign in to comment.