mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 06:16:04 +00:00
Update Bevy and migrate to workspace dependencies and package attributes (#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
This commit is contained in:
parent
241c7527ce
commit
6379035b85
42 changed files with 616 additions and 469 deletions
482
Cargo.lock
generated
482
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
53
Cargo.toml
53
Cargo.toml
|
@ -1,37 +1,46 @@
|
|||
[workspace]
|
||||
members = [
|
||||
"azalea",
|
||||
"azalea-client",
|
||||
"azalea-protocol",
|
||||
"azalea-chat",
|
||||
"azalea-core",
|
||||
"azalea-auth",
|
||||
"azalea-brigadier",
|
||||
"azalea-crypto",
|
||||
"azalea-world",
|
||||
"azalea-language",
|
||||
"azalea-block",
|
||||
"azalea-brigadier",
|
||||
"azalea-buf",
|
||||
"azalea-physics",
|
||||
"azalea-registry",
|
||||
"azalea-inventory",
|
||||
"azalea-chat",
|
||||
"azalea-client",
|
||||
"azalea-core",
|
||||
"azalea-crypto",
|
||||
"azalea-entity",
|
||||
"azalea-inventory",
|
||||
"azalea-language",
|
||||
"azalea-physics",
|
||||
"azalea-protocol",
|
||||
"azalea-registry",
|
||||
"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"
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -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" }
|
||||
|
|
|
@ -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" }
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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" }
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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 = []
|
||||
|
@ -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"] }
|
||||
|
|
|
@ -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 }
|
||||
|
@ -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" }
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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();
|
||||
|
@ -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| {
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
|
|
@ -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" }
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
[package]
|
||||
description = "Cryptography features used in Minecraft."
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "azalea-crypto"
|
||||
version = "0.10.3+mc1.21.4"
|
||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-crypto"
|
||||
description = "Cryptography features used in Minecraft."
|
||||
version = { workspace = true }
|
||||
edition = { workspace = true }
|
||||
license = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[dev-dependencies]
|
||||
criterion = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
aes = { workspace = true }
|
||||
|
@ -20,9 +21,6 @@ sha-1 = { workspace = true }
|
|||
sha2 = { workspace = true }
|
||||
uuid = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = { workspace = true, features = ["html_reports"] }
|
||||
|
||||
[[bench]]
|
||||
harness = false
|
||||
name = "my_benchmark"
|
||||
|
|
|
@ -1,23 +1,21 @@
|
|||
[package]
|
||||
name = "azalea-entity"
|
||||
version = "0.10.3+mc1.21.4"
|
||||
edition = "2021"
|
||||
description = "Things related to Minecraft entities used by Azalea"
|
||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-entity"
|
||||
license = "MIT"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
version = { workspace = true }
|
||||
edition = { workspace = true }
|
||||
license = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
azalea-block = { version = "0.10.0", path = "../azalea-block" }
|
||||
azalea-buf = { version = "0.10.0", path = "../azalea-buf" }
|
||||
azalea-chat = { version = "0.10.0", path = "../azalea-chat", features = [
|
||||
azalea-block = { path = "../azalea-block", version = "0.10.0" }
|
||||
azalea-buf = { path = "../azalea-buf", version = "0.10.0" }
|
||||
azalea-chat = { path = "../azalea-chat", version = "0.10.0", features = [
|
||||
"azalea-buf",
|
||||
] }
|
||||
azalea-core = { version = "0.10.0", path = "../azalea-core" }
|
||||
azalea-inventory = { version = "0.10.0", path = "../azalea-inventory" }
|
||||
azalea-registry = { version = "0.10.0", path = "../azalea-registry" }
|
||||
azalea-world = { version = "0.10.0", path = "../azalea-world" }
|
||||
azalea-core = { path = "../azalea-core", version = "0.10.0" }
|
||||
azalea-inventory = { path = "../azalea-inventory", version = "0.10.0" }
|
||||
azalea-registry = { path = "../azalea-registry", version = "0.10.0" }
|
||||
azalea-world = { path = "../azalea-world", version = "0.10.0" }
|
||||
bevy_app = { workspace = true }
|
||||
bevy_ecs = { workspace = true }
|
||||
derive_more = { workspace = true }
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
[package]
|
||||
description = "Representations of various inventory data structures in Minecraft."
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "azalea-inventory"
|
||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-inventory-macros"
|
||||
version = "0.10.3+mc1.21.4"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
description = "Representations of various inventory data structures in Minecraft."
|
||||
version = { workspace = true }
|
||||
edition = { workspace = true }
|
||||
license = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
azalea-buf = { version = "0.10.0", path = "../azalea-buf" }
|
||||
azalea-chat = { version = "0.10.0", path = "../azalea-chat", features = [
|
||||
azalea-buf = { path = "../azalea-buf", version = "0.10.0" }
|
||||
azalea-chat = { path = "../azalea-chat", version = "0.10.0", features = [
|
||||
"azalea-buf",
|
||||
] }
|
||||
azalea-core = { version = "0.10.0", path = "../azalea-core" }
|
||||
azalea-inventory-macros = { version = "0.10.0", path = "./azalea-inventory-macros" }
|
||||
azalea-registry = { version = "0.10.0", path = "../azalea-registry" }
|
||||
azalea-core = { path = "../azalea-core", version = "0.10.0" }
|
||||
azalea-inventory-macros = { path = "./azalea-inventory-macros", version = "0.10.0" }
|
||||
azalea-registry = { path = "../azalea-registry", version = "0.10.0" }
|
||||
|
||||
simdnbt = { workspace = true }
|
||||
uuid = { workspace = true }
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
[package]
|
||||
description = "Internal macros for azalea-inventory."
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "azalea-inventory-macros"
|
||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-inventory/azalea-inventory-macros"
|
||||
version = "0.10.3+mc1.21.4"
|
||||
description = "Internal macros for azalea-inventory."
|
||||
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 }
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
[package]
|
||||
description = "Translate Minecraft strings from their id."
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "azalea-language"
|
||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-language"
|
||||
version = "0.10.3+mc1.21.4"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
description = "Translate Minecraft strings from their id."
|
||||
version = { workspace = true }
|
||||
edition = { workspace = true }
|
||||
license = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true }
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
[package]
|
||||
description = "Physics for Minecraft entities."
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "azalea-physics"
|
||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-physics"
|
||||
version = "0.10.3+mc1.21.4"
|
||||
description = "Physics for Minecraft entities."
|
||||
version = { workspace = true }
|
||||
edition = { workspace = true }
|
||||
license = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[dev-dependencies]
|
||||
bevy_time = { workspace = true }
|
||||
uuid = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
azalea-block = { path = "../azalea-block", version = "0.10.0" }
|
||||
|
@ -18,6 +20,3 @@ azalea-world = { path = "../azalea-world", version = "0.10.0" }
|
|||
bevy_app = { workspace = true }
|
||||
bevy_ecs = { workspace = true }
|
||||
parking_lot = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
uuid = { workspace = true }
|
||||
|
|
|
@ -440,7 +440,7 @@ mod tests {
|
|||
#[test]
|
||||
fn test_gravity() {
|
||||
let mut app = make_test_app();
|
||||
let world_lock = app.world.resource_mut::<InstanceContainer>().insert(
|
||||
let world_lock = app.world_mut().resource_mut::<InstanceContainer>().insert(
|
||||
ResourceLocation::new("minecraft:overworld"),
|
||||
384,
|
||||
-64,
|
||||
|
@ -454,7 +454,7 @@ mod tests {
|
|||
);
|
||||
|
||||
let entity = app
|
||||
.world
|
||||
.world_mut()
|
||||
.spawn((
|
||||
EntityBundle::new(
|
||||
Uuid::nil(),
|
||||
|
@ -471,24 +471,24 @@ mod tests {
|
|||
))
|
||||
.id();
|
||||
{
|
||||
let entity_pos = *app.world.get::<Position>(entity).unwrap();
|
||||
let entity_pos = *app.world_mut().get::<Position>(entity).unwrap();
|
||||
// y should start at 70
|
||||
assert_eq!(entity_pos.y, 70.);
|
||||
}
|
||||
app.update();
|
||||
app.world.run_schedule(GameTick);
|
||||
app.world_mut().run_schedule(GameTick);
|
||||
app.update();
|
||||
{
|
||||
let entity_pos = *app.world.get::<Position>(entity).unwrap();
|
||||
let entity_pos = *app.world_mut().get::<Position>(entity).unwrap();
|
||||
// delta is applied before gravity, so the first tick only sets the delta
|
||||
assert_eq!(entity_pos.y, 70.);
|
||||
let entity_physics = app.world.get::<Physics>(entity).unwrap();
|
||||
let entity_physics = app.world_mut().get::<Physics>(entity).unwrap();
|
||||
assert!(entity_physics.velocity.y < 0.);
|
||||
}
|
||||
app.world.run_schedule(GameTick);
|
||||
app.world_mut().run_schedule(GameTick);
|
||||
app.update();
|
||||
{
|
||||
let entity_pos = *app.world.get::<Position>(entity).unwrap();
|
||||
let entity_pos = *app.world_mut().get::<Position>(entity).unwrap();
|
||||
// the second tick applies the delta to the position, so now it should go down
|
||||
assert!(
|
||||
entity_pos.y < 70.,
|
||||
|
@ -500,7 +500,7 @@ mod tests {
|
|||
#[test]
|
||||
fn test_collision() {
|
||||
let mut app = make_test_app();
|
||||
let world_lock = app.world.resource_mut::<InstanceContainer>().insert(
|
||||
let world_lock = app.world_mut().resource_mut::<InstanceContainer>().insert(
|
||||
ResourceLocation::new("minecraft:overworld"),
|
||||
384,
|
||||
-64,
|
||||
|
@ -513,7 +513,7 @@ mod tests {
|
|||
&mut world_lock.write().chunks,
|
||||
);
|
||||
let entity = app
|
||||
.world
|
||||
.world_mut()
|
||||
.spawn((
|
||||
EntityBundle::new(
|
||||
Uuid::nil(),
|
||||
|
@ -539,19 +539,19 @@ mod tests {
|
|||
"Block state should exist, if this fails that means the chunk wasn't loaded and the block didn't get placed"
|
||||
);
|
||||
app.update();
|
||||
app.world.run_schedule(GameTick);
|
||||
app.world_mut().run_schedule(GameTick);
|
||||
app.update();
|
||||
{
|
||||
let entity_pos = *app.world.get::<Position>(entity).unwrap();
|
||||
let entity_pos = *app.world_mut().get::<Position>(entity).unwrap();
|
||||
// delta will change, but it won't move until next tick
|
||||
assert_eq!(entity_pos.y, 70.);
|
||||
let entity_physics = app.world.get::<Physics>(entity).unwrap();
|
||||
let entity_physics = app.world_mut().get::<Physics>(entity).unwrap();
|
||||
assert!(entity_physics.velocity.y < 0.);
|
||||
}
|
||||
app.world.run_schedule(GameTick);
|
||||
app.world_mut().run_schedule(GameTick);
|
||||
app.update();
|
||||
{
|
||||
let entity_pos = *app.world.get::<Position>(entity).unwrap();
|
||||
let entity_pos = *app.world_mut().get::<Position>(entity).unwrap();
|
||||
// the second tick applies the delta to the position, but it also does collision
|
||||
assert_eq!(entity_pos.y, 70.);
|
||||
}
|
||||
|
@ -560,7 +560,7 @@ mod tests {
|
|||
#[test]
|
||||
fn test_slab_collision() {
|
||||
let mut app = make_test_app();
|
||||
let world_lock = app.world.resource_mut::<InstanceContainer>().insert(
|
||||
let world_lock = app.world_mut().resource_mut::<InstanceContainer>().insert(
|
||||
ResourceLocation::new("minecraft:overworld"),
|
||||
384,
|
||||
-64,
|
||||
|
@ -573,7 +573,7 @@ mod tests {
|
|||
&mut world_lock.write().chunks,
|
||||
);
|
||||
let entity = app
|
||||
.world
|
||||
.world_mut()
|
||||
.spawn((
|
||||
EntityBundle::new(
|
||||
Uuid::nil(),
|
||||
|
@ -604,17 +604,17 @@ mod tests {
|
|||
);
|
||||
// do a few steps so we fall on the slab
|
||||
for _ in 0..20 {
|
||||
app.world.run_schedule(GameTick);
|
||||
app.world_mut().run_schedule(GameTick);
|
||||
app.update();
|
||||
}
|
||||
let entity_pos = app.world.get::<Position>(entity).unwrap();
|
||||
let entity_pos = app.world_mut().get::<Position>(entity).unwrap();
|
||||
assert_eq!(entity_pos.y, 69.5);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_top_slab_collision() {
|
||||
let mut app = make_test_app();
|
||||
let world_lock = app.world.resource_mut::<InstanceContainer>().insert(
|
||||
let world_lock = app.world_mut().resource_mut::<InstanceContainer>().insert(
|
||||
ResourceLocation::new("minecraft:overworld"),
|
||||
384,
|
||||
-64,
|
||||
|
@ -627,7 +627,7 @@ mod tests {
|
|||
&mut world_lock.write().chunks,
|
||||
);
|
||||
let entity = app
|
||||
.world
|
||||
.world_mut()
|
||||
.spawn((
|
||||
EntityBundle::new(
|
||||
Uuid::nil(),
|
||||
|
@ -657,17 +657,17 @@ mod tests {
|
|||
);
|
||||
// do a few steps so we fall on the slab
|
||||
for _ in 0..20 {
|
||||
app.world.run_schedule(GameTick);
|
||||
app.world_mut().run_schedule(GameTick);
|
||||
app.update();
|
||||
}
|
||||
let entity_pos = app.world.get::<Position>(entity).unwrap();
|
||||
let entity_pos = app.world_mut().get::<Position>(entity).unwrap();
|
||||
assert_eq!(entity_pos.y, 70.);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_weird_wall_collision() {
|
||||
let mut app = make_test_app();
|
||||
let world_lock = app.world.resource_mut::<InstanceContainer>().insert(
|
||||
let world_lock = app.world_mut().resource_mut::<InstanceContainer>().insert(
|
||||
ResourceLocation::new("minecraft:overworld"),
|
||||
384,
|
||||
-64,
|
||||
|
@ -680,7 +680,7 @@ mod tests {
|
|||
&mut world_lock.write().chunks,
|
||||
);
|
||||
let entity = app
|
||||
.world
|
||||
.world_mut()
|
||||
.spawn((
|
||||
EntityBundle::new(
|
||||
Uuid::nil(),
|
||||
|
@ -714,18 +714,18 @@ mod tests {
|
|||
);
|
||||
// do a few steps so we fall on the wall
|
||||
for _ in 0..20 {
|
||||
app.world.run_schedule(GameTick);
|
||||
app.world_mut().run_schedule(GameTick);
|
||||
app.update();
|
||||
}
|
||||
|
||||
let entity_pos = app.world.get::<Position>(entity).unwrap();
|
||||
let entity_pos = app.world_mut().get::<Position>(entity).unwrap();
|
||||
assert_eq!(entity_pos.y, 70.5);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_negative_coordinates_weird_wall_collision() {
|
||||
let mut app = make_test_app();
|
||||
let world_lock = app.world.resource_mut::<InstanceContainer>().insert(
|
||||
let world_lock = app.world_mut().resource_mut::<InstanceContainer>().insert(
|
||||
ResourceLocation::new("minecraft:overworld"),
|
||||
384,
|
||||
-64,
|
||||
|
@ -738,7 +738,7 @@ mod tests {
|
|||
&mut world_lock.write().chunks,
|
||||
);
|
||||
let entity = app
|
||||
.world
|
||||
.world_mut()
|
||||
.spawn((
|
||||
EntityBundle::new(
|
||||
Uuid::nil(),
|
||||
|
@ -776,11 +776,11 @@ mod tests {
|
|||
);
|
||||
// do a few steps so we fall on the wall
|
||||
for _ in 0..20 {
|
||||
app.world.run_schedule(GameTick);
|
||||
app.world_mut().run_schedule(GameTick);
|
||||
app.update();
|
||||
}
|
||||
|
||||
let entity_pos = app.world.get::<Position>(entity).unwrap();
|
||||
let entity_pos = app.world_mut().get::<Position>(entity).unwrap();
|
||||
assert_eq!(entity_pos.y, 70.5);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
[package]
|
||||
description = "Send and receive Minecraft packets."
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "azalea-protocol"
|
||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-protocol"
|
||||
version = "0.10.3+mc1.21.4"
|
||||
description = "Send and receive Minecraft packets."
|
||||
version = { workspace = true }
|
||||
edition = { workspace = true }
|
||||
license = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[dev-dependencies]
|
||||
anyhow = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
tracing-subscriber = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
async-recursion = { workspace = true }
|
||||
azalea-auth = { path = "../azalea-auth", version = "0.10.0" }
|
||||
azalea-block = { path = "../azalea-block", default-features = false, version = "0.10.0" }
|
||||
azalea-block = { path = "../azalea-block", version = "0.10.0", default-features = false }
|
||||
azalea-brigadier = { path = "../azalea-brigadier", version = "0.10.0", features = [
|
||||
"azalea-buf",
|
||||
] }
|
||||
|
@ -20,12 +23,12 @@ azalea-chat = { path = "../azalea-chat", version = "0.10.0", features = [
|
|||
"numbers",
|
||||
"azalea-buf",
|
||||
] }
|
||||
azalea-core = { path = "../azalea-core", optional = true, version = "0.10.0", features = [
|
||||
azalea-core = { path = "../azalea-core", version = "0.10.0", optional = true, features = [
|
||||
"serde",
|
||||
] }
|
||||
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-protocol-macros = { path = "./azalea-protocol-macros", version = "0.10.0" }
|
||||
azalea-registry = { path = "../azalea-registry", version = "0.10.0" }
|
||||
azalea-world = { path = "../azalea-world", version = "0.10.0" }
|
||||
|
@ -36,7 +39,6 @@ flate2 = { workspace = true }
|
|||
futures = { workspace = true }
|
||||
futures-lite = { workspace = true }
|
||||
#futures-util = { workspace = true }
|
||||
log = { workspace = true }
|
||||
serde = { workspace = true, features = ["serde_derive"] }
|
||||
serde_json = { workspace = true }
|
||||
simdnbt = { workspace = true }
|
||||
|
@ -52,8 +54,3 @@ uuid = { workspace = true }
|
|||
connecting = []
|
||||
default = ["packets"]
|
||||
packets = ["connecting", "dep:azalea-core"]
|
||||
|
||||
[dev-dependencies]
|
||||
anyhow = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
tracing-subscriber = { workspace = true }
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
[package]
|
||||
description = "Macros internally used in azalea-protocol."
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "azalea-protocol-macros"
|
||||
version = "0.10.3+mc1.21.4"
|
||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-protocol/azalea-protocol-macros"
|
||||
description = "Macros internally used in azalea-protocol."
|
||||
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 }
|
||||
|
|
|
@ -41,7 +41,7 @@ pub struct ServerAddress {
|
|||
pub port: u16,
|
||||
}
|
||||
|
||||
impl TryFrom<&'_ str> for ServerAddress {
|
||||
impl TryFrom<&str> for ServerAddress {
|
||||
type Error = String;
|
||||
|
||||
/// Convert a Minecraft server address (host:port, the port is optional) to
|
||||
|
|
|
@ -350,7 +350,7 @@ where
|
|||
.map_err(ReadPacketError::from)?;
|
||||
}
|
||||
|
||||
if log::log_enabled!(log::Level::Trace) {
|
||||
if tracing::enabled!(tracing::Level::TRACE) {
|
||||
const DO_NOT_CUT_OFF_PACKET_LOGS: bool = false;
|
||||
|
||||
let buf_string: String = {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
[package]
|
||||
description = "Use Minecraft's registries."
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "azalea-registry"
|
||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-registry"
|
||||
version = "0.10.3+mc1.21.4"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
description = "Use Minecraft's registries."
|
||||
version = { workspace = true }
|
||||
edition = { workspace = true }
|
||||
license = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
azalea-buf = { path = "../azalea-buf", version = "0.10.0" }
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
[package]
|
||||
description = "Macros internally used in azalea-registry."
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "azalea-registry-macros"
|
||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-registry/azalea-registry-macros"
|
||||
version = "0.10.3+mc1.21.4"
|
||||
description = "Macros internally used in azalea-registry."
|
||||
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 }
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// This file was generated by codegen/lib/code/tags.py, don't edit it manually!
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::sync::LazyLock;
|
||||
use std::{collections::HashSet, sync::LazyLock};
|
||||
|
||||
use crate::Block;
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// This file was generated by codegen/lib/code/tags.py, don't edit it manually!
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::sync::LazyLock;
|
||||
use std::{collections::HashSet, sync::LazyLock};
|
||||
|
||||
use crate::Fluid;
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// This file was generated by codegen/lib/code/tags.py, don't edit it manually!
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::sync::LazyLock;
|
||||
use std::{collections::HashSet, sync::LazyLock};
|
||||
|
||||
use crate::Item;
|
||||
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
[package]
|
||||
description = "The Minecraft world representation used in Azalea."
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "azalea-world"
|
||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-world"
|
||||
version = "0.10.3+mc1.21.4"
|
||||
description = "The Minecraft world representation used in Azalea."
|
||||
version = { workspace = true }
|
||||
edition = { workspace = true }
|
||||
license = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[dev-dependencies]
|
||||
azalea-client = { path = "../azalea-client" }
|
||||
criterion = "0.5.1"
|
||||
|
||||
[dependencies]
|
||||
azalea-block = { path = "../azalea-block", default-features = false, version = "0.10.0" }
|
||||
|
@ -24,10 +26,6 @@ simdnbt = { workspace = true }
|
|||
thiserror = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
azalea-client = { path = "../azalea-client" }
|
||||
criterion = { workspace = true }
|
||||
|
||||
[[bench]]
|
||||
name = "chunks"
|
||||
harness = false
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
[package]
|
||||
description = "A framework for creating Minecraft bots."
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "azalea"
|
||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea"
|
||||
version = "0.10.3+mc1.21.4"
|
||||
description = "A framework for creating Minecraft bots."
|
||||
version = { workspace = true }
|
||||
edition = { workspace = true }
|
||||
license = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
|
||||
[package.metadata.release]
|
||||
pre-release-replacements = [
|
||||
|
@ -30,7 +30,7 @@ azalea-world = { version = "0.10.0", path = "../azalea-world" }
|
|||
bevy_app = { workspace = true }
|
||||
bevy_ecs = { workspace = true }
|
||||
bevy_log = { workspace = true }
|
||||
bevy_tasks = { workspace = true, features = ["multi-threaded"] }
|
||||
bevy_tasks = { workspace = true, features = ["multi_threaded"] }
|
||||
#bevy_time = { workspace = true }
|
||||
derive_more = { workspace = true, features = ["deref", "deref_mut"] }
|
||||
futures = { workspace = true }
|
||||
|
|
|
@ -2,25 +2,30 @@ use std::env;
|
|||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
match env::var("RUSTUP_TOOLCHAIN") {
|
||||
Ok(rust_toolchain) if !rust_toolchain.starts_with("nightly") => {
|
||||
// stable & beta
|
||||
panic!("Azalea currently requires nightly Rust. You can use `rustup override set nightly` to set the toolchain for this directory.");
|
||||
// If using `rustup`, check the toolchain via `RUSTUP_TOOLCHAIN`
|
||||
if let Ok(toolchain) = env::var("RUSTUP_TOOLCHAIN") {
|
||||
if toolchain.contains("nightly") {
|
||||
return;
|
||||
} else {
|
||||
panic!("Azalea currently requires nightly Rust. You can run `rustup override set nightly` to set the toolchain for this directory.");
|
||||
}
|
||||
Ok(_) => {} // nightly
|
||||
Err(_) => {
|
||||
// probably not installed via rustup, run rustc and parse its output
|
||||
let rustc_command = env::var("RUSTC")
|
||||
}
|
||||
|
||||
// Get the path to the Rust compiler, defaulting to `rustc`
|
||||
let rustc_path = env::var("RUSTC")
|
||||
.or_else(|_| env::var("CARGO_BUILD_RUSTC"))
|
||||
.unwrap_or(String::from("rustc"));
|
||||
let rustc_version_output = Command::new(rustc_command).arg("-V").output().unwrap();
|
||||
if !rustc_version_output.status.success()
|
||||
|| !String::from_utf8(rustc_version_output.stdout)
|
||||
.unwrap()
|
||||
.contains("nightly")
|
||||
{
|
||||
panic!("Azalea currently requires nightly Rust. It seems that you did not install Rust via rustup. Please check the documentation for your installation method, to find out how to use nightly Rust.");
|
||||
}
|
||||
}
|
||||
|
||||
// Run `rustc -V` to check the toolchain version
|
||||
let rustc_command = Command::new(&rustc_path).arg("-V").output().unwrap();
|
||||
|
||||
if rustc_command.status.success() {
|
||||
let rustc_output = String::from_utf8(rustc_command.stdout).unwrap();
|
||||
if !rustc_output.contains("nightly") {
|
||||
panic!("Azalea currently requires nightly Rust. Please check the documentation for your installation method and ensure you are using the nightly toolchain.");
|
||||
}
|
||||
} else {
|
||||
let rustc_output = String::from_utf8(rustc_command.stderr).unwrap();
|
||||
panic!("Failed to run `{rustc_path} -V` to check the toolchain version, {rustc_output}");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -875,7 +875,7 @@ mod tests {
|
|||
// filter: "".to_string(),
|
||||
// });
|
||||
|
||||
simulation.app.world.send_event(GotoEvent {
|
||||
simulation.app.world_mut().send_event(GotoEvent {
|
||||
entity: simulation.entity,
|
||||
goal: Arc::new(BlockPosGoal(end_pos)),
|
||||
successors_fn: moves::default_move,
|
||||
|
|
|
@ -130,7 +130,7 @@ pub struct Simulation {
|
|||
impl Simulation {
|
||||
pub fn new(chunks: ChunkStorage, player: SimulatedPlayerBundle) -> Self {
|
||||
let (mut app, instance) = create_simulation_instance(chunks);
|
||||
let entity = create_simulation_player(&mut app.world, instance.clone(), player);
|
||||
let entity = create_simulation_player(app.world_mut(), instance.clone(), player);
|
||||
Self {
|
||||
app,
|
||||
entity,
|
||||
|
@ -140,13 +140,13 @@ impl Simulation {
|
|||
|
||||
pub fn tick(&mut self) {
|
||||
self.app.update();
|
||||
self.app.world.run_schedule(GameTick);
|
||||
self.app.world_mut().run_schedule(GameTick);
|
||||
}
|
||||
pub fn component<T: Component + Clone>(&self) -> T {
|
||||
self.app.world.get::<T>(self.entity).unwrap().clone()
|
||||
self.app.world().get::<T>(self.entity).unwrap().clone()
|
||||
}
|
||||
pub fn get_component<T: Component + Clone>(&self) -> Option<T> {
|
||||
self.app.world.get::<T>(self.entity).cloned()
|
||||
self.app.world().get::<T>(self.entity).cloned()
|
||||
}
|
||||
pub fn position(&self) -> Vec3 {
|
||||
*self.component::<Position>()
|
||||
|
@ -171,17 +171,17 @@ impl SimulationSet {
|
|||
}
|
||||
pub fn tick(&mut self) {
|
||||
self.app.update();
|
||||
self.app.world.run_schedule(GameTick);
|
||||
self.app.world_mut().run_schedule(GameTick);
|
||||
}
|
||||
|
||||
pub fn spawn(&mut self, player: SimulatedPlayerBundle) -> Entity {
|
||||
create_simulation_player(&mut self.app.world, self.instance.clone(), player)
|
||||
create_simulation_player(self.app.world_mut(), self.instance.clone(), player)
|
||||
}
|
||||
pub fn despawn(&mut self, entity: Entity) {
|
||||
self.app.world.despawn(entity);
|
||||
self.app.world_mut().despawn(entity);
|
||||
}
|
||||
|
||||
pub fn position(&self, entity: Entity) -> Vec3 {
|
||||
**self.app.world.get::<Position>(entity).unwrap()
|
||||
**self.app.world().get::<Position>(entity).unwrap()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -188,70 +188,70 @@ mod tests {
|
|||
async fn test_swarm_chat() {
|
||||
let mut app = make_test_app();
|
||||
|
||||
let bot0 = app.world.spawn_empty().id();
|
||||
let bot1 = app.world.spawn_empty().id();
|
||||
let bot0 = app.world_mut().spawn_empty().id();
|
||||
let bot1 = app.world_mut().spawn_empty().id();
|
||||
|
||||
app.world.send_event(ChatReceivedEvent {
|
||||
app.world_mut().send_event(ChatReceivedEvent {
|
||||
entity: bot0,
|
||||
packet: ChatPacket::new("a"),
|
||||
});
|
||||
app.update();
|
||||
|
||||
// the swarm should get the event immediately after the bot gets it
|
||||
assert_eq!(drain_events(&mut app.world), vec![ChatPacket::new("a")]);
|
||||
assert_eq!(drain_events(app.world_mut()), vec![ChatPacket::new("a")]);
|
||||
assert_eq!(
|
||||
app.world.get::<ClientChatState>(bot0).unwrap().chat_index,
|
||||
app.world().get::<ClientChatState>(bot0).unwrap().chat_index,
|
||||
1
|
||||
);
|
||||
// and a second bot sending the event shouldn't do anything
|
||||
app.world.send_event(ChatReceivedEvent {
|
||||
app.world_mut().send_event(ChatReceivedEvent {
|
||||
entity: bot1,
|
||||
packet: ChatPacket::new("a"),
|
||||
});
|
||||
app.update();
|
||||
assert_eq!(drain_events(&mut app.world), vec![]);
|
||||
assert_eq!(drain_events(app.world_mut()), vec![]);
|
||||
assert_eq!(
|
||||
app.world.get::<ClientChatState>(bot1).unwrap().chat_index,
|
||||
app.world().get::<ClientChatState>(bot1).unwrap().chat_index,
|
||||
1
|
||||
);
|
||||
|
||||
// but if the first one gets it again, it should sent it again
|
||||
app.world.send_event(ChatReceivedEvent {
|
||||
app.world_mut().send_event(ChatReceivedEvent {
|
||||
entity: bot0,
|
||||
packet: ChatPacket::new("a"),
|
||||
});
|
||||
app.update();
|
||||
assert_eq!(drain_events(&mut app.world), vec![ChatPacket::new("a")]);
|
||||
assert_eq!(drain_events(app.world_mut()), vec![ChatPacket::new("a")]);
|
||||
|
||||
// alright and now the second bot got a different chat message and it should be
|
||||
// sent
|
||||
app.world.send_event(ChatReceivedEvent {
|
||||
app.world_mut().send_event(ChatReceivedEvent {
|
||||
entity: bot1,
|
||||
packet: ChatPacket::new("b"),
|
||||
});
|
||||
app.update();
|
||||
assert_eq!(drain_events(&mut app.world), vec![ChatPacket::new("b")]);
|
||||
assert_eq!(drain_events(app.world_mut()), vec![ChatPacket::new("b")]);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_new_bot() {
|
||||
let mut app = make_test_app();
|
||||
|
||||
let bot0 = app.world.spawn_empty().id();
|
||||
let bot0 = app.world_mut().spawn_empty().id();
|
||||
|
||||
// bot0 gets a chat message
|
||||
app.world.send_event(ChatReceivedEvent {
|
||||
app.world_mut().send_event(ChatReceivedEvent {
|
||||
entity: bot0,
|
||||
packet: ChatPacket::new("a"),
|
||||
});
|
||||
app.update();
|
||||
assert_eq!(drain_events(&mut app.world), vec![ChatPacket::new("a")]);
|
||||
let bot1 = app.world.spawn_empty().id();
|
||||
app.world.send_event(ChatReceivedEvent {
|
||||
assert_eq!(drain_events(app.world_mut()), vec![ChatPacket::new("a")]);
|
||||
let bot1 = app.world_mut().spawn_empty().id();
|
||||
app.world_mut().send_event(ChatReceivedEvent {
|
||||
entity: bot1,
|
||||
packet: ChatPacket::new("b"),
|
||||
});
|
||||
app.update();
|
||||
assert_eq!(drain_events(&mut app.world), vec![ChatPacket::new("b")]);
|
||||
assert_eq!(drain_events(app.world_mut()), vec![ChatPacket::new("b")]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -368,7 +368,7 @@ where
|
|||
|
||||
let (run_schedule_sender, run_schedule_receiver) = mpsc::unbounded_channel();
|
||||
|
||||
let main_schedule_label = self.app.main_schedule_label;
|
||||
let main_schedule_label = self.app.main().update_schedule.unwrap();
|
||||
|
||||
let ecs_lock =
|
||||
start_ecs_runner(self.app, run_schedule_receiver, run_schedule_sender.clone());
|
||||
|
@ -671,7 +671,17 @@ impl Swarm {
|
|||
let delay = (Duration::from_secs(5) * 2u32.pow(disconnects.min(16)))
|
||||
.min(Duration::from_secs(15));
|
||||
let username = account.username.clone();
|
||||
error!("Error joining as {username}: {e}. Waiting {delay:?} and trying again.");
|
||||
|
||||
if let JoinError::Disconnect { reason } = &e {
|
||||
error!(
|
||||
"Error joining as {username}, server says: \"{reason}\". Waiting {delay:?} and trying again."
|
||||
);
|
||||
} else {
|
||||
error!(
|
||||
"Error joining as {username}: {e}. Waiting {delay:?} and trying again."
|
||||
);
|
||||
}
|
||||
|
||||
tokio::time::sleep(delay).await;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,10 +119,11 @@ def generate_block_shapes_code(blocks: dict, shapes: dict, block_states_report):
|
|||
#![allow(clippy::explicit_auto_deref)]
|
||||
#![allow(clippy::redundant_closure)]
|
||||
|
||||
use std::sync::LazyLock;
|
||||
|
||||
use super::VoxelShape;
|
||||
use crate::collision::{{self, Shapes}};
|
||||
use azalea_block::*;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
pub trait BlockWithShape {{
|
||||
fn shape(&self) -> &'static VoxelShape;
|
||||
|
|
|
@ -8,8 +8,8 @@ def generate_tags(registries: dict, file_name: str, struct_name: str):
|
|||
|
||||
generated = f'''// This file was generated by codegen/lib/code/tags.py, don't edit it manually!
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::sync::LazyLock;
|
||||
use std::{collections::HashSet, sync::LazyLock};
|
||||
|
||||
|
||||
use crate::{struct_name};
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
nightly-2024-11-11
|
3
rust-toolchain.toml
Normal file
3
rust-toolchain.toml
Normal file
|
@ -0,0 +1,3 @@
|
|||
[toolchain]
|
||||
channel = "nightly-2024-11-11"
|
||||
# channel = "nightly"
|
Loading…
Add table
Reference in a new issue