mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 06:16:04 +00:00
fix offline-mode cert warnings and improve some docs
This commit is contained in:
parent
e1d3b902ba
commit
6a5a88700c
6 changed files with 17 additions and 10 deletions
|
@ -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() {
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Add table
Reference in a new issue