1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00

change definition of Event::Tick

This commit is contained in:
mat 2022-10-08 00:03:07 -05:00
parent 7c955c794a
commit 82c04004db
2 changed files with 4 additions and 4 deletions

View file

@ -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 {

View file

@ -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(())