summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
Diffstat (limited to 'src/Entities')
-rw-r--r--src/Entities/Entity.cpp15
-rw-r--r--src/Entities/Player.cpp3
2 files changed, 18 insertions, 0 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 44808e2a5..983cc96be 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -1349,6 +1349,12 @@ bool cEntity::DetectPortal()
return false;
}
+ if ((m_AttachedTo != nullptr) || (m_Attachee != nullptr))
+ {
+ // Don't let attached entities change worlds, like players riding a minecart
+ return false;
+ }
+
if (IsPlayer() && !(static_cast<cPlayer *>(this))->IsGameModeCreative() && (m_PortalCooldownData.m_TicksDelayed != 80))
{
// Delay teleportation for four seconds if the entity is a non-creative player
@@ -1425,6 +1431,12 @@ bool cEntity::DetectPortal()
return false;
}
+ if ((m_AttachedTo != nullptr) || (m_Attachee != nullptr))
+ {
+ // Don't let attached entities change worlds, like players riding a minecart
+ return false;
+ }
+
// End portal in the end
if (GetWorld()->GetDimension() == dimEnd)
{
@@ -1523,6 +1535,9 @@ void cEntity::DoMoveToWorld(const sWorldChangeInfo & a_WorldChangeInfo)
GetChunkX(), GetChunkZ()
);
+ // If entity is attached to another entity, detach, to prevent client side effects
+ Detach();
+
// Stop ticking, in preperation for detaching from this world.
SetIsTicking(false);
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 421eddbd5..07342bd52 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -2029,6 +2029,9 @@ void cPlayer::DoMoveToWorld(const cEntity::sWorldChangeInfo & a_WorldChangeInfo)
// Stop all mobs from targeting this player
StopEveryoneFromTargetingMe();
+ // If player is attached to entity, detach, to prevent client side effects
+ Detach();
+
// Prevent further ticking in this world
SetIsTicking(false);