mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
fix online-mode
This commit is contained in:
parent
a2389a7830
commit
aed1251d01
7 changed files with 38 additions and 17 deletions
14
Cargo.lock
generated
14
Cargo.lock
generated
|
@ -160,6 +160,19 @@ dependencies = [
|
|||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-compat"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7bab94bde396a3f7b4962e396fdad640e241ed797d4d8d77fc8c237d14c58fc0"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"once_cell",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-executor"
|
||||
version = "1.13.1"
|
||||
|
@ -336,6 +349,7 @@ name = "azalea-client"
|
|||
version = "0.11.0+mc1.21.5"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-compat",
|
||||
"azalea-auth",
|
||||
"azalea-block",
|
||||
"azalea-buf",
|
||||
|
|
|
@ -12,7 +12,10 @@ azalea-crypto = { path = "../azalea-crypto", version = "0.11.0" }
|
|||
base64.workspace = true
|
||||
chrono = { workspace = true, features = ["serde"] }
|
||||
md-5.workspace = true
|
||||
reqwest = { workspace = true, features = ["json", "rustls-tls"] }
|
||||
reqwest = { workspace = true, default-features = false, features = [
|
||||
"json",
|
||||
"rustls-tls",
|
||||
] }
|
||||
rsa.workspace = true
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json.workspace = true
|
||||
|
|
|
@ -349,7 +349,7 @@ impl<S> CommandDispatcher<S> {
|
|||
}
|
||||
match &node.redirect {
|
||||
Some(redirect) => {
|
||||
let redirect = if redirect.data_ptr() == self.root.data_ptr() {
|
||||
let redirect = if std::ptr::eq(redirect.data_ptr(), self.root.data_ptr()) {
|
||||
"...".to_string()
|
||||
} else {
|
||||
format!("-> {}", redirect.read().usage_text())
|
||||
|
@ -427,7 +427,7 @@ impl<S> CommandDispatcher<S> {
|
|||
}
|
||||
|
||||
if let Some(redirect) = &node.redirect {
|
||||
let redirect = if redirect.data_ptr() == self.root.data_ptr() {
|
||||
let redirect = if std::ptr::eq(redirect.data_ptr(), self.root.data_ptr()) {
|
||||
"...".to_string()
|
||||
} else {
|
||||
format!("-> {}", redirect.read().usage_text())
|
||||
|
|
|
@ -7,6 +7,7 @@ license.workspace = true
|
|||
repository.workspace = true
|
||||
|
||||
[dependencies]
|
||||
async-compat = "0.2.4"
|
||||
azalea-auth = { path = "../azalea-auth", version = "0.11.0" }
|
||||
azalea-block = { path = "../azalea-block", version = "0.11.0" }
|
||||
azalea-buf = { path = "../azalea-buf", version = "0.11.0" }
|
||||
|
|
|
@ -66,7 +66,11 @@ pub fn read_packets(ecs: &mut World) {
|
|||
let state = conn.state;
|
||||
|
||||
trace!("Received injected packet with bytes: {raw_packet:?}");
|
||||
handle_raw_packet(ecs, &raw_packet, entity, state, &mut queued_packet_events).unwrap();
|
||||
if let Err(e) =
|
||||
handle_raw_packet(ecs, &raw_packet, entity, state, &mut queued_packet_events)
|
||||
{
|
||||
error!("Error reading injected packet: {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,13 +90,18 @@ pub async fn auth_with_account(
|
|||
.uuid
|
||||
.expect("Uuid must be present if access token is present.");
|
||||
|
||||
azalea_auth::sessionserver::join(
|
||||
&access_token,
|
||||
&packet.public_key,
|
||||
&private_key,
|
||||
uuid,
|
||||
&packet.server_id,
|
||||
)
|
||||
// this is necessary since reqwest usually depends on tokio and we're using
|
||||
// `futures` here
|
||||
async_compat::Compat::new(async {
|
||||
azalea_auth::sessionserver::join(
|
||||
&access_token,
|
||||
&packet.public_key,
|
||||
&private_key,
|
||||
uuid,
|
||||
&packet.server_id,
|
||||
)
|
||||
.await
|
||||
})
|
||||
.await
|
||||
} {
|
||||
if attempts >= 2 {
|
||||
|
|
|
@ -35,8 +35,6 @@ fn generic_test_change_dimension_to_nether_and_back(using_respawn: bool) {
|
|||
assert!(simulation.has_component::<InConfigState>());
|
||||
assert!(!simulation.has_component::<InGameState>());
|
||||
|
||||
println!("meow 1");
|
||||
|
||||
simulation.receive_packet(ClientboundRegistryData {
|
||||
registry_id: ResourceLocation::new("minecraft:dimension_type"),
|
||||
entries: vec![
|
||||
|
@ -71,8 +69,6 @@ fn generic_test_change_dimension_to_nether_and_back(using_respawn: bool) {
|
|||
simulation.receive_packet(ClientboundFinishConfiguration);
|
||||
simulation.tick();
|
||||
|
||||
println!("meow 2");
|
||||
|
||||
assert!(!simulation.has_component::<InConfigState>());
|
||||
assert!(simulation.has_component::<InGameState>());
|
||||
assert!(simulation.has_component::<LocalEntity>());
|
||||
|
@ -87,8 +83,6 @@ fn generic_test_change_dimension_to_nether_and_back(using_respawn: bool) {
|
|||
));
|
||||
simulation.tick();
|
||||
|
||||
println!("meow 3");
|
||||
|
||||
assert_eq!(
|
||||
*simulation.component::<InstanceName>(),
|
||||
ResourceLocation::new("azalea:a"),
|
||||
|
|
Loading…
Add table
Reference in a new issue