summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorJan-Fabian Humann <j.f.humann@gmail.com>2014-03-08 17:55:53 +0100
committerJan-Fabian Humann <j.f.humann@gmail.com>2014-03-08 17:55:53 +0100
commit66970fe943ccc414c2f4fb722852f0461b8ddca2 (patch)
treeed732e738fe70cc71898c42993a7adccb39f08c1 /src/ClientHandle.cpp
parentMerge pull request #764 from xdot/master (diff)
downloadcuberite-66970fe943ccc414c2f4fb722852f0461b8ddca2.tar
cuberite-66970fe943ccc414c2f4fb722852f0461b8ddca2.tar.gz
cuberite-66970fe943ccc414c2f4fb722852f0461b8ddca2.tar.bz2
cuberite-66970fe943ccc414c2f4fb722852f0461b8ddca2.tar.lz
cuberite-66970fe943ccc414c2f4fb722852f0461b8ddca2.tar.xz
cuberite-66970fe943ccc414c2f4fb722852f0461b8ddca2.tar.zst
cuberite-66970fe943ccc414c2f4fb722852f0461b8ddca2.zip
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r--src/ClientHandle.cpp58
1 files changed, 30 insertions, 28 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 870568cdf..79fdc5e04 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -1453,7 +1453,7 @@ bool cClientHandle::HandleHandshake(const AString & a_Username)
-void cClientHandle::HandleEntityAction(int a_EntityID, char a_ActionID)
+void cClientHandle::HandleEntityCrouch(int a_EntityID, bool a_IsCrouching)
{
if (a_EntityID != m_Player->GetUniqueID())
{
@@ -1461,35 +1461,37 @@ void cClientHandle::HandleEntityAction(int a_EntityID, char a_ActionID)
return;
}
- switch (a_ActionID)
+ m_Player->SetCrouch(a_IsCrouching);
+}
+
+
+
+
+
+void cClientHandle::HandleEntityLeaveBed(int a_EntityID)
+{
+ if (a_EntityID != m_Player->GetUniqueID())
{
- case 1: // Crouch
- {
- m_Player->SetCrouch(true);
- break;
- }
- case 2: // Uncrouch
- {
- m_Player->SetCrouch(false);
- break;
- }
- case 3: // Leave bed
- {
- m_Player->GetWorld()->BroadcastEntityAnimation(*m_Player, 2);
- break;
- }
- case 4: // Start sprinting
- {
- m_Player->SetSprint(true);
- break;
- }
- case 5: // Stop sprinting
- {
- m_Player->SetSprint(false);
- SendPlayerMaxSpeed();
- break;
- }
+ // We should only receive entity actions from the entity that is performing the action
+ return;
}
+
+ m_Player->GetWorld()->BroadcastEntityAnimation(*m_Player, 2);
+}
+
+
+
+
+
+void cClientHandle::HandleEntitySprinting(int a_EntityID, bool a_IsSprinting)
+{
+ if (a_EntityID != m_Player->GetUniqueID())
+ {
+ // We should only receive entity actions from the entity that is performing the action
+ return;
+ }
+
+ m_Player->SetSprint(a_IsSprinting);
}