From 0569ffd2d85585eb69de9068ab3f62e768bce4e7 Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 15 Dec 2025 14:59:26 +0700 Subject: write/update docs for several items --- azalea-core/src/hit_result.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'azalea-core/src/hit_result.rs') diff --git a/azalea-core/src/hit_result.rs b/azalea-core/src/hit_result.rs index 2b269aba..e242c4b5 100644 --- a/azalea-core/src/hit_result.rs +++ b/azalea-core/src/hit_result.rs @@ -65,24 +65,33 @@ impl HitResult { } } +/// The result of raycasting on the blocks in the world. +/// +/// Also see [`HitResult`]. #[derive(Clone, Debug, PartialEq)] pub struct BlockHitResult { + /// The exact position that the raycast ended at. pub location: Vec3, pub miss: bool, pub direction: Direction, + /// The block position that was hit. + /// + /// If [`Self::miss`] is true, then this will be the position that the + /// raycast ended at. pub block_pos: BlockPos, pub inside: bool, pub world_border: bool, } impl BlockHitResult { - pub fn miss(location: Vec3, direction: Direction, block_pos: BlockPos) -> Self { + /// Create a new [`BlockHitResult`] for when nothing was hit. + pub fn miss(location: Vec3, direction: Direction) -> Self { Self { location, miss: true, direction, - block_pos, + block_pos: BlockPos::from(location), inside: false, world_border: false, } -- cgit v1.2.3