1
0

Entity.cpp: On portal check, use if-else for current dimension

If current dimension corresponds with the portal (nether portal in the nether) send to the overworld, else send to the portal dimension. No need to switch on the dimension and exclude potential others.
This commit is contained in:
archshift 2014-08-02 21:44:02 -07:00
parent a44fbf2338
commit 7915c4ca7c

View File

@ -1068,9 +1068,7 @@ bool cEntity::DetectPortal()
}
m_PortalCooldownData.m_TicksDelayed = 0;
switch (GetWorld()->GetDimension())
{
case dimNether:
if (GetWorld()->GetDimension() == dimNether)
{
if (GetWorld()->GetLinkedOverworldName().empty())
{
@ -1086,7 +1084,7 @@ bool cEntity::DetectPortal()
return MoveToWorld(cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetLinkedOverworldName()), false);
}
case dimOverworld:
else
{
if (GetWorld()->GetNetherWorldName().empty())
{
@ -1103,8 +1101,6 @@ bool cEntity::DetectPortal()
return MoveToWorld(cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetNetherWorldName(), dimNether, GetWorld()->GetName()), false);
}
default: return false;
}
}
case E_BLOCK_END_PORTAL:
{
@ -1113,10 +1109,9 @@ bool cEntity::DetectPortal()
return false;
}
switch (GetWorld()->GetDimension())
{
case dimEnd:
if (GetWorld()->GetDimension() == dimEnd)
{
if (GetWorld()->GetLinkedOverworldName().empty())
{
return false;
@ -1133,7 +1128,7 @@ bool cEntity::DetectPortal()
return MoveToWorld(cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetLinkedOverworldName()), false);
}
case dimOverworld:
else
{
if (GetWorld()->GetEndWorldName().empty())
{
@ -1150,8 +1145,7 @@ bool cEntity::DetectPortal()
return MoveToWorld(cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetEndWorldName(), dimEnd, GetWorld()->GetName()), false);
}
default: return false;
}
}
default: break;
}