summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2018-07-23 18:26:48 +0200
committerGitHub <noreply@github.com>2018-07-23 18:26:48 +0200
commite27290f7d2d1a9fb0c8e77b73bb6634a43c45d4c (patch)
tree7fd9b748a721523968714d87f290d9123accacf4 /src/Entities
parentRewrite explosion knock back (#4251) (diff)
downloadcuberite-e27290f7d2d1a9fb0c8e77b73bb6634a43c45d4c.tar
cuberite-e27290f7d2d1a9fb0c8e77b73bb6634a43c45d4c.tar.gz
cuberite-e27290f7d2d1a9fb0c8e77b73bb6634a43c45d4c.tar.bz2
cuberite-e27290f7d2d1a9fb0c8e77b73bb6634a43c45d4c.tar.lz
cuberite-e27290f7d2d1a9fb0c8e77b73bb6634a43c45d4c.tar.xz
cuberite-e27290f7d2d1a9fb0c8e77b73bb6634a43c45d4c.tar.zst
cuberite-e27290f7d2d1a9fb0c8e77b73bb6634a43c45d4c.zip
Diffstat (limited to 'src/Entities')
-rw-r--r--src/Entities/Entity.h2
-rw-r--r--src/Entities/Pawn.cpp10
-rw-r--r--src/Entities/Pawn.h2
-rw-r--r--src/Entities/Player.cpp1
4 files changed, 13 insertions, 2 deletions
diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h
index ae150b4e2..91ad524c7 100644
--- a/src/Entities/Entity.h
+++ b/src/Entities/Entity.h
@@ -681,7 +681,7 @@ protected:
/** Set the entities position and last sent position.
Only to be used when the caller will broadcast a teleport or equivalent to clients. */
- void ResetPosition(Vector3d a_NewPos);
+ virtual void ResetPosition(Vector3d a_NewPos);
private:
diff --git a/src/Entities/Pawn.cpp b/src/Entities/Pawn.cpp
index 27c04d4b8..fb650e586 100644
--- a/src/Entities/Pawn.cpp
+++ b/src/Entities/Pawn.cpp
@@ -486,3 +486,13 @@ cEntityEffect * cPawn::GetEntityEffect(cEntityEffect::eType a_EffectType)
auto itr = m_EntityEffects.find(a_EffectType);
return (itr != m_EntityEffects.end()) ? itr->second.get() : nullptr;
}
+
+
+
+
+
+void cPawn::ResetPosition(Vector3d a_NewPosition)
+{
+ super::ResetPosition(a_NewPosition);
+ m_LastGroundHeight = GetPosY();
+}
diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h
index 480b523ea..4de0e14b2 100644
--- a/src/Entities/Pawn.h
+++ b/src/Entities/Pawn.h
@@ -77,6 +77,8 @@ protected:
double m_LastGroundHeight;
bool m_bTouchGround;
+ virtual void ResetPosition(Vector3d a_NewPosition) override;
+
private:
/** A list of all monsters that are targeting this pawn. */
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 181a54870..0f18ebe66 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -1650,7 +1650,6 @@ void cPlayer::TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ)
{
ResetPosition({a_PosX, a_PosY, a_PosZ});
FreezeInternal(GetPosition(), false);
- m_LastGroundHeight = a_PosY;
m_bIsTeleporting = true;
m_World->BroadcastTeleportEntity(*this, GetClientHandle());