Fix damage direction tilt

This commit is contained in:
Siobhan 🏳️‍⚧️ 2026-03-05 10:19:54 -05:00 committed by GitHub
parent 6510f040ae
commit 7d23a82b2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1222,6 +1222,23 @@ void LivingEntity::handleEntityEvent(byte id)
}
}
void LivingEntity::lerpMotion(double xd, double yd, double zd)
{
this->xd = xd;
this->yd = yd;
this->zd = zd;
// Set the value
float result = static_cast<float>(
std::atan2(this->zd - zd, this->xd - xd) * (180.0 / PI)
- this->getYHeadRot()
);
if (std::isfinite(result))
{
this->hurtDir = result;
}
}
void LivingEntity::outOfWorld()
{
hurt(DamageSource::outOfWorld, 4);
@ -2002,4 +2019,4 @@ bool LivingEntity::isAlliedTo(Team *other)
return getTeam()->isAlliedTo(other);
}
return false;
}
}