替换偏移获取

This commit is contained in:
Qiuzhizhe 2023-02-04 01:04:44 +08:00
parent adbb5bd375
commit 7a597c698e
No known key found for this signature in database
GPG Key ID: 4EF4BF5521540263
3 changed files with 12 additions and 10 deletions

View File

@ -56,7 +56,8 @@ bool Actor::isPlayer(bool allowSimulatedPlayer) const {
} }
bool Actor::isOnGround() const { bool Actor::isOnGround() const {
return (dAccess<bool, 472>(this)); // IDA DirectActorProxyImpl<IMobMovementProxy>::isOnGround // return (dAccess<bool, 416>(this)); //猜的
return this->mOnGround;
} }
std::string Actor::getTypeName() const { std::string Actor::getTypeName() const {
@ -76,9 +77,9 @@ bool Actor::isOnGround() const {
return res; return res;
} }
[[deprecated]]
Vec2* Actor::getDirection() const { Vec2* Actor::getDirection() const {
return (Vec2*)(this + 312); // IDA: Actor::getRotation() return (Vec2*)(this + 256); // 猜的 mRos
} }
BlockPos Actor::getBlockPos() { BlockPos Actor::getBlockPos() {
@ -120,7 +121,8 @@ ActorUniqueID Actor::getActorUniqueId() const {
SimpleContainer & Actor::getHandContainer(){ SimpleContainer & Actor::getHandContainer(){
//ScriptHandContainerComponent::hasComponent actor //ScriptHandContainerComponent::hasComponent actor
return dAccess<SimpleContainer>(this, 176); // return dAccess<SimpleContainer>(this, 176);
return *this->mHand;
} }
ItemStack* Actor::getHandSlot() { ItemStack* Actor::getHandSlot() {
@ -131,7 +133,7 @@ ItemStack* Actor::getHandSlot() {
SimpleContainer & Actor::getArmorContainer(){ SimpleContainer & Actor::getArmorContainer(){
// ItemStackNetManagerServer::_handleLegacyTransactionRequest Line46 // ItemStackNetManagerServer::_handleLegacyTransactionRequest Line46
return dAccess<SimpleContainer>(this, 1400); return *this->mArmor;
} }
bool Actor::rename(const string& name) { bool Actor::rename(const string& name) {

View File

@ -35,9 +35,9 @@ Block* BlockInstance::getBlock() {
return isNull() ? nullptr : block; return isNull() ? nullptr : block;
}; };
// bool BlockInstance::hasBlockEntity() { bool BlockInstance::hasBlockEntity() {
// return block->hasBlockEntity(); return block->hasBlockEntity();
// } }
BlockActor* BlockInstance::getBlockEntity() { BlockActor* BlockInstance::getBlockEntity() {
return Level::getBlockSource(dim)->getBlockEntity(pos); return Level::getBlockSource(dim)->getBlockEntity(pos);

View File

@ -569,8 +569,8 @@ Local<Value> EntityClass::getDirection() {
if (!entity) if (!entity)
return Local<Value>(); return Local<Value>();
Vec2* vec = entity->getDirection(); Vec2 vec = entity->getRotation();
return DirectionAngle::newAngle(vec->x, vec->y); return DirectionAngle::newAngle(vec.x, vec.y);
} }
CATCH("Fail in getDirection!") CATCH("Fail in getDirection!")
} }