aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-14 11:21:04 -0500
committermat <github@matdoes.dev>2022-05-14 11:21:04 -0500
commit70271ede1982b618b5bb592da4adffabcdd76dac (patch)
treefd73f1685ef66a078b973a9e21ec9aba4d3a0550
parent7c194fb245fac1c52fbb9e4ca042dd5c42d522b6 (diff)
parentef3cbe27f2a7eed5c635924d6fa0401dd04eae77 (diff)
downloadazalea-drasl-70271ede1982b618b5bb592da4adffabcdd76dac.tar.xz
Merge branch 'main' into chunk-decoding
-rw-r--r--[-rwxr-xr-x]README.md32
1 files changed, 25 insertions, 7 deletions
diff --git a/README.md b/README.md
index 4c90ba42..e214fb09 100755..100644
--- a/README.md
+++ b/README.md
@@ -14,15 +14,15 @@ I wanted a fun excuse to do something cool with Rust, and I also felt like I cou
## Goals
-- Do everything a vanilla client can do
-- Be easy to use
-- Bypass most/all anticheats
-- Support the latest Minecraft version
-- Be fast and memory efficient
+- Do everything a vanilla client can do.
+- Be easy to use.
+- Bypass most/all anticheats.
+- Support the latest Minecraft version.
+- Be fast and memory efficient.
## Example code
-Note that these doesn't work yet, it's just how I want the API to look.
+Note that these don't work yet, it's just how I want the API to look.
```rs
use azalea::{Account, Event};
@@ -42,6 +42,24 @@ loop {
println!(m);
bot.reconnect().await.unwrap();
},
+ Event::Hunger(h) {
+ if !h.using_held_item() && h.hunger <= 17 {
+ match bot.hold(azalea::ItemGroup::Food).await {
+ Ok(_) => {},
+ Err(e) => {
+ println!("{}", e);
+ break;
+ }
+ }
+ match bot.use_held_item().await {
+ Ok(_) => {},
+ Err(e) => {
+ println!("{}", e);
+ break;
+ }
+ }
+ }
+ }
_ => {}
}
}
@@ -56,7 +74,7 @@ let bot = Bot::offline("bot");
bot.join("localhost".try_into().unwrap()).await.unwrap();
loop {
- match bot.recv().await {
+ match bot.next().await {
Event::Message(m) {
if m.username == bot.username { return };
if m.message = "go" {