From be2bf999c280d6892b38272d3f783b3462f0b745 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 6 Feb 2021 18:37:03 +0000 Subject: Fix #5118 --- src/Entities/Entity.cpp | 47 +++-------------------------------------------- 1 file changed, 3 insertions(+), 44 deletions(-) (limited to 'src/Entities/Entity.cpp') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index a185b8f69..d6bb057f4 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -1715,17 +1715,6 @@ void cEntity::SetIsTicking(bool a_IsTicking) -void cEntity::DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) -{ - m_Speed.Set(a_SpeedX, a_SpeedY, a_SpeedZ); - - WrapSpeed(); -} - - - - - void cEntity::HandleAir(void) { // Ref.: https://minecraft.gamepedia.com/Chunk_format @@ -2095,7 +2084,8 @@ void cEntity::SetRoll(double a_Roll) void cEntity::SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) { - DoSetSpeed(a_SpeedX, a_SpeedY, a_SpeedZ); + m_Speed.Set(a_SpeedX, a_SpeedY, a_SpeedZ); + WrapSpeed(); } @@ -2140,7 +2130,7 @@ void cEntity::SetWidth(double a_Width) void cEntity::AddSpeed(double a_AddSpeedX, double a_AddSpeedY, double a_AddSpeedZ) { - DoSetSpeed(m_Speed.x + a_AddSpeedX, m_Speed.y + a_AddSpeedY, m_Speed.z + a_AddSpeedZ); + SetSpeed(m_Speed.x + a_AddSpeedX, m_Speed.y + a_AddSpeedY, m_Speed.z + a_AddSpeedZ); } @@ -2280,34 +2270,3 @@ void cEntity::BroadcastLeashedMobs() } } } - - - - - -float cEntity::GetExplosionExposureRate(Vector3d a_ExplosionPosition, float a_ExlosionPower) -{ - double EntitySize = m_Width * m_Width * m_Height; - if (EntitySize <= 0) - { - // Handle entity with invalid size - return 0; - } - - auto EntityBox = GetBoundingBox(); - cBoundingBox ExplosionBox(a_ExplosionPosition, a_ExlosionPower * 2.0); - cBoundingBox IntersectionBox(EntityBox); - - bool Overlap = EntityBox.Intersect(ExplosionBox, IntersectionBox); - if (Overlap) - { - Vector3d Diff = IntersectionBox.GetMax() - IntersectionBox.GetMin(); - double OverlapSize = Diff.x * Diff.y * Diff.z; - - return static_cast(OverlapSize / EntitySize); - } - else - { - return 0; - } -} -- cgit v1.2.3