aboutsummaryrefslogtreecommitdiff
path: root/azalea
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-10-12 22:10:02 -0300
committermat <git@matdoes.dev>2025-10-12 22:10:02 -0300
commit9aaf893588eaecd62f6b146897cbce8a3a5058b5 (patch)
treeeb4bd109480b8e6cfbcd89f1f309c4954d8c8f7f /azalea
parent5f6ebb98c9ef5775ed5fe39662436b83a3108aa6 (diff)
downloadazalea-drasl-9aaf893588eaecd62f6b146897cbce8a3a5058b5.tar.xz
improve ux for entity matching functions
Diffstat (limited to 'azalea')
-rw-r--r--azalea/examples/testbot/commands.rs4
-rw-r--r--azalea/examples/testbot/commands/debug.rs2
-rw-r--r--azalea/src/pathfinder/moves/mod.rs13
3 files changed, 5 insertions, 14 deletions
diff --git a/azalea/examples/testbot/commands.rs b/azalea/examples/testbot/commands.rs
index 1616b82e..9d9d9b8a 100644
--- a/azalea/examples/testbot/commands.rs
+++ b/azalea/examples/testbot/commands.rs
@@ -32,8 +32,8 @@ impl CommandSource {
pub fn entity(&mut self) -> Option<Entity> {
let username = self.chat.sender()?;
self.bot
- .any_entity_by::<With<Player>, &GameProfileComponent>(
- |profile: &&GameProfileComponent| profile.name == username,
+ .any_entity_by::<&GameProfileComponent, With<Player>>(
+ |profile: &GameProfileComponent| profile.name == username,
)
}
}
diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs
index d80ee3be..91f7dc61 100644
--- a/azalea/examples/testbot/commands/debug.rs
+++ b/azalea/examples/testbot/commands/debug.rs
@@ -218,7 +218,7 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) {
let source = ctx.source.lock();
let player_entities = source
.bot
- .nearest_entities_by::<With<metadata::Player>, ()>(|_: &()| true);
+ .nearest_entities_by::<(), With<metadata::Player>>(|_: ()| true);
let tab_list = source.bot.tab_list();
for player_entity in player_entities {
let uuid = source.bot.entity_component::<EntityUuid>(player_entity);
diff --git a/azalea/src/pathfinder/moves/mod.rs b/azalea/src/pathfinder/moves/mod.rs
index bb2354bf..fc574a4c 100644
--- a/azalea/src/pathfinder/moves/mod.rs
+++ b/azalea/src/pathfinder/moves/mod.rs
@@ -217,19 +217,10 @@ pub struct IsReachedCtx<'a> {
#[must_use]
pub fn default_is_reached(
IsReachedCtx {
- position,
- target,
- physics,
- ..
+ position, target, ..
}: IsReachedCtx,
) -> bool {
- if BlockPos::from(position) == target {
- return true;
- }
-
- // this is to make it handle things like slabs correctly, if we're on the block
- // below the target but on_ground
- BlockPos::from(position).up(1) == target && physics.on_ground()
+ player_pos_to_block_pos(position) == target
}
pub struct PathfinderCtx<'a> {