补全HitResult

This commit is contained in:
Qiuzhizhe 2023-03-18 06:33:20 -07:00
parent 68fe280544
commit ac4ca933de
2 changed files with 17 additions and 16 deletions

View File

@ -9,10 +9,10 @@
class StackResultStorageEntity; class StackResultStorageEntity;
enum class HitResultType:int { enum class HitResultType:int {
TILE=0, TILE = 0,
ENTITY, ENTITY = 0x1,
ENTITY_OUT_OF_RANGE, ENTITY_OUT_OF_RANGE = 0x2,
NO_HIT, NO_HIT = 0x3,
}; };
#undef BEFORE_EXTRA #undef BEFORE_EXTRA
@ -22,7 +22,6 @@ class HitResult {
#define AFTER_EXTRA #define AFTER_EXTRA
// Add Member There // Add Member There
//char filler[112];
Vec3 startPos; //0 Vec3 startPos; //0
Vec3 rayDir; //12 Vec3 rayDir; //12
HitResultType type; //24 HitResultType type; //24
@ -30,20 +29,17 @@ class HitResult {
BlockPos endBpos; //32 BlockPos endBpos; //32
Vec3 endPos; //44 Vec3 endPos; //44
uintptr_t actorRef; //56 uintptr_t actorRef; //56
uintptr_t unk64; bool mIsHitLiquid; //64
int unk72; FaceID liquidFace; //65
int unk76; //76 BlockPos liquidBpos; //68
bool hitLiquid; //80 Vec3 liquidPos; //80
FaceID liquidFace; //81 bool indirectHit; //92
BlockPos liquidBpos; //84
Vec3 liquidPos; //96
bool indirectHit; //108
//112
public: public:
inline bool __fastcall isHit() { inline bool isHit() {
return (unsigned int)(*((int*)this + 6) - 2) > 1; return (unsigned int)(this->type) > 3;
} }
LIAPI Actor* getEntity();
LIAPI FaceID getFacing(); LIAPI FaceID getFacing();
LIAPI Vec3 getPos(); LIAPI Vec3 getPos();
LIAPI bool isHitLiquid(); LIAPI bool isHitLiquid();

View File

@ -1,5 +1,10 @@
#include <llapi/mc/HitResult.hpp> #include <llapi/mc/HitResult.hpp>
#include <llapi/HookAPI.h> #include <llapi/HookAPI.h>
#include <llapi/mc/Actor.hpp>
Actor* HitResult::getEntity() {
return (Actor*)this->actorRef;
}
FaceID HitResult::getFacing() { FaceID HitResult::getFacing() {
return dAccess<FaceID>(this, ll::offset::HITRESULTAPI_getFacing); return dAccess<FaceID>(this, ll::offset::HITRESULTAPI_getFacing);