aboutsummaryrefslogtreecommitdiff
path: root/azalea/examples
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2023-09-19 02:01:39 -0500
committermat <git@matdoes.dev>2023-09-19 02:01:39 -0500
commit83cce236145cdab1872a472a70943b669a880965 (patch)
tree2ce4a6c6e46b887e100e3e710e4c809d3a1e7279 /azalea/examples
parent51963990bc0cbbbca388b2ed015fd64ff6492d7b (diff)
downloadazalea-drasl-83cce236145cdab1872a472a70943b669a880965.tar.xz
add Loaded component and fix clamping look direction
Diffstat (limited to 'azalea/examples')
-rw-r--r--azalea/examples/testbot.rs28
1 files changed, 14 insertions, 14 deletions
diff --git a/azalea/examples/testbot.rs b/azalea/examples/testbot.rs
index c178a1d8..49243aa1 100644
--- a/azalea/examples/testbot.rs
+++ b/azalea/examples/testbot.rs
@@ -164,17 +164,17 @@ async fn handle(mut bot: Client, event: Event, _state: State) -> anyhow::Result<
println!("inventory: {:?}", bot.menu());
}
"findblock" => {
- let target_pos = bot
- .world()
- .read()
- .find_block(bot.position(), &azalea::Block::DiamondBlock.into());
+ let target_pos = bot.world().read().find_block(
+ bot.position(),
+ &azalea::registry::Block::DiamondBlock.into(),
+ );
bot.chat(&format!("target_pos: {target_pos:?}",));
}
"gotoblock" => {
- let target_pos = bot
- .world()
- .read()
- .find_block(bot.position(), &azalea::Block::DiamondBlock.into());
+ let target_pos = bot.world().read().find_block(
+ bot.position(),
+ &azalea::registry::Block::DiamondBlock.into(),
+ );
if let Some(target_pos) = target_pos {
// +1 to stand on top of the block
bot.goto(BlockPosGoal::from(target_pos.up(1)));
@@ -183,10 +183,10 @@ async fn handle(mut bot: Client, event: Event, _state: State) -> anyhow::Result<
}
}
"mineblock" => {
- let target_pos = bot
- .world()
- .read()
- .find_block(bot.position(), &azalea::Block::DiamondBlock.into());
+ let target_pos = bot.world().read().find_block(
+ bot.position(),
+ &azalea::registry::Block::DiamondBlock.into(),
+ );
if let Some(target_pos) = target_pos {
// +1 to stand on top of the block
bot.chat("ok mining diamond block");
@@ -201,7 +201,7 @@ async fn handle(mut bot: Client, event: Event, _state: State) -> anyhow::Result<
let target_pos = bot
.world()
.read()
- .find_block(bot.position(), &azalea::Block::Lever.into());
+ .find_block(bot.position(), &azalea::registry::Block::Lever.into());
let Some(target_pos) = target_pos else {
bot.chat("no lever found");
return Ok(());
@@ -218,7 +218,7 @@ async fn handle(mut bot: Client, event: Event, _state: State) -> anyhow::Result<
let target_pos = bot
.world()
.read()
- .find_block(bot.position(), &azalea::Block::Chest.into());
+ .find_block(bot.position(), &azalea::registry::Block::Chest.into());
let Some(target_pos) = target_pos else {
bot.chat("no chest found");
return Ok(());