diff options
author | Mat <mail@mathias.is> | 2020-03-05 20:33:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-05 20:33:43 +0100 |
commit | 83a41c93e9dede8c187cf841d5618c27e145d2a3 (patch) | |
tree | 353e7ab9ffba3086775e9f5248b68f8f6d73f484 /src/Entities | |
parent | Don't spawn boats in ground (diff) | |
download | cuberite-83a41c93e9dede8c187cf841d5618c27e145d2a3.tar cuberite-83a41c93e9dede8c187cf841d5618c27e145d2a3.tar.gz cuberite-83a41c93e9dede8c187cf841d5618c27e145d2a3.tar.bz2 cuberite-83a41c93e9dede8c187cf841d5618c27e145d2a3.tar.lz cuberite-83a41c93e9dede8c187cf841d5618c27e145d2a3.tar.xz cuberite-83a41c93e9dede8c187cf841d5618c27e145d2a3.tar.zst cuberite-83a41c93e9dede8c187cf841d5618c27e145d2a3.zip |
Diffstat (limited to 'src/Entities')
-rw-r--r-- | src/Entities/Entity.cpp | 15 | ||||
-rw-r--r-- | src/Entities/Player.cpp | 3 |
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); |