summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-10-03 23:23:56 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-10-03 23:23:56 +0200
commit4774323154a2d07c656ee477c7424440ef3914ef (patch)
tree63762c685a7f665541f87d7d65ca0be6358f51e9 /src/Entities/Player.cpp
parentLilypad placement calls block place hook (diff)
downloadcuberite-4774323154a2d07c656ee477c7424440ef3914ef.tar
cuberite-4774323154a2d07c656ee477c7424440ef3914ef.tar.gz
cuberite-4774323154a2d07c656ee477c7424440ef3914ef.tar.bz2
cuberite-4774323154a2d07c656ee477c7424440ef3914ef.tar.lz
cuberite-4774323154a2d07c656ee477c7424440ef3914ef.tar.xz
cuberite-4774323154a2d07c656ee477c7424440ef3914ef.tar.zst
cuberite-4774323154a2d07c656ee477c7424440ef3914ef.zip
Diffstat (limited to 'src/Entities/Player.cpp')
-rw-r--r--src/Entities/Player.cpp39
1 files changed, 33 insertions, 6 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index f58a0a016..3a0d96e7d 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -1271,7 +1271,7 @@ unsigned int cPlayer::AwardAchievement(const eStatistic a_Ach)
void cPlayer::TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ)
{
- SetPosition(a_PosX, a_PosY, a_PosZ);
+ cEntity::SetPosition(a_PosX, a_PosY, a_PosZ);
m_LastGroundHeight = (float)a_PosY;
m_LastJumpHeight = (float)a_PosY;
m_bIsTeleporting = true;
@@ -1325,20 +1325,23 @@ Vector3d cPlayer::GetThrowSpeed(double a_SpeedCoeff) const
-void cPlayer::ForceSetSpeed(const Vector3d & a_Speed)
+void cPlayer::SetSpeed(const Vector3d & a_Speed)
{
- SetSpeed(a_Speed);
+ super::SetSpeed(a_Speed);
+
+ // Send the speed to the client
+ m_ClientHandle->SendEntityVelocity(*this);
}
-void cPlayer::DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ)
+void cPlayer::AddSpeed(const Vector3d & a_Speed)
{
- super::DoSetSpeed(a_SpeedX, a_SpeedY, a_SpeedZ);
+ super::AddSpeed(a_Speed);
- // Send the speed to the client so he actualy moves
+ // Send the speed to the client
m_ClientHandle->SendEntityVelocity(*this);
}
@@ -1346,6 +1349,30 @@ void cPlayer::DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ)
+void cPlayer::SetPosition(const Vector3d & a_Position)
+{
+ super::SetPosition(a_Position);
+
+ // Teleport the client
+ TeleportToCoords(a_Position.x, a_Position.y, a_Position.z);
+}
+
+
+
+
+
+void cPlayer::AddPosition(const Vector3d & a_Position)
+{
+ super::AddPosition(a_Position);
+
+ // Teleport the client
+ TeleportToCoords(GetPosX(), GetPosY(), GetPosZ());
+}
+
+
+
+
+
void cPlayer::MoveTo( const Vector3d & a_NewPos)
{
if ((a_NewPos.y < -990) && (GetPosY() > -100))