LeviLamina
Loading...
Searching...
No Matches
HitResult.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4#include "mc/world/actor/Actor.h"
5
6// auto generated inclusion list
7#include "mc/deps/core/math/Vec3.h"
8#include "mc/deps/ecs/WeakEntityRef.h"
9#include "mc/world/level/BlockPos.h"
10#include "mc/world/phys/AABB.h"
11#include "mc/world/phys/HitResultType.h"
12
13// auto generated forward declare list
14// clang-format off
15class Actor;
16// clang-format on
17
18class HitResult {
19public:
20 [[nodiscard]] constexpr explicit operator bool() const {
21 return mType == HitResultType::Tile || mType == HitResultType::Entity;
22 }
23
24 HitResult& operator=(HitResult const&) = default;
25 HitResult(HitResult const&) = default;
26 HitResult(::HitResult&&) = default;
27
28 HitResult(
29 ::Vec3 const& startPos,
30 ::Vec3 const& rayDir,
31 ::Actor& entity,
32 ::Vec3 const& pos,
33 ::AABB const& entityAABB
34 )
35 : mStartPos(startPos),
36 mRayDir(rayDir),
37 mType(HitResultType::Entity),
38 mFacing(0),
39 mPos(pos),
40 mEntity(entity.getEntityContext().getWeakRef()),
41 mEntityAABB(entityAABB),
42 mIsHitLiquid(false),
43 mLiquidFacing(0),
44 mIndirectHit(false) {}
45
46public:
47 // member variables
48 // NOLINTBEGIN
49 ::Vec3 mStartPos;
50 ::Vec3 mRayDir;
51 ::HitResultType mType;
52 uchar mFacing;
53 ::BlockPos mBlock;
54 ::Vec3 mPos;
55 ::WeakEntityRef mEntity;
56 ::AABB mEntityAABB;
57 bool mIsHitLiquid;
58 uchar mLiquidFacing;
59 ::BlockPos mLiquid;
60 ::Vec3 mLiquidPos;
61 bool mIndirectHit;
62 // NOLINTEND
63
64#ifdef LL_PLAT_S
65public:
66 HitResult() = default;
67
68#else // LL_PLAT_C
69public:
70 HitResult() = default;
71
72#endif
73public:
74 // member functions
75 // NOLINTBEGIN
76#ifdef LL_PLAT_C
77 MCAPI HitResult(::Vec3 const& startPos, ::Vec3 const& rayDir, ::Actor& entity, ::Vec3 const& pos);
78#endif
79
80 MCAPI ::Actor* getEntity() const;
81
82#ifdef LL_PLAT_C
83 MCAPI ::HitResult& operator=(::HitResult&&);
84#endif
85 // NOLINTEND
86
87public:
88 // constructor thunks
89 // NOLINTBEGIN
90#ifdef LL_PLAT_C
91 MCAPI void* $ctor(::Vec3 const& startPos, ::Vec3 const& rayDir, ::Actor& entity, ::Vec3 const& pos);
92#endif
93 // NOLINTEND
94};
Definition AABB.h:18
Definition Actor.h:114
Definition BlockPos.h:17
Definition Vec3.h:10
Definition WeakEntityRef.h:14