aboutsummaryrefslogtreecommitdiff
path: root/azalea/examples
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2025-12-12 00:56:02 -0600
committerGitHub <noreply@github.com>2025-12-12 00:56:02 -0600
commitf9c25665c203d6377ace62f1e95381d037d8fd9e (patch)
tree8b4131d20fe661d3cc1175ec27f801fe61df41ea /azalea/examples
parent82ad975242292d5875780b4398b62637674bf50a (diff)
downloadazalea-drasl-f9c25665c203d6377ace62f1e95381d037d8fd9e.tar.xz
Refactor azalea-registry (#294)
* move registries in azalea-registry into separate modules * rename Item and Block to ItemKind and BlockKind * remove 'extra' registries from azalea-registry * hide deprecated items from docs * use DamageKindKey instead of Identifier when parsing registries * store tag entries as a Vec instead of a HashSet * sort tag values by protocol id * update changelog
Diffstat (limited to 'azalea/examples')
-rw-r--r--azalea/examples/steal.rs5
-rw-r--r--azalea/examples/testbot/commands/debug.rs2
-rw-r--r--azalea/examples/todo/craft_dig_straight_down.rs4
3 files changed, 6 insertions, 5 deletions
diff --git a/azalea/examples/steal.rs b/azalea/examples/steal.rs
index 899c2568..c928545f 100644
--- a/azalea/examples/steal.rs
+++ b/azalea/examples/steal.rs
@@ -4,6 +4,7 @@ use std::sync::Arc;
use azalea::{BlockPos, pathfinder::goals::RadiusGoal, prelude::*};
use azalea_inventory::{ItemStack, operations::QuickMoveClick};
+use azalea_registry::builtin::{BlockKind, ItemKind};
use parking_lot::Mutex;
#[tokio::main]
@@ -55,7 +56,7 @@ async fn steal(bot: Client, state: State) -> anyhow::Result<()> {
let chest_block = bot
.world()
.read()
- .find_blocks(bot.position(), &azalea::registry::Block::Chest.into())
+ .find_blocks(bot.position(), &BlockKind::Chest.into())
.find(
// find the closest chest that hasn't been checked
|block_pos| !state.checked_chests.lock().contains(block_pos),
@@ -79,7 +80,7 @@ async fn steal(bot: Client, state: State) -> anyhow::Result<()> {
let ItemStack::Present(item) = slot else {
continue;
};
- if item.kind == azalea::registry::Item::Diamond {
+ if item.kind == ItemKind::Diamond {
println!("clicking slot ^");
chest.click(QuickMoveClick::Left { slot: index as u16 });
}
diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs
index dfd055ea..c5b93c7d 100644
--- a/azalea/examples/testbot/commands/debug.rs
+++ b/azalea/examples/testbot/commands/debug.rs
@@ -142,7 +142,7 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) {
println!("getblock xyz {x} {y} {z}");
let block_pos = BlockPos::new(x, y, z);
let block = source.bot.world().read().get_block_state(block_pos);
- source.reply(format!("Block at {block_pos} is {block:?}"));
+ source.reply(format!("BlockKind at {block_pos} is {block:?}"));
1
})),
)));
diff --git a/azalea/examples/todo/craft_dig_straight_down.rs b/azalea/examples/todo/craft_dig_straight_down.rs
index 951c3de2..0d9961d4 100644
--- a/azalea/examples/todo/craft_dig_straight_down.rs
+++ b/azalea/examples/todo/craft_dig_straight_down.rs
@@ -38,7 +38,7 @@ async fn handle(bot: Client, event: Event, state: State) -> anyhow::Result<()> {
bot.goto(pathfinder::Goals::NearXZ(5, azalea::BlockXZ(0, 0)))
.await;
let chest = bot
- .open_container_at(&bot.world().find_block(azalea::Block::Chest))
+ .open_container_at(&bot.world().find_block(BlockKind::Chest))
.await
.unwrap();
bot.take_amount_from_container(&chest, 5, |i| i.id == "#minecraft:planks")
@@ -46,7 +46,7 @@ async fn handle(bot: Client, event: Event, state: State) -> anyhow::Result<()> {
chest.close().await;
let crafting_table = bot
- .open_crafting_table(&bot.world.find_block(azalea::Block::CraftingTable))
+ .open_crafting_table(&bot.world.find_block(BlockKind::CraftingTable))
.await
.unwrap();
bot.craft(&crafting_table, &bot.recipe_for("minecraft:sticks"))