Skip to content

Commit

Permalink
Update Bevy and migrate to workspace dependencies and package attribu…
Browse files Browse the repository at this point in the history
…tes (#181)

* Use workspace `Cargo.toml` for dependencies and package atributes

* Fix a couple clippy warnings

* Update bevy, update build script, move deps to workspace, and fix clippy warnings

* Remove carrots from crate versions
The default behavior is the same

* Remove unused dependencies
Compiles and all tests pass, so it should be fine

* Update codegen to use `std::sync::LazyLock` instead of `once_cell::sync::Lazy`

* Update Bevy to `0.15.0-rc.3`
Surprisingly little needed to be changed

* Update to bevy 0.15.0

* Fix leftover merge issues

* Clarify the reason the swarm can't connect

* Fix duplicate lint, remove `log` dependency
  • Loading branch information
EightFactorial authored Dec 5, 2024
1 parent 241c752 commit 6379035
Show file tree
Hide file tree
Showing 42 changed files with 606 additions and 459 deletions.
468 changes: 310 additions & 158 deletions Cargo.lock

Large diffs are not rendered by default.

49 changes: 30 additions & 19 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,37 +1,46 @@
[workspace]
members = [
"azalea",
"azalea-client",
"azalea-protocol",
"azalea-chat",
"azalea-core",
"azalea-auth",
"azalea-block",
"azalea-brigadier",
"azalea-buf",
"azalea-chat",
"azalea-client",
"azalea-core",
"azalea-crypto",
"azalea-world",
"azalea-entity",
"azalea-inventory",
"azalea-language",
"azalea-block",
"azalea-buf",
"azalea-physics",
"azalea-protocol",
"azalea-registry",
"azalea-inventory",
"azalea-entity",
"azalea-world",
]
resolver = "2"

# --- Workspace Settings ---

[workspace.package]
version = "0.10.3+mc1.21.4"
edition = "2021"
license = "MIT"
repository = "https://github.com/azalea-rs/azalea"
# homepage = "https://github.com/azalea-rs/azalea"

[workspace.dependencies]
aes = "0.8.4"
anyhow = "1.0.93"
async-recursion = "1.1.1"
async-trait = "0.1.83"
base64 = "0.22.1"
bevy_app = "0.13.2"
bevy_ecs = { version = "0.13.2", default-features = false }
bevy_log = "0.13.2"
bevy_tasks = "0.13.2"
bevy_time = "0.13.2"
bevy_app = "0.15.0"
bevy_ecs = { version = "0.15.0", default-features = false }
bevy_log = "0.15.0"
bevy_tasks = "0.15.0"
bevy_time = "0.15.0"
byteorder = "1.5.0"
bytes = "1.8.0"
bytes = "1.9.0"
cfb8 = "0.8.1"
chrono = { version = "0.4.38", default-features = false }
criterion = "0.5.1"
Expand All @@ -55,7 +64,7 @@ quote = "1.0.37"
rand = "0.8.5"
regex = "1.11.1"
reqwest = { version = "0.12.9", default-features = false }
rsa = "0.9.6"
rsa = "0.9.7"
rsa_public_encrypt_pkcs1 = "0.4.0"
rustc-hash = "2.0.0"
serde = "1.0.215"
Expand All @@ -65,15 +74,17 @@ sha2 = "0.10.8"
simdnbt = "0.6"
#smallvec = "1.13.2"
socks5-impl = "0.5.17"
syn = "2.0.89"
syn = "2.0.90"
thiserror = "2.0.3"
tokio = "1.41.1"
tokio-util = "0.7.12"
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
tracing = "0.1.41"
tracing-subscriber = "0.3.19"
trust-dns-resolver = { version = "0.23.2", default-features = false }
uuid = "1.11.0"

# --- Profile Settings ---

[profile.release]
debug = true

Expand Down
12 changes: 5 additions & 7 deletions azalea-auth/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
[package]
description = "A port of Mojang's Authlib and launcher authentication."
edition = "2021"
license = "MIT"
name = "azalea-auth"
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-auth"
version = "0.10.3+mc1.21.4"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
description = "A port of Mojang's Authlib and launcher authentication."
version = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
repository = { workspace = true }

[dependencies]
azalea-buf = { path = "../azalea-buf", version = "0.10.0" }
Expand Down
16 changes: 6 additions & 10 deletions azalea-block/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
[package]
description = "Representation of Minecraft block states."
edition = "2021"
license = "MIT"
name = "azalea-block"
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-block"
version = "0.10.3+mc1.21.4"

[lib]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
description = "Representation of Minecraft block states."
version = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
repository = { workspace = true }

[dependencies]
azalea-block-macros = { path = "./azalea-block-macros", version = "0.10.0" }
azalea-buf = { path = "../azalea-buf", version = "0.10.0" }
azalea-registry = { version = "0.10.0", path = "../azalea-registry" }
azalea-registry = { path = "../azalea-registry", version = "0.10.0" }
12 changes: 5 additions & 7 deletions azalea-block/azalea-block-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
[package]
description = "Proc macros used by azalea-block."
edition = "2021"
license = "MIT"
name = "azalea-block-macros"
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-block/azalea-block-macros"
version = "0.10.3+mc1.21.4"
description = "Proc macros used by azalea-block."
version = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
repository = { workspace = true }

[lib]
proc-macro = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
proc-macro2 = { workspace = true }
quote = { workspace = true }
Expand Down
12 changes: 5 additions & 7 deletions azalea-brigadier/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
[package]
description = "A port of Mojang's Brigadier command parsing and dispatching library."
edition = "2021"
license = "MIT"
name = "azalea-brigadier"
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-brigadier"
version = "0.10.3+mc1.21.4"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
description = "A port of Mojang's Brigadier command parsing and dispatching library."
version = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
repository = { workspace = true }

[dev-dependencies]
bevy_app = { workspace = true }
Expand Down
16 changes: 12 additions & 4 deletions azalea-brigadier/tests/bevy_app_usage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,20 @@ fn bevy_app() {
app.init_resource::<DispatchStorage>();

// Process commands from bevy
app.world
.run_system_once(DispatchStorage::bevy_process_commands);
if let Err(err) = app
.world_mut()
.run_system_once(DispatchStorage::bevy_process_commands)
{
panic!("Failed to process commands: {err}");
}

// Verify spawned entities exist after processing commands
app.world
.run_system_once(DispatchStorage::verify_spawned_entities);
if let Err(err) = app
.world_mut()
.run_system_once(DispatchStorage::verify_spawned_entities)
{
panic!("Failed to verify spawned entities: {err}");
}
}

#[derive(Resource)]
Expand Down
12 changes: 5 additions & 7 deletions azalea-buf/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
[package]
description = "Serialize and deserialize buffers from Minecraft."
edition = "2021"
license = "MIT"
name = "azalea-buf"
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-buf"
version = "0.10.3+mc1.21.4"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
description = "Serialize and deserialize buffers from Minecraft."
version = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
repository = { workspace = true }

[dependencies]
azalea-buf-macros = { path = "./azalea-buf-macros", version = "0.10.0" }
Expand Down
11 changes: 5 additions & 6 deletions azalea-buf/azalea-buf-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
[package]
description = "#[derive(AzBuf)]"
edition = "2021"
license = "MIT"
name = "azalea-buf-macros"
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-buf"
version = "0.10.3+mc1.21.4"
description = "#[derive(AzBuf)]"
version = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
repository = { workspace = true }

[lib]
proc-macro = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
proc-macro2 = { workspace = true }
Expand Down
16 changes: 7 additions & 9 deletions azalea-chat/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
[package]
description = "Parse Minecraft chat messages."
edition = "2021"
license = "MIT"
name = "azalea-chat"
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-chat"
version = "0.10.3+mc1.21.4"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
description = "Parse Minecraft chat messages."
version = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
repository = { workspace = true }

[features]
default = []
Expand All @@ -15,9 +13,9 @@ azalea-buf = ["dep:azalea-buf", "simdnbt"]
numbers = ["dep:azalea-registry", "dep:simdnbt"]

[dependencies]
azalea-buf = { path = "../azalea-buf", features = [
azalea-buf = { path = "../azalea-buf", version = "0.10.0", optional = true, features = [
"serde_json",
], version = "0.10.0", optional = true }
] }
azalea-language = { path = "../azalea-language", version = "0.10.0" }
azalea-registry = { path = "../azalea-registry", version = "0.10.0", optional = true }
serde = { workspace = true, features = ["derive"] }
Expand Down
16 changes: 7 additions & 9 deletions azalea-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
[package]
description = "A headless Minecraft client."
edition = "2021"
license = "MIT"
name = "azalea-client"
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-client"
version = "0.10.3+mc1.21.4"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
description = "A headless Minecraft client."
version = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
repository = { workspace = true }

[dependencies]
anyhow = { workspace = true }
Expand All @@ -16,8 +14,8 @@ azalea-buf = { path = "../azalea-buf", version = "0.10.0" }
azalea-chat = { path = "../azalea-chat", version = "0.10.0" }
azalea-core = { path = "../azalea-core", version = "0.10.0" }
azalea-crypto = { path = "../azalea-crypto", version = "0.10.0" }
azalea-entity = { version = "0.10.0", path = "../azalea-entity" }
azalea-inventory = { version = "0.10.0", path = "../azalea-inventory" }
azalea-entity = { path = "../azalea-entity", version = "0.10.0" }
azalea-inventory = { path = "../azalea-inventory", version = "0.10.0" }
azalea-physics = { path = "../azalea-physics", version = "0.10.0" }
azalea-protocol = { path = "../azalea-protocol", version = "0.10.0" }
azalea-registry = { path = "../azalea-registry", version = "0.10.0" }
Expand Down
6 changes: 3 additions & 3 deletions azalea-client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -728,17 +728,17 @@ impl Plugin for AzaleaPlugin {
/// [`DefaultPlugins`].
#[doc(hidden)]
pub fn start_ecs_runner(
app: App,
mut app: App,
run_schedule_receiver: mpsc::UnboundedReceiver<()>,
run_schedule_sender: mpsc::UnboundedSender<()>,
) -> Arc<Mutex<World>> {
// 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));
let ecs = Arc::new(Mutex::new(std::mem::take(app.world_mut())));

tokio::spawn(run_schedule_loop(
ecs.clone(),
app.main_schedule_label,
*app.main().update_schedule.as_ref().unwrap(),
run_schedule_receiver,
));
tokio::spawn(tick_run_schedule_loop(run_schedule_sender));
Expand Down
2 changes: 1 addition & 1 deletion azalea-client/src/local_player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ pub fn death_event(query: Query<&LocalPlayerEvents, Added<Dead>>) {
}
}

#[allow(clippy::large_enum_variant)]
#[derive(Error, Debug)]
#[expect(clippy::large_enum_variant)]
pub enum HandlePacketError {
#[error("{0}")]
Poison(String),
Expand Down
12 changes: 6 additions & 6 deletions azalea-client/src/packet_handling/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ pub fn process_packet_events(ecs: &mut World) {

// we use RelativeEntityUpdate because it makes sure changes aren't made
// multiple times
commands.entity(entity).add(RelativeEntityUpdate {
commands.entity(entity).queue(RelativeEntityUpdate {
partial_world: instance_holder.partial_instance.clone(),
update: Box::new(move |entity| {
let entity_id = entity.id();
Expand Down Expand Up @@ -781,7 +781,7 @@ pub fn process_packet_events(ecs: &mut World) {
z: p.za as f64 / 8000.,
});

commands.entity(entity).add(RelativeEntityUpdate {
commands.entity(entity).queue(RelativeEntityUpdate {
partial_world: instance_holder.partial_instance.clone(),
update: Box::new(move |entity_mut| {
entity_mut.world_scope(|world| {
Expand Down Expand Up @@ -838,7 +838,7 @@ pub fn process_packet_events(ecs: &mut World) {
x_rot: (p.x_rot as i32 * 360) as f32 / 256.,
y_rot: (p.y_rot as i32 * 360) as f32 / 256.,
};
commands.entity(entity).add(RelativeEntityUpdate {
commands.entity(entity).queue(RelativeEntityUpdate {
partial_world: instance_holder.partial_instance.clone(),
update: Box::new(move |entity| {
let mut position = entity.get_mut::<Position>().unwrap();
Expand Down Expand Up @@ -875,7 +875,7 @@ pub fn process_packet_events(ecs: &mut World) {

if let Some(entity) = entity {
let delta = p.delta.clone();
commands.entity(entity).add(RelativeEntityUpdate {
commands.entity(entity).queue(RelativeEntityUpdate {
partial_world: instance_holder.partial_instance.clone(),
update: Box::new(move |entity_mut| {
let mut position = entity_mut.get_mut::<Position>().unwrap();
Expand Down Expand Up @@ -911,7 +911,7 @@ pub fn process_packet_events(ecs: &mut World) {
y_rot: (p.y_rot as i32 * 360) as f32 / 256.,
};

commands.entity(entity).add(RelativeEntityUpdate {
commands.entity(entity).queue(RelativeEntityUpdate {
partial_world: instance_holder.partial_instance.clone(),
update: Box::new(move |entity_mut| {
let mut position = entity_mut.get_mut::<Position>().unwrap();
Expand Down Expand Up @@ -951,7 +951,7 @@ pub fn process_packet_events(ecs: &mut World) {
y_rot: (p.y_rot as i32 * 360) as f32 / 256.,
};

commands.entity(entity).add(RelativeEntityUpdate {
commands.entity(entity).queue(RelativeEntityUpdate {
partial_world: instance_holder.partial_instance.clone(),
update: Box::new(move |entity_mut| {
let mut look_direction = entity_mut.get_mut::<LookDirection>().unwrap();
Expand Down
12 changes: 5 additions & 7 deletions azalea-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
[package]
description = "Miscellaneous things in Azalea."
edition = "2021"
license = "MIT"
name = "azalea-core"
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-core"
version = "0.10.3+mc1.21.4"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
description = "Miscellaneous things in Azalea."
version = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
repository = { workspace = true }

[dependencies]
azalea-buf = { path = "../azalea-buf", version = "0.10.0" }
Expand Down
Loading

0 comments on commit 6379035

Please sign in to comment.