mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 23:44:38 +00:00
change definition of Event::Tick
This commit is contained in:
parent
7c955c794a
commit
82c04004db
2 changed files with 4 additions and 4 deletions
|
@ -50,7 +50,7 @@ use tokio::{
|
||||||
pub enum Event {
|
pub enum Event {
|
||||||
Login,
|
Login,
|
||||||
Chat(ChatPacket),
|
Chat(ChatPacket),
|
||||||
/// A game tick, happens 20 times per second.
|
/// Happens 20 times per second, but only when the world is loaded.
|
||||||
Tick,
|
Tick,
|
||||||
Packet(Box<ClientboundGamePacket>),
|
Packet(Box<ClientboundGamePacket>),
|
||||||
}
|
}
|
||||||
|
@ -725,8 +725,6 @@ impl Client {
|
||||||
|
|
||||||
/// Runs every 50 milliseconds.
|
/// Runs every 50 milliseconds.
|
||||||
async fn game_tick(client: &mut Client, tx: &UnboundedSender<Event>) {
|
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
|
// return if there's no chunk at the player's position
|
||||||
{
|
{
|
||||||
let dimension_lock = client.dimension.lock();
|
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
|
// TODO: if we're a passenger, send the required packets
|
||||||
|
|
||||||
if let Err(e) = client.send_position().await {
|
if let Err(e) = client.send_position().await {
|
||||||
|
|
|
@ -25,7 +25,7 @@ async fn main() {
|
||||||
|
|
||||||
async fn handle(bot: Client, event: Arc<Event>, _state: Arc<Mutex<State>>) -> anyhow::Result<()> {
|
async fn handle(bot: Client, event: Arc<Event>, _state: Arc<Mutex<State>>) -> anyhow::Result<()> {
|
||||||
if let Event::Tick = *event {
|
if let Event::Tick = *event {
|
||||||
// bot.jump();
|
bot.jump();
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue