From 7a597c698e932e4a3048e4f2254e4242386626e5 Mon Sep 17 00:00:00 2001 From: Qiuzhizhe <42761326+quizhizhe@users.noreply.github.com> Date: Sat, 4 Feb 2023 01:04:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E5=81=8F=E7=A7=BB=E8=8E=B7?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LiteLoader/Kernel/MC/ActorAPI.cpp | 12 +++++++----- LiteLoader/Kernel/MC/BlockInstanceAPI.cpp | 6 +++--- ScriptEngine/API/EntityAPI.cpp | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/LiteLoader/Kernel/MC/ActorAPI.cpp b/LiteLoader/Kernel/MC/ActorAPI.cpp index 1c51427..d118d00 100644 --- a/LiteLoader/Kernel/MC/ActorAPI.cpp +++ b/LiteLoader/Kernel/MC/ActorAPI.cpp @@ -56,7 +56,8 @@ bool Actor::isPlayer(bool allowSimulatedPlayer) const { } bool Actor::isOnGround() const { - return (dAccess(this)); // IDA DirectActorProxyImpl::isOnGround +// return (dAccess(this)); //猜的 + return this->mOnGround; } std::string Actor::getTypeName() const { @@ -76,9 +77,9 @@ bool Actor::isOnGround() const { return res; } - +[[deprecated]] Vec2* Actor::getDirection() const { - return (Vec2*)(this + 312); // IDA: Actor::getRotation() + return (Vec2*)(this + 256); // 猜的 mRos } BlockPos Actor::getBlockPos() { @@ -120,7 +121,8 @@ ActorUniqueID Actor::getActorUniqueId() const { SimpleContainer & Actor::getHandContainer(){ //ScriptHandContainerComponent::hasComponent actor - return dAccess(this, 176); +// return dAccess(this, 176); + return *this->mHand; } ItemStack* Actor::getHandSlot() { @@ -131,7 +133,7 @@ ItemStack* Actor::getHandSlot() { SimpleContainer & Actor::getArmorContainer(){ // ItemStackNetManagerServer::_handleLegacyTransactionRequest Line46 - return dAccess(this, 1400); + return *this->mArmor; } bool Actor::rename(const string& name) { diff --git a/LiteLoader/Kernel/MC/BlockInstanceAPI.cpp b/LiteLoader/Kernel/MC/BlockInstanceAPI.cpp index 1162dfa..b507f74 100644 --- a/LiteLoader/Kernel/MC/BlockInstanceAPI.cpp +++ b/LiteLoader/Kernel/MC/BlockInstanceAPI.cpp @@ -35,9 +35,9 @@ Block* BlockInstance::getBlock() { return isNull() ? nullptr : block; }; -// bool BlockInstance::hasBlockEntity() { -// return block->hasBlockEntity(); -// } +bool BlockInstance::hasBlockEntity() { + return block->hasBlockEntity(); +} BlockActor* BlockInstance::getBlockEntity() { return Level::getBlockSource(dim)->getBlockEntity(pos); diff --git a/ScriptEngine/API/EntityAPI.cpp b/ScriptEngine/API/EntityAPI.cpp index 2664779..243373c 100644 --- a/ScriptEngine/API/EntityAPI.cpp +++ b/ScriptEngine/API/EntityAPI.cpp @@ -569,8 +569,8 @@ Local EntityClass::getDirection() { if (!entity) return Local(); - Vec2* vec = entity->getDirection(); - return DirectionAngle::newAngle(vec->x, vec->y); + Vec2 vec = entity->getRotation(); + return DirectionAngle::newAngle(vec.x, vec.y); } CATCH("Fail in getDirection!") }