summaryrefslogtreecommitdiffstats
path: root/src/Entities/Entity.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2022-11-08 23:14:45 +0100
committerGitHub <noreply@github.com>2022-11-08 23:14:45 +0100
commit7a73fd467cfadfe3b3a5cf43d3eea9392f4c7f34 (patch)
tree49fd84a2dee2a1feeeb88565350fb3a55627dda5 /src/Entities/Entity.cpp
parentChunk: Optimise idle ticking (diff)
downloadcuberite-7a73fd467cfadfe3b3a5cf43d3eea9392f4c7f34.tar
cuberite-7a73fd467cfadfe3b3a5cf43d3eea9392f4c7f34.tar.gz
cuberite-7a73fd467cfadfe3b3a5cf43d3eea9392f4c7f34.tar.bz2
cuberite-7a73fd467cfadfe3b3a5cf43d3eea9392f4c7f34.tar.lz
cuberite-7a73fd467cfadfe3b3a5cf43d3eea9392f4c7f34.tar.xz
cuberite-7a73fd467cfadfe3b3a5cf43d3eea9392f4c7f34.tar.zst
cuberite-7a73fd467cfadfe3b3a5cf43d3eea9392f4c7f34.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/Entity.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 0718da06c..c46f9e644 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -1970,7 +1970,7 @@ void cEntity::BroadcastMovementUpdate(const cClientHandle * a_Exclude)
return;
}
- if (GetSpeed().SqrLength() > 0.001)
+ if (m_Speed.HasNonZeroLength())
{
// Movin'
m_World->BroadcastEntityVelocity(*this, a_Exclude);
@@ -1986,8 +1986,7 @@ void cEntity::BroadcastMovementUpdate(const cClientHandle * a_Exclude)
m_bHasSentNoSpeed = true;
}
- Vector3i Diff = (GetPosition() * 32.0).Floor() - (m_LastSentPosition * 32.0).Floor();
- if (Diff.HasNonZeroLength()) // Have we moved?
+ if ((m_Position - m_LastSentPosition).HasNonZeroLength()) // Have we moved?
{
m_World->BroadcastEntityPosition(*this, a_Exclude);