Attached entities can't enter portals (#4484)
* Attached entities can't enter portals * Whitespace fixes
This commit is contained in:
parent
d572ad7faf
commit
83a41c93e9
@ -1349,6 +1349,12 @@ bool cEntity::DetectPortal()
|
|||||||
return false;
|
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))
|
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
|
// Delay teleportation for four seconds if the entity is a non-creative player
|
||||||
@ -1425,6 +1431,12 @@ bool cEntity::DetectPortal()
|
|||||||
return false;
|
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
|
// End portal in the end
|
||||||
if (GetWorld()->GetDimension() == dimEnd)
|
if (GetWorld()->GetDimension() == dimEnd)
|
||||||
{
|
{
|
||||||
@ -1523,6 +1535,9 @@ void cEntity::DoMoveToWorld(const sWorldChangeInfo & a_WorldChangeInfo)
|
|||||||
GetChunkX(), GetChunkZ()
|
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.
|
// Stop ticking, in preperation for detaching from this world.
|
||||||
SetIsTicking(false);
|
SetIsTicking(false);
|
||||||
|
|
||||||
|
@ -2029,6 +2029,9 @@ void cPlayer::DoMoveToWorld(const cEntity::sWorldChangeInfo & a_WorldChangeInfo)
|
|||||||
// Stop all mobs from targeting this player
|
// Stop all mobs from targeting this player
|
||||||
StopEveryoneFromTargetingMe();
|
StopEveryoneFromTargetingMe();
|
||||||
|
|
||||||
|
// If player is attached to entity, detach, to prevent client side effects
|
||||||
|
Detach();
|
||||||
|
|
||||||
// Prevent further ticking in this world
|
// Prevent further ticking in this world
|
||||||
SetIsTicking(false);
|
SetIsTicking(false);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user