aboutsummaryrefslogtreecommitdiff
path: root/examples/mine_a_chunk.rs
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-14 20:50:20 -0500
committermat <github@matdoes.dev>2022-05-14 20:50:20 -0500
commit5c1712c8404e52f893e3fc10f79a337933865123 (patch)
treea515b76d77fdf710314f07d70ec639f4a6dded6a /examples/mine_a_chunk.rs
parent4000a9d29cbd286517e00db88a27aeddc1967557 (diff)
downloadazalea-drasl-5c1712c8404e52f893e3fc10f79a337933865123.tar.xz
move examples into examples directory
Diffstat (limited to 'examples/mine_a_chunk.rs')
-rw-r--r--examples/mine_a_chunk.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/examples/mine_a_chunk.rs b/examples/mine_a_chunk.rs
new file mode 100644
index 00000000..bb85a637
--- /dev/null
+++ b/examples/mine_a_chunk.rs
@@ -0,0 +1,27 @@
+use azalea::{Account, Accounts, Event, pathfinder};
+
+// You can use the `azalea::Bots` struct to control many bots as one unit.
+
+#[tokio::main]
+async fn main() {
+ let accounts = Accounts::new();
+
+ for i in 0..10 {
+ accounts.add(Account::offline(format!("bot{}", i)));
+ }
+
+ let bots = accounts.join("localhost".try_into().unwrap()).await.unwrap();
+
+ bots.goto(azalea::BlockCoord(0, 70, 0)).await;
+ // or bots.goto_goal(pathfinder::Goals::Goto(azalea::BlockCoord(0, 70, 0))).await;
+
+ // destroy the blocks in this area and then leave
+
+ bots.fill(
+ azalea::Selection::Range(
+ azalea::BlockCoord(0, 0, 0),
+ azalea::BlockCoord(16, 255, 16)
+ ),
+ azalea::block::Air
+ ).await;
+}