mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
🐛
This commit is contained in:
parent
c0829e6d0e
commit
6da1bced1e
3 changed files with 31 additions and 1 deletions
|
@ -4,6 +4,29 @@ use azalea_client::{Account, Client, Event};
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
|
// deadlock detection, you can safely delete this block if you're not trying to
|
||||||
|
// debug deadlocks in azalea
|
||||||
|
{
|
||||||
|
use parking_lot::deadlock;
|
||||||
|
use std::thread;
|
||||||
|
use std::time::Duration;
|
||||||
|
thread::spawn(move || loop {
|
||||||
|
thread::sleep(Duration::from_secs(10));
|
||||||
|
let deadlocks = deadlock::check_deadlock();
|
||||||
|
if deadlocks.is_empty() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
println!("{} deadlocks detected", deadlocks.len());
|
||||||
|
for (i, threads) in deadlocks.iter().enumerate() {
|
||||||
|
println!("Deadlock #{i}");
|
||||||
|
for t in threads {
|
||||||
|
println!("Thread Id {:#?}", t.thread_id());
|
||||||
|
println!("{:#?}", t.backtrace());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let account = Account::offline("bot");
|
let account = Account::offline("bot");
|
||||||
// or let account = Account::microsoft("email").await;
|
// or let account = Account::microsoft("email").await;
|
||||||
|
|
||||||
|
|
|
@ -504,7 +504,9 @@ async fn run_schedule_loop(
|
||||||
loop {
|
loop {
|
||||||
// whenever we get an event from run_schedule_receiver, run the schedule
|
// whenever we get an event from run_schedule_receiver, run the schedule
|
||||||
run_schedule_receiver.recv().await;
|
run_schedule_receiver.recv().await;
|
||||||
|
println!("run_schedule_loop tick");
|
||||||
schedule.run(&mut ecs.lock());
|
schedule.run(&mut ecs.lock());
|
||||||
|
println!("run_schedule_loop ticked");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,9 +517,13 @@ pub async fn tick_run_schedule_loop(run_schedule_sender: mpsc::UnboundedSender<(
|
||||||
// TODO: Minecraft bursts up to 10 ticks and then skips, we should too
|
// TODO: Minecraft bursts up to 10 ticks and then skips, we should too
|
||||||
game_tick_interval.set_missed_tick_behavior(time::MissedTickBehavior::Burst);
|
game_tick_interval.set_missed_tick_behavior(time::MissedTickBehavior::Burst);
|
||||||
|
|
||||||
|
println!("tick_run_schedule_loop started");
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
game_tick_interval.tick().await;
|
game_tick_interval.tick().await;
|
||||||
if run_schedule_sender.send(()).is_err() {
|
println!("tick_run_schedule_loop tick");
|
||||||
|
if let Err(e) = run_schedule_sender.send(()) {
|
||||||
|
println!("tick_run_schedule_loop error: {}", e);
|
||||||
// the sender is closed so end the task
|
// the sender is closed so end the task
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -318,6 +318,7 @@ pub fn local_player_ai_step(
|
||||||
&LocalPlayerInLoadedChunk,
|
&LocalPlayerInLoadedChunk,
|
||||||
>,
|
>,
|
||||||
) {
|
) {
|
||||||
|
println!("local_player_ai_step");
|
||||||
for (mut local_player, mut physics, mut position, mut sprinting, mut attributes) in
|
for (mut local_player, mut physics, mut position, mut sprinting, mut attributes) in
|
||||||
query.iter_mut()
|
query.iter_mut()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue