aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/client.rs
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2023-07-09 19:11:29 -0500
committerGitHub <noreply@github.com>2023-07-09 19:11:29 -0500
commitd1afd02aa84e7b4450c1607277f078eb2a0f1bf3 (patch)
treeefea9bb7ef7f2064f7c963fd88f394fecec6231b /azalea-client/src/client.rs
parentea8a8fccb6eb39c97f6cb69e11db5f7d0886172e (diff)
downloadazalea-drasl-d1afd02aa84e7b4450c1607277f078eb2a0f1bf3.tar.xz
Update to Bevy 0.11 (#94)
* update to bevy 0.11 * clippy --------- Co-authored-by: mat <git@matdoes.dev>
Diffstat (limited to 'azalea-client/src/client.rs')
-rw-r--r--azalea-client/src/client.rs45
1 files changed, 21 insertions, 24 deletions
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs
index ee133dd5..725cd9f3 100644
--- a/azalea-client/src/client.rs
+++ b/azalea-client/src/client.rs
@@ -45,13 +45,12 @@ use azalea_world::{
entity::{EntityPlugin, EntityUpdateSet, Local, Position, WorldName},
Instance, InstanceContainer, PartialInstance,
};
-use bevy_app::{App, CoreSchedule, IntoSystemAppConfig, Plugin, PluginGroup, PluginGroupBuilder};
+use bevy_app::{App, FixedUpdate, Main, Plugin, PluginGroup, PluginGroupBuilder, Update};
use bevy_ecs::{
bundle::Bundle,
component::Component,
entity::Entity,
- schedule::IntoSystemConfig,
- schedule::{LogLevel, ScheduleBuildSettings, ScheduleLabel},
+ schedule::{IntoSystemConfigs, LogLevel, ScheduleBuildSettings, ScheduleLabel},
system::{ResMut, Resource},
world::World,
};
@@ -568,20 +567,20 @@ pub struct AzaleaPlugin;
impl Plugin for AzaleaPlugin {
fn build(&self, app: &mut App) {
// Minecraft ticks happen every 50ms
- app.insert_resource(FixedTime::new(Duration::from_millis(50)));
-
- app.add_system(update_in_loaded_chunk.after(PhysicsSet));
-
- // fire the Death event when the player dies.
- app.add_system(death_event);
-
- // add GameProfileComponent when we get an AddPlayerEvent
- app.add_system(retroactively_add_game_profile_component.after(EntityUpdateSet::Index));
-
- app.add_event::<SendPacketEvent>()
- .add_system(handle_send_packet_event);
-
- app.init_resource::<InstanceContainer>();
+ app.insert_resource(FixedTime::new(Duration::from_millis(50)))
+ .add_systems(
+ Update,
+ (
+ update_in_loaded_chunk.after(PhysicsSet),
+ // fire the Death event when the player dies.
+ death_event,
+ // add GameProfileComponent when we get an AddPlayerEvent
+ retroactively_add_game_profile_component.after(EntityUpdateSet::Index),
+ handle_send_packet_event,
+ ),
+ )
+ .add_event::<SendPacketEvent>()
+ .init_resource::<InstanceContainer>();
}
}
@@ -591,19 +590,17 @@ impl Plugin for AzaleaPlugin {
/// [`DefaultPlugins`].
#[doc(hidden)]
pub fn start_ecs(
- mut app: App,
+ app: App,
run_schedule_receiver: mpsc::UnboundedReceiver<()>,
run_schedule_sender: mpsc::UnboundedSender<()>,
) -> Arc<Mutex<World>> {
- app.setup();
-
// all resources should have been added by now so we can take the ecs from the
// app
let ecs = Arc::new(Mutex::new(app.world));
tokio::spawn(run_schedule_loop(
ecs.clone(),
- app.outer_schedule_label,
+ app.main_schedule_label,
run_schedule_receiver,
));
tokio::spawn(tick_run_schedule_loop(run_schedule_sender));
@@ -620,7 +617,7 @@ async fn run_schedule_loop(
// whenever we get an event from run_schedule_receiver, run the schedule
run_schedule_receiver.recv().await;
let mut ecs = ecs.lock();
- ecs.run_schedule_ref(&*outer_schedule_label);
+ ecs.run_schedule(&outer_schedule_label);
ecs.clear_trackers();
}
}
@@ -671,14 +668,14 @@ pub struct TickBroadcastPlugin;
impl Plugin for TickBroadcastPlugin {
fn build(&self, app: &mut App) {
app.insert_resource(TickBroadcast(broadcast::channel(1).0))
- .add_system(send_tick_broadcast.in_schedule(CoreSchedule::FixedUpdate));
+ .add_systems(FixedUpdate, send_tick_broadcast);
}
}
pub struct AmbiguityLoggerPlugin;
impl Plugin for AmbiguityLoggerPlugin {
fn build(&self, app: &mut App) {
- app.edit_schedule(CoreSchedule::Main, |schedule| {
+ app.edit_schedule(Main, |schedule| {
schedule.set_build_settings(ScheduleBuildSettings {
ambiguity_detection: LogLevel::Warn,
..Default::default()