mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
start adding stuff to azalea crate
This commit is contained in:
parent
06068377bd
commit
e0bcab53b8
6 changed files with 24 additions and 6 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -103,6 +103,7 @@ name = "azalea"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
"azalea-client",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
|
@ -9,9 +9,9 @@ version = "0.1.0"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
azalea-client = {version = "0.1.0", path = "../azalea-client"}
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tokio = "^1.21.1"
|
|
||||||
env_logger = "^0.9.1"
|
|
||||||
anyhow = "^1.0.65"
|
anyhow = "^1.0.65"
|
||||||
|
env_logger = "^0.9.1"
|
||||||
|
tokio = "^1.21.1"
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
This is currently an advertisement crate for [Azalea](https://github.com/mat-1/azalea), it will have more stuff later!
|
A wrapper over azalea-client, adding useful functions for making bots.
|
||||||
|
|
14
azalea/src/bot.rs
Normal file
14
azalea/src/bot.rs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
pub struct BotState {
|
||||||
|
jumping_once: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait BotTrait {
|
||||||
|
fn jump(&mut self);
|
||||||
|
}
|
||||||
|
|
||||||
|
impl BotTrait for azalea_client::Client {
|
||||||
|
fn jump(&mut self) {
|
||||||
|
let mut physics_state = self.physics_state.lock().unwrap();
|
||||||
|
physics_state.jumping_once = true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,2 +1,4 @@
|
||||||
//! This is currently an advertisement crate for
|
mod bot;
|
||||||
//! [Azalea](https://github.com/mat-1/azalea). More stuff will be here soon!
|
pub mod prelude;
|
||||||
|
|
||||||
|
pub use azalea_client::Client;
|
||||||
|
|
1
azalea/src/prelude.rs
Normal file
1
azalea/src/prelude.rs
Normal file
|
@ -0,0 +1 @@
|
||||||
|
pub use crate::bot::BotTrait;
|
Loading…
Add table
Reference in a new issue