diff options
| author | mat <git@matdoes.dev> | 2025-12-15 14:59:26 +0700 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-12-15 14:59:26 +0700 |
| commit | 0569ffd2d85585eb69de9068ab3f62e768bce4e7 (patch) | |
| tree | e20d7faf8df7ede4eb3f52d3223b27782a964be0 /azalea-core/src/hit_result.rs | |
| parent | 232f1a434406d77dc5ef1d19edcdf006e32491e8 (diff) | |
| download | azalea-drasl-0569ffd2d85585eb69de9068ab3f62e768bce4e7.tar.xz | |
write/update docs for several items
Diffstat (limited to 'azalea-core/src/hit_result.rs')
| -rw-r--r-- | azalea-core/src/hit_result.rs | 13 |
1 files changed, 11 insertions, 2 deletions
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, } |
