aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-10-08 00:03:07 -0500
committermat <github@matdoes.dev>2022-10-08 00:03:07 -0500
commit82c04004dbf37b813e1f4223d56b399c40d68e80 (patch)
tree5449eb73f86521b025994719f8ead6e947e424ec
parent7c955c794aa2ea69f016970b221343a4cfc55b87 (diff)
downloadazalea-drasl-82c04004dbf37b813e1f4223d56b399c40d68e80.tar.xz
change definition of Event::Tick
-rw-r--r--azalea-client/src/client.rs6
-rw-r--r--bot/src/main.rs2
2 files changed, 4 insertions, 4 deletions
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs
index bbf78ee6..0e13415c 100644
--- a/azalea-client/src/client.rs
+++ b/azalea-client/src/client.rs
@@ -50,7 +50,7 @@ use tokio::{
pub enum Event {
Login,
Chat(ChatPacket),
- /// A game tick, happens 20 times per second.
+ /// Happens 20 times per second, but only when the world is loaded.
Tick,
Packet(Box<ClientboundGamePacket>),
}
@@ -725,8 +725,6 @@ impl Client {
/// Runs every 50 milliseconds.
async fn game_tick(client: &mut Client, tx: &UnboundedSender<Event>) {
- tx.send(Event::Tick).unwrap();
-
// return if there's no chunk at the player's position
{
let dimension_lock = client.dimension.lock();
@@ -743,6 +741,8 @@ impl Client {
}
}
+ tx.send(Event::Tick).unwrap();
+
// TODO: if we're a passenger, send the required packets
if let Err(e) = client.send_position().await {
diff --git a/bot/src/main.rs b/bot/src/main.rs
index 2f79ad26..0a291fd8 100644
--- a/bot/src/main.rs
+++ b/bot/src/main.rs
@@ -25,7 +25,7 @@ async fn main() {
async fn handle(bot: Client, event: Arc<Event>, _state: Arc<Mutex<State>>) -> anyhow::Result<()> {
if let Event::Tick = *event {
- // bot.jump();
+ bot.jump();
}
Ok(())