aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-05-09 15:00:12 -1200
committermat <git@matdoes.dev>2025-05-09 15:00:12 -1200
commit6a5a88700c3f649fab1abc4a51f6fac9281db874 (patch)
treebed73430ba622df59b926f173e35c1d0a7683c60
parente1d3b902ba08170e4ee82c53f216445f57fbc47e (diff)
downloadazalea-drasl-6a5a88700c3f649fab1abc4a51f6fac9281db874.tar.xz
fix offline-mode cert warnings and improve some docs
-rw-r--r--azalea-client/src/plugins/chat_signing.rs6
-rw-r--r--azalea-client/src/plugins/interact.rs9
-rw-r--r--azalea-core/src/hit_result.rs4
-rw-r--r--azalea-physics/src/clip.rs2
-rw-r--r--azalea-protocol/src/packets/game/s_use_item_on.rs4
-rw-r--r--azalea/examples/testbot/commands/debug.rs2
6 files changed, 17 insertions, 10 deletions
diff --git a/azalea-client/src/plugins/chat_signing.rs b/azalea-client/src/plugins/chat_signing.rs
index d65f4eb3..9863cb3f 100644
--- a/azalea-client/src/plugins/chat_signing.rs
+++ b/azalea-client/src/plugins/chat_signing.rs
@@ -94,7 +94,11 @@ pub fn request_certs_if_needed(
Option<&OnlyRefreshCertsAfter>,
Option<&ChatSigningSession>,
),
- (Without<RequestCertsTask>, With<InGameState>),
+ (
+ Without<RequestCertsTask>,
+ With<InGameState>,
+ With<IsAuthenticated>,
+ ),
>,
) {
for (entity, account, only_refresh_certs_after, chat_signing_session) in query.iter_mut() {
diff --git a/azalea-client/src/plugins/interact.rs b/azalea-client/src/plugins/interact.rs
index 5ec95b46..c623663e 100644
--- a/azalea-client/src/plugins/interact.rs
+++ b/azalea-client/src/plugins/interact.rs
@@ -85,10 +85,10 @@ impl Client {
});
}
- /// Use the current item.
+ /// Right-click the currently held item.
///
/// If the item is consumable, then it'll act as if right-click was held
- /// until the item finished being consumed. You can use this to eat food.
+ /// until the item finishes being consumed. You can use this to eat food.
///
/// If we're looking at a block or entity, then it will be clicked. Also see
/// [`Client::block_interact`].
@@ -163,6 +163,7 @@ pub struct StartUseItemQueued {
/// it, but should be avoided to stay compatible with anticheats.
pub force_block: Option<BlockPos>,
}
+#[allow(clippy::type_complexity)]
pub fn handle_start_use_item_queued(
mut commands: Commands,
query: Query<(
@@ -187,7 +188,7 @@ pub fn handle_start_use_item_queued(
let mut hit_result = hit_result.0.clone();
if let Some(force_block) = start_use_item.force_block {
- let hit_result_matches = if let HitResult::Block(block_hit_result) = hit_result {
+ let hit_result_matches = if let HitResult::Block(block_hit_result) = &hit_result {
block_hit_result.block_pos == force_block
} else {
false
@@ -206,7 +207,7 @@ pub fn handle_start_use_item_queued(
}
}
- match hit_result {
+ match &hit_result {
HitResult::Block(block_hit_result) => {
if block_hit_result.miss {
commands.trigger(SendPacketEvent::new(
diff --git a/azalea-core/src/hit_result.rs b/azalea-core/src/hit_result.rs
index 2fc78115..76f7ca84 100644
--- a/azalea-core/src/hit_result.rs
+++ b/azalea-core/src/hit_result.rs
@@ -6,7 +6,7 @@ use crate::{
/// The block or entity that our player is looking at and can interact with.
///
/// If there's nothing, it'll be a [`BlockHitResult`] with `miss` set to true.
-#[derive(Debug, Clone, Copy, PartialEq)]
+#[derive(Debug, Clone, PartialEq)]
pub enum HitResult {
Block(BlockHitResult),
/// TODO
@@ -37,7 +37,7 @@ impl HitResult {
}
}
-#[derive(Debug, Clone, Copy, PartialEq)]
+#[derive(Debug, Clone, PartialEq)]
pub struct BlockHitResult {
pub location: Vec3,
pub direction: Direction,
diff --git a/azalea-physics/src/clip.rs b/azalea-physics/src/clip.rs
index 96c11d1a..e557b028 100644
--- a/azalea-physics/src/clip.rs
+++ b/azalea-physics/src/clip.rs
@@ -111,9 +111,11 @@ pub fn clip(chunk_storage: &ChunkStorage, context: ClipContext) -> BlockHitResul
let fluid_clip = fluid_shape.clip(&ctx.from, &ctx.to, block_pos);
let distance_to_interaction = interaction_clip
+ .as_ref()
.map(|hit| ctx.from.distance_squared_to(&hit.location))
.unwrap_or(f64::MAX);
let distance_to_fluid = fluid_clip
+ .as_ref()
.map(|hit| ctx.from.distance_squared_to(&hit.location))
.unwrap_or(f64::MAX);
diff --git a/azalea-protocol/src/packets/game/s_use_item_on.rs b/azalea-protocol/src/packets/game/s_use_item_on.rs
index 967fb5e9..cfe4a5d3 100644
--- a/azalea-protocol/src/packets/game/s_use_item_on.rs
+++ b/azalea-protocol/src/packets/game/s_use_item_on.rs
@@ -79,12 +79,12 @@ impl AzaleaRead for BlockHit {
}
}
-impl From<BlockHitResult> for BlockHit {
+impl From<&BlockHitResult> for BlockHit {
/// Converts a [`BlockHitResult`] to a [`BlockHit`].
///
/// The only difference is that the `miss` field is not present in
/// [`BlockHit`].
- fn from(hit_result: BlockHitResult) -> Self {
+ fn from(hit_result: &BlockHitResult) -> Self {
Self {
block_pos: hit_result.block_pos,
direction: hit_result.direction,
diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs
index 0bac22d4..075348b2 100644
--- a/azalea/examples/testbot/commands/debug.rs
+++ b/azalea/examples/testbot/commands/debug.rs
@@ -102,7 +102,7 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) {
commands.register(literal("lookingat").executes(|ctx: &Ctx| {
let source = ctx.source.lock();
- let hit_result = *source.bot.component::<HitResultComponent>();
+ let hit_result = source.bot.component::<HitResultComponent>();
let Some(hit_result) = hit_result.as_block_hit_result_if_not_miss() else {
source.reply("I'm not looking at anything");