aboutsummaryrefslogtreecommitdiff
path: root/examples/pvp.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 /examples/pvp.rs
parent37f9f1c6feda676be30bef31291eaed2a5fc82ce (diff)
downloadazalea-drasl-06068377bd17f95bdafe86ff14bab1d0d852aa53.tar.xz
New example (#24)
the example isn't finished but it's finished enough
Diffstat (limited to 'examples/pvp.rs')
-rw-r--r--examples/pvp.rs33
1 files changed, 0 insertions, 33 deletions
diff --git a/examples/pvp.rs b/examples/pvp.rs
deleted file mode 100644
index 5febdd45..00000000
--- a/examples/pvp.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-use azalea::{Account, Accounts, Event, pathfinder};
-
-#[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();
-
- match bots.next().await {
- Event::Tick {
- // choose an arbitrary player within render distance to target
- if let Some(target) = bots.world.find_one_entity(|e| e.id == "minecraft:player") {
- for bot in bots {
- bot.tick_goto_goal(
- pathfinder::Goals::Reach(target.bounding_box)
- );
- // if target.bounding_box.distance(bot.eyes) < bot.reach_distance() {
- if bot.entity.can_reach(target.bounding_box) {
- bot.swing();
- }
- if !h.using_held_item() && bot.state.lock().hunger <= 17 {
- bot.hold(azalea::ItemGroup::Food);
- tokio::task::spawn(bot.use_held_item());
- }
- }
- }
- },
- _ => {}
- }
-}