diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2021-02-06 19:37:03 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2021-02-07 23:36:15 +0100 |
commit | be2bf999c280d6892b38272d3f783b3462f0b745 (patch) | |
tree | 6567e7f011e50dd8e6f65f7dd933a1d7dc34ea93 /src/Entities/Entity.cpp | |
parent | Adds playerlist header and footer broadcasting (1.8-1.13) (diff) | |
download | cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.tar cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.tar.gz cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.tar.bz2 cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.tar.lz cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.tar.xz cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.tar.zst cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Entity.cpp | 47 |
1 files changed, 3 insertions, 44 deletions
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<float>(OverlapSize / EntitySize); - } - else - { - return 0; - } -} |