替换偏移获取

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 {
return (dAccess<bool, 472>(this)); // IDA DirectActorProxyImpl<IMobMovementProxy>::isOnGround
// return (dAccess<bool, 416>(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<SimpleContainer>(this, 176);
// return dAccess<SimpleContainer>(this, 176);
return *this->mHand;
}
ItemStack* Actor::getHandSlot() {
@ -131,7 +133,7 @@ ItemStack* Actor::getHandSlot() {
SimpleContainer & Actor::getArmorContainer(){
// ItemStackNetManagerServer::_handleLegacyTransactionRequest Line46
return dAccess<SimpleContainer>(this, 1400);
return *this->mArmor;
}
bool Actor::rename(const string& name) {

View File

@ -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);

View File

@ -569,8 +569,8 @@ Local<Value> EntityClass::getDirection() {
if (!entity)
return Local<Value>();
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!")
}