mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26: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]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
"azalea",
|
"azalea",
|
||||||
"azalea-client",
|
|
||||||
"azalea-protocol",
|
|
||||||
"azalea-chat",
|
|
||||||
"azalea-core",
|
|
||||||
"azalea-auth",
|
"azalea-auth",
|
||||||
"azalea-brigadier",
|
|
||||||
"azalea-crypto",
|
|
||||||
"azalea-world",
|
|
||||||
"azalea-language",
|
|
||||||
"azalea-block",
|
"azalea-block",
|
||||||
|
"azalea-brigadier",
|
||||||
"azalea-buf",
|
"azalea-buf",
|
||||||
"azalea-physics",
|
"azalea-chat",
|
||||||
"azalea-registry",
|
"azalea-client",
|
||||||
"azalea-inventory",
|
"azalea-core",
|
||||||
|
"azalea-crypto",
|
||||||
"azalea-entity",
|
"azalea-entity",
|
||||||
|
"azalea-inventory",
|
||||||
|
"azalea-language",
|
||||||
|
"azalea-physics",
|
||||||
|
"azalea-protocol",
|
||||||
|
"azalea-registry",
|
||||||
|
"azalea-world",
|
||||||
]
|
]
|
||||||
resolver = "2"
|
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]
|
[workspace.dependencies]
|
||||||
aes = "0.8.4"
|
aes = "0.8.4"
|
||||||
anyhow = "1.0.93"
|
anyhow = "1.0.93"
|
||||||
async-recursion = "1.1.1"
|
async-recursion = "1.1.1"
|
||||||
async-trait = "0.1.83"
|
async-trait = "0.1.83"
|
||||||
base64 = "0.22.1"
|
base64 = "0.22.1"
|
||||||
bevy_app = "0.13.2"
|
bevy_app = "0.15.0"
|
||||||
bevy_ecs = { version = "0.13.2", default-features = false }
|
bevy_ecs = { version = "0.15.0", default-features = false }
|
||||||
bevy_log = "0.13.2"
|
bevy_log = "0.15.0"
|
||||||
bevy_tasks = "0.13.2"
|
bevy_tasks = "0.15.0"
|
||||||
bevy_time = "0.13.2"
|
bevy_time = "0.15.0"
|
||||||
byteorder = "1.5.0"
|
byteorder = "1.5.0"
|
||||||
bytes = "1.8.0"
|
bytes = "1.9.0"
|
||||||
cfb8 = "0.8.1"
|
cfb8 = "0.8.1"
|
||||||
chrono = { version = "0.4.38", default-features = false }
|
chrono = { version = "0.4.38", default-features = false }
|
||||||
criterion = "0.5.1"
|
criterion = "0.5.1"
|
||||||
|
@ -55,7 +64,7 @@ quote = "1.0.37"
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
regex = "1.11.1"
|
regex = "1.11.1"
|
||||||
reqwest = { version = "0.12.9", default-features = false }
|
reqwest = { version = "0.12.9", default-features = false }
|
||||||
rsa = "0.9.6"
|
rsa = "0.9.7"
|
||||||
rsa_public_encrypt_pkcs1 = "0.4.0"
|
rsa_public_encrypt_pkcs1 = "0.4.0"
|
||||||
rustc-hash = "2.0.0"
|
rustc-hash = "2.0.0"
|
||||||
serde = "1.0.215"
|
serde = "1.0.215"
|
||||||
|
@ -65,15 +74,17 @@ sha2 = "0.10.8"
|
||||||
simdnbt = "0.6"
|
simdnbt = "0.6"
|
||||||
#smallvec = "1.13.2"
|
#smallvec = "1.13.2"
|
||||||
socks5-impl = "0.5.17"
|
socks5-impl = "0.5.17"
|
||||||
syn = "2.0.89"
|
syn = "2.0.90"
|
||||||
thiserror = "2.0.3"
|
thiserror = "2.0.3"
|
||||||
tokio = "1.41.1"
|
tokio = "1.41.1"
|
||||||
tokio-util = "0.7.12"
|
tokio-util = "0.7.12"
|
||||||
tracing = "0.1.40"
|
tracing = "0.1.41"
|
||||||
tracing-subscriber = "0.3.18"
|
tracing-subscriber = "0.3.19"
|
||||||
trust-dns-resolver = { version = "0.23.2", default-features = false }
|
trust-dns-resolver = { version = "0.23.2", default-features = false }
|
||||||
uuid = "1.11.0"
|
uuid = "1.11.0"
|
||||||
|
|
||||||
|
# --- Profile Settings ---
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
debug = true
|
debug = true
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
[package]
|
[package]
|
||||||
description = "A port of Mojang's Authlib and launcher authentication."
|
|
||||||
edition = "2021"
|
|
||||||
license = "MIT"
|
|
||||||
name = "azalea-auth"
|
name = "azalea-auth"
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-auth"
|
description = "A port of Mojang's Authlib and launcher authentication."
|
||||||
version = "0.10.3+mc1.21.4"
|
version = { workspace = true }
|
||||||
|
edition = { workspace = true }
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
license = { workspace = true }
|
||||||
|
repository = { workspace = true }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
azalea-buf = { path = "../azalea-buf", version = "0.10.0" }
|
azalea-buf = { path = "../azalea-buf", version = "0.10.0" }
|
||||||
|
|
|
@ -1,16 +1,12 @@
|
||||||
[package]
|
[package]
|
||||||
description = "Representation of Minecraft block states."
|
|
||||||
edition = "2021"
|
|
||||||
license = "MIT"
|
|
||||||
name = "azalea-block"
|
name = "azalea-block"
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-block"
|
description = "Representation of Minecraft block states."
|
||||||
version = "0.10.3+mc1.21.4"
|
version = { workspace = true }
|
||||||
|
edition = { workspace = true }
|
||||||
[lib]
|
license = { workspace = true }
|
||||||
|
repository = { workspace = true }
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
azalea-block-macros = { path = "./azalea-block-macros", version = "0.10.0" }
|
azalea-block-macros = { path = "./azalea-block-macros", version = "0.10.0" }
|
||||||
azalea-buf = { path = "../azalea-buf", 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]
|
[package]
|
||||||
description = "Proc macros used by azalea-block."
|
|
||||||
edition = "2021"
|
|
||||||
license = "MIT"
|
|
||||||
name = "azalea-block-macros"
|
name = "azalea-block-macros"
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-block/azalea-block-macros"
|
description = "Proc macros used by azalea-block."
|
||||||
version = "0.10.3+mc1.21.4"
|
version = { workspace = true }
|
||||||
|
edition = { workspace = true }
|
||||||
|
license = { workspace = true }
|
||||||
|
repository = { workspace = true }
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
proc-macro2 = { workspace = true }
|
proc-macro2 = { workspace = true }
|
||||||
quote = { workspace = true }
|
quote = { workspace = true }
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
[package]
|
[package]
|
||||||
description = "A port of Mojang's Brigadier command parsing and dispatching library."
|
|
||||||
edition = "2021"
|
|
||||||
license = "MIT"
|
|
||||||
name = "azalea-brigadier"
|
name = "azalea-brigadier"
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-brigadier"
|
description = "A port of Mojang's Brigadier command parsing and dispatching library."
|
||||||
version = "0.10.3+mc1.21.4"
|
version = { workspace = true }
|
||||||
|
edition = { workspace = true }
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
license = { workspace = true }
|
||||||
|
repository = { workspace = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
bevy_app = { workspace = true }
|
bevy_app = { workspace = true }
|
||||||
|
|
|
@ -23,12 +23,20 @@ fn bevy_app() {
|
||||||
app.init_resource::<DispatchStorage>();
|
app.init_resource::<DispatchStorage>();
|
||||||
|
|
||||||
// Process commands from bevy
|
// Process commands from bevy
|
||||||
app.world
|
if let Err(err) = app
|
||||||
.run_system_once(DispatchStorage::bevy_process_commands);
|
.world_mut()
|
||||||
|
.run_system_once(DispatchStorage::bevy_process_commands)
|
||||||
|
{
|
||||||
|
panic!("Failed to process commands: {err}");
|
||||||
|
}
|
||||||
|
|
||||||
// Verify spawned entities exist after processing commands
|
// Verify spawned entities exist after processing commands
|
||||||
app.world
|
if let Err(err) = app
|
||||||
.run_system_once(DispatchStorage::verify_spawned_entities);
|
.world_mut()
|
||||||
|
.run_system_once(DispatchStorage::verify_spawned_entities)
|
||||||
|
{
|
||||||
|
panic!("Failed to verify spawned entities: {err}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Resource)]
|
#[derive(Resource)]
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
[package]
|
[package]
|
||||||
description = "Serialize and deserialize buffers from Minecraft."
|
|
||||||
edition = "2021"
|
|
||||||
license = "MIT"
|
|
||||||
name = "azalea-buf"
|
name = "azalea-buf"
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-buf"
|
description = "Serialize and deserialize buffers from Minecraft."
|
||||||
version = "0.10.3+mc1.21.4"
|
version = { workspace = true }
|
||||||
|
edition = { workspace = true }
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
license = { workspace = true }
|
||||||
|
repository = { workspace = true }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
azalea-buf-macros = { path = "./azalea-buf-macros", version = "0.10.0" }
|
azalea-buf-macros = { path = "./azalea-buf-macros", version = "0.10.0" }
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
[package]
|
[package]
|
||||||
description = "#[derive(AzBuf)]"
|
|
||||||
edition = "2021"
|
|
||||||
license = "MIT"
|
|
||||||
name = "azalea-buf-macros"
|
name = "azalea-buf-macros"
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-buf"
|
description = "#[derive(AzBuf)]"
|
||||||
version = "0.10.3+mc1.21.4"
|
version = { workspace = true }
|
||||||
|
edition = { workspace = true }
|
||||||
|
license = { workspace = true }
|
||||||
|
repository = { workspace = true }
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
proc-macro2 = { workspace = true }
|
proc-macro2 = { workspace = true }
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
[package]
|
[package]
|
||||||
description = "Parse Minecraft chat messages."
|
|
||||||
edition = "2021"
|
|
||||||
license = "MIT"
|
|
||||||
name = "azalea-chat"
|
name = "azalea-chat"
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-chat"
|
description = "Parse Minecraft chat messages."
|
||||||
version = "0.10.3+mc1.21.4"
|
version = { workspace = true }
|
||||||
|
edition = { workspace = true }
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
license = { workspace = true }
|
||||||
|
repository = { workspace = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
@ -15,9 +13,9 @@ azalea-buf = ["dep:azalea-buf", "simdnbt"]
|
||||||
numbers = ["dep:azalea-registry", "dep:simdnbt"]
|
numbers = ["dep:azalea-registry", "dep:simdnbt"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
azalea-buf = { path = "../azalea-buf", features = [
|
azalea-buf = { path = "../azalea-buf", version = "0.10.0", optional = true, features = [
|
||||||
"serde_json",
|
"serde_json",
|
||||||
], version = "0.10.0", optional = true }
|
] }
|
||||||
azalea-language = { path = "../azalea-language", version = "0.10.0" }
|
azalea-language = { path = "../azalea-language", version = "0.10.0" }
|
||||||
azalea-registry = { path = "../azalea-registry", version = "0.10.0", optional = true }
|
azalea-registry = { path = "../azalea-registry", version = "0.10.0", optional = true }
|
||||||
serde = { workspace = true, features = ["derive"] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
[package]
|
[package]
|
||||||
description = "A headless Minecraft client."
|
|
||||||
edition = "2021"
|
|
||||||
license = "MIT"
|
|
||||||
name = "azalea-client"
|
name = "azalea-client"
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-client"
|
description = "A headless Minecraft client."
|
||||||
version = "0.10.3+mc1.21.4"
|
version = { workspace = true }
|
||||||
|
edition = { workspace = true }
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
license = { workspace = true }
|
||||||
|
repository = { workspace = true }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = { workspace = true }
|
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-chat = { path = "../azalea-chat", version = "0.10.0" }
|
||||||
azalea-core = { path = "../azalea-core", version = "0.10.0" }
|
azalea-core = { path = "../azalea-core", version = "0.10.0" }
|
||||||
azalea-crypto = { path = "../azalea-crypto", version = "0.10.0" }
|
azalea-crypto = { path = "../azalea-crypto", version = "0.10.0" }
|
||||||
azalea-entity = { version = "0.10.0", path = "../azalea-entity" }
|
azalea-entity = { path = "../azalea-entity", version = "0.10.0" }
|
||||||
azalea-inventory = { version = "0.10.0", path = "../azalea-inventory" }
|
azalea-inventory = { path = "../azalea-inventory", version = "0.10.0" }
|
||||||
azalea-physics = { path = "../azalea-physics", version = "0.10.0" }
|
azalea-physics = { path = "../azalea-physics", version = "0.10.0" }
|
||||||
azalea-protocol = { path = "../azalea-protocol", version = "0.10.0" }
|
azalea-protocol = { path = "../azalea-protocol", version = "0.10.0" }
|
||||||
azalea-registry = { path = "../azalea-registry", version = "0.10.0" }
|
azalea-registry = { path = "../azalea-registry", version = "0.10.0" }
|
||||||
|
|
|
@ -728,17 +728,17 @@ impl Plugin for AzaleaPlugin {
|
||||||
/// [`DefaultPlugins`].
|
/// [`DefaultPlugins`].
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub fn start_ecs_runner(
|
pub fn start_ecs_runner(
|
||||||
app: App,
|
mut app: App,
|
||||||
run_schedule_receiver: mpsc::UnboundedReceiver<()>,
|
run_schedule_receiver: mpsc::UnboundedReceiver<()>,
|
||||||
run_schedule_sender: mpsc::UnboundedSender<()>,
|
run_schedule_sender: mpsc::UnboundedSender<()>,
|
||||||
) -> Arc<Mutex<World>> {
|
) -> Arc<Mutex<World>> {
|
||||||
// all resources should have been added by now so we can take the ecs from the
|
// all resources should have been added by now so we can take the ecs from the
|
||||||
// app
|
// 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(
|
tokio::spawn(run_schedule_loop(
|
||||||
ecs.clone(),
|
ecs.clone(),
|
||||||
app.main_schedule_label,
|
*app.main().update_schedule.as_ref().unwrap(),
|
||||||
run_schedule_receiver,
|
run_schedule_receiver,
|
||||||
));
|
));
|
||||||
tokio::spawn(tick_run_schedule_loop(run_schedule_sender));
|
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)]
|
#[derive(Error, Debug)]
|
||||||
|
#[expect(clippy::large_enum_variant)]
|
||||||
pub enum HandlePacketError {
|
pub enum HandlePacketError {
|
||||||
#[error("{0}")]
|
#[error("{0}")]
|
||||||
Poison(String),
|
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
|
// we use RelativeEntityUpdate because it makes sure changes aren't made
|
||||||
// multiple times
|
// multiple times
|
||||||
commands.entity(entity).add(RelativeEntityUpdate {
|
commands.entity(entity).queue(RelativeEntityUpdate {
|
||||||
partial_world: instance_holder.partial_instance.clone(),
|
partial_world: instance_holder.partial_instance.clone(),
|
||||||
update: Box::new(move |entity| {
|
update: Box::new(move |entity| {
|
||||||
let entity_id = entity.id();
|
let entity_id = entity.id();
|
||||||
|
@ -781,7 +781,7 @@ pub fn process_packet_events(ecs: &mut World) {
|
||||||
z: p.za as f64 / 8000.,
|
z: p.za as f64 / 8000.,
|
||||||
});
|
});
|
||||||
|
|
||||||
commands.entity(entity).add(RelativeEntityUpdate {
|
commands.entity(entity).queue(RelativeEntityUpdate {
|
||||||
partial_world: instance_holder.partial_instance.clone(),
|
partial_world: instance_holder.partial_instance.clone(),
|
||||||
update: Box::new(move |entity_mut| {
|
update: Box::new(move |entity_mut| {
|
||||||
entity_mut.world_scope(|world| {
|
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.,
|
x_rot: (p.x_rot as i32 * 360) as f32 / 256.,
|
||||||
y_rot: (p.y_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(),
|
partial_world: instance_holder.partial_instance.clone(),
|
||||||
update: Box::new(move |entity| {
|
update: Box::new(move |entity| {
|
||||||
let mut position = entity.get_mut::<Position>().unwrap();
|
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 {
|
if let Some(entity) = entity {
|
||||||
let delta = p.delta.clone();
|
let delta = p.delta.clone();
|
||||||
commands.entity(entity).add(RelativeEntityUpdate {
|
commands.entity(entity).queue(RelativeEntityUpdate {
|
||||||
partial_world: instance_holder.partial_instance.clone(),
|
partial_world: instance_holder.partial_instance.clone(),
|
||||||
update: Box::new(move |entity_mut| {
|
update: Box::new(move |entity_mut| {
|
||||||
let mut position = entity_mut.get_mut::<Position>().unwrap();
|
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.,
|
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(),
|
partial_world: instance_holder.partial_instance.clone(),
|
||||||
update: Box::new(move |entity_mut| {
|
update: Box::new(move |entity_mut| {
|
||||||
let mut position = entity_mut.get_mut::<Position>().unwrap();
|
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.,
|
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(),
|
partial_world: instance_holder.partial_instance.clone(),
|
||||||
update: Box::new(move |entity_mut| {
|
update: Box::new(move |entity_mut| {
|
||||||
let mut look_direction = entity_mut.get_mut::<LookDirection>().unwrap();
|
let mut look_direction = entity_mut.get_mut::<LookDirection>().unwrap();
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
[package]
|
[package]
|
||||||
description = "Miscellaneous things in Azalea."
|
|
||||||
edition = "2021"
|
|
||||||
license = "MIT"
|
|
||||||
name = "azalea-core"
|
name = "azalea-core"
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-core"
|
description = "Miscellaneous things in Azalea."
|
||||||
version = "0.10.3+mc1.21.4"
|
version = { workspace = true }
|
||||||
|
edition = { workspace = true }
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
license = { workspace = true }
|
||||||
|
repository = { workspace = true }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
azalea-buf = { path = "../azalea-buf", version = "0.10.0" }
|
azalea-buf = { path = "../azalea-buf", version = "0.10.0" }
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
[package]
|
[package]
|
||||||
description = "Cryptography features used in Minecraft."
|
|
||||||
edition = "2021"
|
|
||||||
license = "MIT"
|
|
||||||
name = "azalea-crypto"
|
name = "azalea-crypto"
|
||||||
version = "0.10.3+mc1.21.4"
|
description = "Cryptography features used in Minecraft."
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-crypto"
|
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]
|
[dependencies]
|
||||||
aes = { workspace = true }
|
aes = { workspace = true }
|
||||||
|
@ -20,9 +21,6 @@ sha-1 = { workspace = true }
|
||||||
sha2 = { workspace = true }
|
sha2 = { workspace = true }
|
||||||
uuid = { workspace = true }
|
uuid = { workspace = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
criterion = { workspace = true, features = ["html_reports"] }
|
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
harness = false
|
harness = false
|
||||||
name = "my_benchmark"
|
name = "my_benchmark"
|
||||||
|
|
|
@ -1,23 +1,21 @@
|
||||||
[package]
|
[package]
|
||||||
name = "azalea-entity"
|
name = "azalea-entity"
|
||||||
version = "0.10.3+mc1.21.4"
|
|
||||||
edition = "2021"
|
|
||||||
description = "Things related to Minecraft entities used by Azalea"
|
description = "Things related to Minecraft entities used by Azalea"
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-entity"
|
version = { workspace = true }
|
||||||
license = "MIT"
|
edition = { workspace = true }
|
||||||
|
license = { workspace = true }
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
repository = { workspace = true }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
azalea-block = { version = "0.10.0", path = "../azalea-block" }
|
azalea-block = { path = "../azalea-block", version = "0.10.0" }
|
||||||
azalea-buf = { version = "0.10.0", path = "../azalea-buf" }
|
azalea-buf = { path = "../azalea-buf", version = "0.10.0" }
|
||||||
azalea-chat = { version = "0.10.0", path = "../azalea-chat", features = [
|
azalea-chat = { path = "../azalea-chat", version = "0.10.0", features = [
|
||||||
"azalea-buf",
|
"azalea-buf",
|
||||||
] }
|
] }
|
||||||
azalea-core = { version = "0.10.0", path = "../azalea-core" }
|
azalea-core = { path = "../azalea-core", version = "0.10.0" }
|
||||||
azalea-inventory = { version = "0.10.0", path = "../azalea-inventory" }
|
azalea-inventory = { path = "../azalea-inventory", version = "0.10.0" }
|
||||||
azalea-registry = { version = "0.10.0", path = "../azalea-registry" }
|
azalea-registry = { path = "../azalea-registry", version = "0.10.0" }
|
||||||
azalea-world = { version = "0.10.0", path = "../azalea-world" }
|
azalea-world = { path = "../azalea-world", version = "0.10.0" }
|
||||||
bevy_app = { workspace = true }
|
bevy_app = { workspace = true }
|
||||||
bevy_ecs = { workspace = true }
|
bevy_ecs = { workspace = true }
|
||||||
derive_more = { workspace = true }
|
derive_more = { workspace = true }
|
||||||
|
|
|
@ -1,20 +1,19 @@
|
||||||
[package]
|
[package]
|
||||||
description = "Representations of various inventory data structures in Minecraft."
|
|
||||||
edition = "2021"
|
|
||||||
license = "MIT"
|
|
||||||
name = "azalea-inventory"
|
name = "azalea-inventory"
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-inventory-macros"
|
description = "Representations of various inventory data structures in Minecraft."
|
||||||
version = "0.10.3+mc1.21.4"
|
version = { workspace = true }
|
||||||
|
edition = { workspace = true }
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
license = { workspace = true }
|
||||||
|
repository = { workspace = true }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
azalea-buf = { version = "0.10.0", path = "../azalea-buf" }
|
azalea-buf = { path = "../azalea-buf", version = "0.10.0" }
|
||||||
azalea-chat = { version = "0.10.0", path = "../azalea-chat", features = [
|
azalea-chat = { path = "../azalea-chat", version = "0.10.0", features = [
|
||||||
"azalea-buf",
|
"azalea-buf",
|
||||||
] }
|
] }
|
||||||
azalea-core = { version = "0.10.0", path = "../azalea-core" }
|
azalea-core = { path = "../azalea-core", version = "0.10.0" }
|
||||||
azalea-inventory-macros = { version = "0.10.0", path = "./azalea-inventory-macros" }
|
azalea-inventory-macros = { path = "./azalea-inventory-macros", version = "0.10.0" }
|
||||||
azalea-registry = { version = "0.10.0", path = "../azalea-registry" }
|
azalea-registry = { path = "../azalea-registry", version = "0.10.0" }
|
||||||
|
|
||||||
simdnbt = { workspace = true }
|
simdnbt = { workspace = true }
|
||||||
uuid = { workspace = true }
|
uuid = { workspace = true }
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
[package]
|
[package]
|
||||||
description = "Internal macros for azalea-inventory."
|
|
||||||
edition = "2021"
|
|
||||||
license = "MIT"
|
|
||||||
name = "azalea-inventory-macros"
|
name = "azalea-inventory-macros"
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-inventory/azalea-inventory-macros"
|
description = "Internal macros for azalea-inventory."
|
||||||
version = "0.10.3+mc1.21.4"
|
version = { workspace = true }
|
||||||
|
edition = { workspace = true }
|
||||||
|
license = { workspace = true }
|
||||||
|
repository = { workspace = true }
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
proc-macro2 = { workspace = true }
|
proc-macro2 = { workspace = true }
|
||||||
quote = { workspace = true }
|
quote = { workspace = true }
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
[package]
|
[package]
|
||||||
description = "Translate Minecraft strings from their id."
|
|
||||||
edition = "2021"
|
|
||||||
license = "MIT"
|
|
||||||
name = "azalea-language"
|
name = "azalea-language"
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-language"
|
description = "Translate Minecraft strings from their id."
|
||||||
version = "0.10.3+mc1.21.4"
|
version = { workspace = true }
|
||||||
|
edition = { workspace = true }
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
license = { workspace = true }
|
||||||
|
repository = { workspace = true }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
[package]
|
[package]
|
||||||
description = "Physics for Minecraft entities."
|
|
||||||
edition = "2021"
|
|
||||||
license = "MIT"
|
|
||||||
name = "azalea-physics"
|
name = "azalea-physics"
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-physics"
|
description = "Physics for Minecraft entities."
|
||||||
version = "0.10.3+mc1.21.4"
|
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]
|
[dependencies]
|
||||||
azalea-block = { path = "../azalea-block", version = "0.10.0" }
|
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_app = { workspace = true }
|
||||||
bevy_ecs = { workspace = true }
|
bevy_ecs = { workspace = true }
|
||||||
parking_lot = { workspace = true }
|
parking_lot = { workspace = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
uuid = { workspace = true }
|
|
||||||
|
|
|
@ -440,7 +440,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_gravity() {
|
fn test_gravity() {
|
||||||
let mut app = make_test_app();
|
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"),
|
ResourceLocation::new("minecraft:overworld"),
|
||||||
384,
|
384,
|
||||||
-64,
|
-64,
|
||||||
|
@ -454,7 +454,7 @@ mod tests {
|
||||||
);
|
);
|
||||||
|
|
||||||
let entity = app
|
let entity = app
|
||||||
.world
|
.world_mut()
|
||||||
.spawn((
|
.spawn((
|
||||||
EntityBundle::new(
|
EntityBundle::new(
|
||||||
Uuid::nil(),
|
Uuid::nil(),
|
||||||
|
@ -471,24 +471,24 @@ mod tests {
|
||||||
))
|
))
|
||||||
.id();
|
.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
|
// y should start at 70
|
||||||
assert_eq!(entity_pos.y, 70.);
|
assert_eq!(entity_pos.y, 70.);
|
||||||
}
|
}
|
||||||
app.update();
|
app.update();
|
||||||
app.world.run_schedule(GameTick);
|
app.world_mut().run_schedule(GameTick);
|
||||||
app.update();
|
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
|
// delta is applied before gravity, so the first tick only sets the delta
|
||||||
assert_eq!(entity_pos.y, 70.);
|
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.);
|
assert!(entity_physics.velocity.y < 0.);
|
||||||
}
|
}
|
||||||
app.world.run_schedule(GameTick);
|
app.world_mut().run_schedule(GameTick);
|
||||||
app.update();
|
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
|
// the second tick applies the delta to the position, so now it should go down
|
||||||
assert!(
|
assert!(
|
||||||
entity_pos.y < 70.,
|
entity_pos.y < 70.,
|
||||||
|
@ -500,7 +500,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_collision() {
|
fn test_collision() {
|
||||||
let mut app = make_test_app();
|
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"),
|
ResourceLocation::new("minecraft:overworld"),
|
||||||
384,
|
384,
|
||||||
-64,
|
-64,
|
||||||
|
@ -513,7 +513,7 @@ mod tests {
|
||||||
&mut world_lock.write().chunks,
|
&mut world_lock.write().chunks,
|
||||||
);
|
);
|
||||||
let entity = app
|
let entity = app
|
||||||
.world
|
.world_mut()
|
||||||
.spawn((
|
.spawn((
|
||||||
EntityBundle::new(
|
EntityBundle::new(
|
||||||
Uuid::nil(),
|
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"
|
"Block state should exist, if this fails that means the chunk wasn't loaded and the block didn't get placed"
|
||||||
);
|
);
|
||||||
app.update();
|
app.update();
|
||||||
app.world.run_schedule(GameTick);
|
app.world_mut().run_schedule(GameTick);
|
||||||
app.update();
|
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
|
// delta will change, but it won't move until next tick
|
||||||
assert_eq!(entity_pos.y, 70.);
|
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.);
|
assert!(entity_physics.velocity.y < 0.);
|
||||||
}
|
}
|
||||||
app.world.run_schedule(GameTick);
|
app.world_mut().run_schedule(GameTick);
|
||||||
app.update();
|
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
|
// the second tick applies the delta to the position, but it also does collision
|
||||||
assert_eq!(entity_pos.y, 70.);
|
assert_eq!(entity_pos.y, 70.);
|
||||||
}
|
}
|
||||||
|
@ -560,7 +560,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_slab_collision() {
|
fn test_slab_collision() {
|
||||||
let mut app = make_test_app();
|
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"),
|
ResourceLocation::new("minecraft:overworld"),
|
||||||
384,
|
384,
|
||||||
-64,
|
-64,
|
||||||
|
@ -573,7 +573,7 @@ mod tests {
|
||||||
&mut world_lock.write().chunks,
|
&mut world_lock.write().chunks,
|
||||||
);
|
);
|
||||||
let entity = app
|
let entity = app
|
||||||
.world
|
.world_mut()
|
||||||
.spawn((
|
.spawn((
|
||||||
EntityBundle::new(
|
EntityBundle::new(
|
||||||
Uuid::nil(),
|
Uuid::nil(),
|
||||||
|
@ -604,17 +604,17 @@ mod tests {
|
||||||
);
|
);
|
||||||
// do a few steps so we fall on the slab
|
// do a few steps so we fall on the slab
|
||||||
for _ in 0..20 {
|
for _ in 0..20 {
|
||||||
app.world.run_schedule(GameTick);
|
app.world_mut().run_schedule(GameTick);
|
||||||
app.update();
|
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);
|
assert_eq!(entity_pos.y, 69.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_top_slab_collision() {
|
fn test_top_slab_collision() {
|
||||||
let mut app = make_test_app();
|
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"),
|
ResourceLocation::new("minecraft:overworld"),
|
||||||
384,
|
384,
|
||||||
-64,
|
-64,
|
||||||
|
@ -627,7 +627,7 @@ mod tests {
|
||||||
&mut world_lock.write().chunks,
|
&mut world_lock.write().chunks,
|
||||||
);
|
);
|
||||||
let entity = app
|
let entity = app
|
||||||
.world
|
.world_mut()
|
||||||
.spawn((
|
.spawn((
|
||||||
EntityBundle::new(
|
EntityBundle::new(
|
||||||
Uuid::nil(),
|
Uuid::nil(),
|
||||||
|
@ -657,17 +657,17 @@ mod tests {
|
||||||
);
|
);
|
||||||
// do a few steps so we fall on the slab
|
// do a few steps so we fall on the slab
|
||||||
for _ in 0..20 {
|
for _ in 0..20 {
|
||||||
app.world.run_schedule(GameTick);
|
app.world_mut().run_schedule(GameTick);
|
||||||
app.update();
|
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.);
|
assert_eq!(entity_pos.y, 70.);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_weird_wall_collision() {
|
fn test_weird_wall_collision() {
|
||||||
let mut app = make_test_app();
|
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"),
|
ResourceLocation::new("minecraft:overworld"),
|
||||||
384,
|
384,
|
||||||
-64,
|
-64,
|
||||||
|
@ -680,7 +680,7 @@ mod tests {
|
||||||
&mut world_lock.write().chunks,
|
&mut world_lock.write().chunks,
|
||||||
);
|
);
|
||||||
let entity = app
|
let entity = app
|
||||||
.world
|
.world_mut()
|
||||||
.spawn((
|
.spawn((
|
||||||
EntityBundle::new(
|
EntityBundle::new(
|
||||||
Uuid::nil(),
|
Uuid::nil(),
|
||||||
|
@ -714,18 +714,18 @@ mod tests {
|
||||||
);
|
);
|
||||||
// do a few steps so we fall on the wall
|
// do a few steps so we fall on the wall
|
||||||
for _ in 0..20 {
|
for _ in 0..20 {
|
||||||
app.world.run_schedule(GameTick);
|
app.world_mut().run_schedule(GameTick);
|
||||||
app.update();
|
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);
|
assert_eq!(entity_pos.y, 70.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_negative_coordinates_weird_wall_collision() {
|
fn test_negative_coordinates_weird_wall_collision() {
|
||||||
let mut app = make_test_app();
|
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"),
|
ResourceLocation::new("minecraft:overworld"),
|
||||||
384,
|
384,
|
||||||
-64,
|
-64,
|
||||||
|
@ -738,7 +738,7 @@ mod tests {
|
||||||
&mut world_lock.write().chunks,
|
&mut world_lock.write().chunks,
|
||||||
);
|
);
|
||||||
let entity = app
|
let entity = app
|
||||||
.world
|
.world_mut()
|
||||||
.spawn((
|
.spawn((
|
||||||
EntityBundle::new(
|
EntityBundle::new(
|
||||||
Uuid::nil(),
|
Uuid::nil(),
|
||||||
|
@ -776,11 +776,11 @@ mod tests {
|
||||||
);
|
);
|
||||||
// do a few steps so we fall on the wall
|
// do a few steps so we fall on the wall
|
||||||
for _ in 0..20 {
|
for _ in 0..20 {
|
||||||
app.world.run_schedule(GameTick);
|
app.world_mut().run_schedule(GameTick);
|
||||||
app.update();
|
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);
|
assert_eq!(entity_pos.y, 70.5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
[package]
|
[package]
|
||||||
description = "Send and receive Minecraft packets."
|
|
||||||
edition = "2021"
|
|
||||||
license = "MIT"
|
|
||||||
name = "azalea-protocol"
|
name = "azalea-protocol"
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-protocol"
|
description = "Send and receive Minecraft packets."
|
||||||
version = "0.10.3+mc1.21.4"
|
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]
|
[dependencies]
|
||||||
async-recursion = { workspace = true }
|
async-recursion = { workspace = true }
|
||||||
azalea-auth = { path = "../azalea-auth", version = "0.10.0" }
|
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-brigadier = { path = "../azalea-brigadier", version = "0.10.0", features = [
|
||||||
"azalea-buf",
|
"azalea-buf",
|
||||||
] }
|
] }
|
||||||
|
@ -20,12 +23,12 @@ azalea-chat = { path = "../azalea-chat", version = "0.10.0", features = [
|
||||||
"numbers",
|
"numbers",
|
||||||
"azalea-buf",
|
"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",
|
"serde",
|
||||||
] }
|
] }
|
||||||
azalea-crypto = { path = "../azalea-crypto", version = "0.10.0" }
|
azalea-crypto = { path = "../azalea-crypto", version = "0.10.0" }
|
||||||
azalea-entity = { version = "0.10.0", path = "../azalea-entity" }
|
azalea-entity = { path = "../azalea-entity", version = "0.10.0" }
|
||||||
azalea-inventory = { version = "0.10.0", path = "../azalea-inventory" }
|
azalea-inventory = { path = "../azalea-inventory", version = "0.10.0" }
|
||||||
azalea-protocol-macros = { path = "./azalea-protocol-macros", 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-registry = { path = "../azalea-registry", version = "0.10.0" }
|
||||||
azalea-world = { path = "../azalea-world", version = "0.10.0" }
|
azalea-world = { path = "../azalea-world", version = "0.10.0" }
|
||||||
|
@ -36,7 +39,6 @@ flate2 = { workspace = true }
|
||||||
futures = { workspace = true }
|
futures = { workspace = true }
|
||||||
futures-lite = { workspace = true }
|
futures-lite = { workspace = true }
|
||||||
#futures-util = { workspace = true }
|
#futures-util = { workspace = true }
|
||||||
log = { workspace = true }
|
|
||||||
serde = { workspace = true, features = ["serde_derive"] }
|
serde = { workspace = true, features = ["serde_derive"] }
|
||||||
serde_json = { workspace = true }
|
serde_json = { workspace = true }
|
||||||
simdnbt = { workspace = true }
|
simdnbt = { workspace = true }
|
||||||
|
@ -52,8 +54,3 @@ uuid = { workspace = true }
|
||||||
connecting = []
|
connecting = []
|
||||||
default = ["packets"]
|
default = ["packets"]
|
||||||
packets = ["connecting", "dep:azalea-core"]
|
packets = ["connecting", "dep:azalea-core"]
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
anyhow = { workspace = true }
|
|
||||||
tracing = { workspace = true }
|
|
||||||
tracing-subscriber = { workspace = true }
|
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
[package]
|
[package]
|
||||||
description = "Macros internally used in azalea-protocol."
|
|
||||||
edition = "2021"
|
|
||||||
license = "MIT"
|
|
||||||
name = "azalea-protocol-macros"
|
name = "azalea-protocol-macros"
|
||||||
version = "0.10.3+mc1.21.4"
|
description = "Macros internally used in azalea-protocol."
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-protocol/azalea-protocol-macros"
|
version = { workspace = true }
|
||||||
|
edition = { workspace = true }
|
||||||
|
license = { workspace = true }
|
||||||
|
repository = { workspace = true }
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
proc-macro2 = { workspace = true }
|
proc-macro2 = { workspace = true }
|
||||||
|
|
|
@ -41,7 +41,7 @@ pub struct ServerAddress {
|
||||||
pub port: u16,
|
pub port: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<&'_ str> for ServerAddress {
|
impl TryFrom<&str> for ServerAddress {
|
||||||
type Error = String;
|
type Error = String;
|
||||||
|
|
||||||
/// Convert a Minecraft server address (host:port, the port is optional) to
|
/// Convert a Minecraft server address (host:port, the port is optional) to
|
||||||
|
|
|
@ -350,7 +350,7 @@ where
|
||||||
.map_err(ReadPacketError::from)?;
|
.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;
|
const DO_NOT_CUT_OFF_PACKET_LOGS: bool = false;
|
||||||
|
|
||||||
let buf_string: String = {
|
let buf_string: String = {
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
[package]
|
[package]
|
||||||
description = "Use Minecraft's registries."
|
|
||||||
edition = "2021"
|
|
||||||
license = "MIT"
|
|
||||||
name = "azalea-registry"
|
name = "azalea-registry"
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-registry"
|
description = "Use Minecraft's registries."
|
||||||
version = "0.10.3+mc1.21.4"
|
version = { workspace = true }
|
||||||
|
edition = { workspace = true }
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
license = { workspace = true }
|
||||||
|
repository = { workspace = true }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
azalea-buf = { path = "../azalea-buf", version = "0.10.0" }
|
azalea-buf = { path = "../azalea-buf", version = "0.10.0" }
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
[package]
|
[package]
|
||||||
description = "Macros internally used in azalea-registry."
|
|
||||||
edition = "2021"
|
|
||||||
license = "MIT"
|
|
||||||
name = "azalea-registry-macros"
|
name = "azalea-registry-macros"
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-registry/azalea-registry-macros"
|
description = "Macros internally used in azalea-registry."
|
||||||
version = "0.10.3+mc1.21.4"
|
version = { workspace = true }
|
||||||
|
edition = { workspace = true }
|
||||||
|
license = { workspace = true }
|
||||||
|
repository = { workspace = true }
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
#proc-macro2 = { workspace = true }
|
#proc-macro2 = { workspace = true }
|
||||||
quote = { workspace = true }
|
quote = { workspace = true }
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// This file was generated by codegen/lib/code/tags.py, don't edit it manually!
|
// This file was generated by codegen/lib/code/tags.py, don't edit it manually!
|
||||||
|
|
||||||
use std::collections::HashSet;
|
use std::{collections::HashSet, sync::LazyLock};
|
||||||
use std::sync::LazyLock;
|
|
||||||
|
|
||||||
use crate::Block;
|
use crate::Block;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// This file was generated by codegen/lib/code/tags.py, don't edit it manually!
|
// This file was generated by codegen/lib/code/tags.py, don't edit it manually!
|
||||||
|
|
||||||
use std::collections::HashSet;
|
use std::{collections::HashSet, sync::LazyLock};
|
||||||
use std::sync::LazyLock;
|
|
||||||
|
|
||||||
use crate::Fluid;
|
use crate::Fluid;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// This file was generated by codegen/lib/code/tags.py, don't edit it manually!
|
// This file was generated by codegen/lib/code/tags.py, don't edit it manually!
|
||||||
|
|
||||||
use std::collections::HashSet;
|
use std::{collections::HashSet, sync::LazyLock};
|
||||||
use std::sync::LazyLock;
|
|
||||||
|
|
||||||
use crate::Item;
|
use crate::Item;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
[package]
|
[package]
|
||||||
description = "The Minecraft world representation used in Azalea."
|
|
||||||
edition = "2021"
|
|
||||||
license = "MIT"
|
|
||||||
name = "azalea-world"
|
name = "azalea-world"
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-world"
|
description = "The Minecraft world representation used in Azalea."
|
||||||
version = "0.10.3+mc1.21.4"
|
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]
|
[dependencies]
|
||||||
azalea-block = { path = "../azalea-block", default-features = false, version = "0.10.0" }
|
azalea-block = { path = "../azalea-block", default-features = false, version = "0.10.0" }
|
||||||
|
@ -24,10 +26,6 @@ simdnbt = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
tracing = { workspace = true }
|
tracing = { workspace = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
azalea-client = { path = "../azalea-client" }
|
|
||||||
criterion = { workspace = true }
|
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
name = "chunks"
|
name = "chunks"
|
||||||
harness = false
|
harness = false
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
[package]
|
[package]
|
||||||
description = "A framework for creating Minecraft bots."
|
|
||||||
edition = "2021"
|
|
||||||
license = "MIT"
|
|
||||||
name = "azalea"
|
name = "azalea"
|
||||||
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea"
|
description = "A framework for creating Minecraft bots."
|
||||||
version = "0.10.3+mc1.21.4"
|
version = { workspace = true }
|
||||||
|
edition = { workspace = true }
|
||||||
|
license = { workspace = true }
|
||||||
|
repository = { workspace = true }
|
||||||
|
|
||||||
[package.metadata.release]
|
[package.metadata.release]
|
||||||
pre-release-replacements = [
|
pre-release-replacements = [
|
||||||
|
@ -30,7 +30,7 @@ azalea-world = { version = "0.10.0", path = "../azalea-world" }
|
||||||
bevy_app = { workspace = true }
|
bevy_app = { workspace = true }
|
||||||
bevy_ecs = { workspace = true }
|
bevy_ecs = { workspace = true }
|
||||||
bevy_log = { workspace = true }
|
bevy_log = { workspace = true }
|
||||||
bevy_tasks = { workspace = true, features = ["multi-threaded"] }
|
bevy_tasks = { workspace = true, features = ["multi_threaded"] }
|
||||||
#bevy_time = { workspace = true }
|
#bevy_time = { workspace = true }
|
||||||
derive_more = { workspace = true, features = ["deref", "deref_mut"] }
|
derive_more = { workspace = true, features = ["deref", "deref_mut"] }
|
||||||
futures = { workspace = true }
|
futures = { workspace = true }
|
||||||
|
|
|
@ -2,25 +2,30 @@ use std::env;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
match env::var("RUSTUP_TOOLCHAIN") {
|
// If using `rustup`, check the toolchain via `RUSTUP_TOOLCHAIN`
|
||||||
Ok(rust_toolchain) if !rust_toolchain.starts_with("nightly") => {
|
if let Ok(toolchain) = env::var("RUSTUP_TOOLCHAIN") {
|
||||||
// stable & beta
|
if toolchain.contains("nightly") {
|
||||||
panic!("Azalea currently requires nightly Rust. You can use `rustup override set nightly` to set the toolchain for this directory.");
|
return;
|
||||||
}
|
} else {
|
||||||
Ok(_) => {} // nightly
|
panic!("Azalea currently requires nightly Rust. You can run `rustup override set nightly` to set the toolchain for this directory.");
|
||||||
Err(_) => {
|
|
||||||
// probably not installed via rustup, run rustc and parse its output
|
|
||||||
let rustc_command = 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.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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"));
|
||||||
|
|
||||||
|
// 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(),
|
// filter: "".to_string(),
|
||||||
// });
|
// });
|
||||||
|
|
||||||
simulation.app.world.send_event(GotoEvent {
|
simulation.app.world_mut().send_event(GotoEvent {
|
||||||
entity: simulation.entity,
|
entity: simulation.entity,
|
||||||
goal: Arc::new(BlockPosGoal(end_pos)),
|
goal: Arc::new(BlockPosGoal(end_pos)),
|
||||||
successors_fn: moves::default_move,
|
successors_fn: moves::default_move,
|
||||||
|
|
|
@ -130,7 +130,7 @@ pub struct Simulation {
|
||||||
impl Simulation {
|
impl Simulation {
|
||||||
pub fn new(chunks: ChunkStorage, player: SimulatedPlayerBundle) -> Self {
|
pub fn new(chunks: ChunkStorage, player: SimulatedPlayerBundle) -> Self {
|
||||||
let (mut app, instance) = create_simulation_instance(chunks);
|
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 {
|
Self {
|
||||||
app,
|
app,
|
||||||
entity,
|
entity,
|
||||||
|
@ -140,13 +140,13 @@ impl Simulation {
|
||||||
|
|
||||||
pub fn tick(&mut self) {
|
pub fn tick(&mut self) {
|
||||||
self.app.update();
|
self.app.update();
|
||||||
self.app.world.run_schedule(GameTick);
|
self.app.world_mut().run_schedule(GameTick);
|
||||||
}
|
}
|
||||||
pub fn component<T: Component + Clone>(&self) -> T {
|
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> {
|
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 {
|
pub fn position(&self) -> Vec3 {
|
||||||
*self.component::<Position>()
|
*self.component::<Position>()
|
||||||
|
@ -171,17 +171,17 @@ impl SimulationSet {
|
||||||
}
|
}
|
||||||
pub fn tick(&mut self) {
|
pub fn tick(&mut self) {
|
||||||
self.app.update();
|
self.app.update();
|
||||||
self.app.world.run_schedule(GameTick);
|
self.app.world_mut().run_schedule(GameTick);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn spawn(&mut self, player: SimulatedPlayerBundle) -> Entity {
|
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) {
|
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 {
|
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() {
|
async fn test_swarm_chat() {
|
||||||
let mut app = make_test_app();
|
let mut app = make_test_app();
|
||||||
|
|
||||||
let bot0 = app.world.spawn_empty().id();
|
let bot0 = app.world_mut().spawn_empty().id();
|
||||||
let bot1 = app.world.spawn_empty().id();
|
let bot1 = app.world_mut().spawn_empty().id();
|
||||||
|
|
||||||
app.world.send_event(ChatReceivedEvent {
|
app.world_mut().send_event(ChatReceivedEvent {
|
||||||
entity: bot0,
|
entity: bot0,
|
||||||
packet: ChatPacket::new("a"),
|
packet: ChatPacket::new("a"),
|
||||||
});
|
});
|
||||||
app.update();
|
app.update();
|
||||||
|
|
||||||
// the swarm should get the event immediately after the bot gets it
|
// 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!(
|
assert_eq!(
|
||||||
app.world.get::<ClientChatState>(bot0).unwrap().chat_index,
|
app.world().get::<ClientChatState>(bot0).unwrap().chat_index,
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
// and a second bot sending the event shouldn't do anything
|
// and a second bot sending the event shouldn't do anything
|
||||||
app.world.send_event(ChatReceivedEvent {
|
app.world_mut().send_event(ChatReceivedEvent {
|
||||||
entity: bot1,
|
entity: bot1,
|
||||||
packet: ChatPacket::new("a"),
|
packet: ChatPacket::new("a"),
|
||||||
});
|
});
|
||||||
app.update();
|
app.update();
|
||||||
assert_eq!(drain_events(&mut app.world), vec![]);
|
assert_eq!(drain_events(app.world_mut()), vec![]);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
app.world.get::<ClientChatState>(bot1).unwrap().chat_index,
|
app.world().get::<ClientChatState>(bot1).unwrap().chat_index,
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
|
||||||
// but if the first one gets it again, it should sent it again
|
// 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,
|
entity: bot0,
|
||||||
packet: ChatPacket::new("a"),
|
packet: ChatPacket::new("a"),
|
||||||
});
|
});
|
||||||
app.update();
|
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
|
// alright and now the second bot got a different chat message and it should be
|
||||||
// sent
|
// sent
|
||||||
app.world.send_event(ChatReceivedEvent {
|
app.world_mut().send_event(ChatReceivedEvent {
|
||||||
entity: bot1,
|
entity: bot1,
|
||||||
packet: ChatPacket::new("b"),
|
packet: ChatPacket::new("b"),
|
||||||
});
|
});
|
||||||
app.update();
|
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]
|
#[tokio::test]
|
||||||
async fn test_new_bot() {
|
async fn test_new_bot() {
|
||||||
let mut app = make_test_app();
|
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
|
// bot0 gets a chat message
|
||||||
app.world.send_event(ChatReceivedEvent {
|
app.world_mut().send_event(ChatReceivedEvent {
|
||||||
entity: bot0,
|
entity: bot0,
|
||||||
packet: ChatPacket::new("a"),
|
packet: ChatPacket::new("a"),
|
||||||
});
|
});
|
||||||
app.update();
|
app.update();
|
||||||
assert_eq!(drain_events(&mut app.world), vec![ChatPacket::new("a")]);
|
assert_eq!(drain_events(app.world_mut()), vec![ChatPacket::new("a")]);
|
||||||
let bot1 = app.world.spawn_empty().id();
|
let bot1 = app.world_mut().spawn_empty().id();
|
||||||
app.world.send_event(ChatReceivedEvent {
|
app.world_mut().send_event(ChatReceivedEvent {
|
||||||
entity: bot1,
|
entity: bot1,
|
||||||
packet: ChatPacket::new("b"),
|
packet: ChatPacket::new("b"),
|
||||||
});
|
});
|
||||||
app.update();
|
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 (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 =
|
let ecs_lock =
|
||||||
start_ecs_runner(self.app, run_schedule_receiver, run_schedule_sender.clone());
|
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)))
|
let delay = (Duration::from_secs(5) * 2u32.pow(disconnects.min(16)))
|
||||||
.min(Duration::from_secs(15));
|
.min(Duration::from_secs(15));
|
||||||
let username = account.username.clone();
|
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;
|
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::explicit_auto_deref)]
|
||||||
#![allow(clippy::redundant_closure)]
|
#![allow(clippy::redundant_closure)]
|
||||||
|
|
||||||
|
use std::sync::LazyLock;
|
||||||
|
|
||||||
use super::VoxelShape;
|
use super::VoxelShape;
|
||||||
use crate::collision::{{self, Shapes}};
|
use crate::collision::{{self, Shapes}};
|
||||||
use azalea_block::*;
|
use azalea_block::*;
|
||||||
use std::sync::LazyLock;
|
|
||||||
|
|
||||||
pub trait BlockWithShape {{
|
pub trait BlockWithShape {{
|
||||||
fn shape(&self) -> &'static VoxelShape;
|
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!
|
generated = f'''// This file was generated by codegen/lib/code/tags.py, don't edit it manually!
|
||||||
|
|
||||||
use std::collections::HashSet;
|
use std::{collections::HashSet, sync::LazyLock};
|
||||||
use std::sync::LazyLock;
|
|
||||||
|
|
||||||
use crate::{struct_name};
|
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