diff --git a/Minecraft.World/LivingEntity.cpp b/Minecraft.World/LivingEntity.cpp index 5f8a3dd1c..d95704565 100644 --- a/Minecraft.World/LivingEntity.cpp +++ b/Minecraft.World/LivingEntity.cpp @@ -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( + 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; -} \ No newline at end of file +}