aboutsummaryrefslogtreecommitdiff
path: root/azalea/examples/mine_a_chunk.rs
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2022-10-02 14:58:42 -0500
committerGitHub <noreply@github.com>2022-10-02 14:58:42 -0500
commit06068377bd17f95bdafe86ff14bab1d0d852aa53 (patch)
treeed3f15107d69dc0cc8f6794745832b82a1649c80 /azalea/examples/mine_a_chunk.rs
parent37f9f1c6feda676be30bef31291eaed2a5fc82ce (diff)
downloadazalea-drasl-06068377bd17f95bdafe86ff14bab1d0d852aa53.tar.xz
New example (#24)
the example isn't finished but it's finished enough
Diffstat (limited to 'azalea/examples/mine_a_chunk.rs')
-rw-r--r--azalea/examples/mine_a_chunk.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/azalea/examples/mine_a_chunk.rs b/azalea/examples/mine_a_chunk.rs
new file mode 100644
index 00000000..6549f2b2
--- /dev/null
+++ b/azalea/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::BlockPos::new(0, 70, 0)).await;
+ // or bots.goto_goal(pathfinder::Goals::Goto(azalea::BlockPos(0, 70, 0))).await;
+
+ // destroy the blocks in this area and then leave
+
+ bots.fill(
+ azalea::Selection::Range(
+ azalea::BlockPos::new(0, 0, 0),
+ azalea::BlockPos::new(16, 255, 16)
+ ),
+ azalea::block::Air
+ ).await;
+}