summaryrefslogtreecommitdiffstats
path: root/src/Entities/Entity.cpp
diff options
context:
space:
mode:
authorworktycho <work.tycho@gmail.com>2015-06-26 15:12:29 +0200
committerworktycho <work.tycho@gmail.com>2015-06-26 15:12:29 +0200
commit0a7c54261f0da1aa23c942ee6a2cf6fefb4b8ea5 (patch)
tree893ea949a6e73a914945a62a5fed9ff0266c16b9 /src/Entities/Entity.cpp
parentMerge pull request #2282 from Haxi52/button-fixes (diff)
parentWork on NetherPortalScanner. Setup portal scanner to reset PortalCooldown. Changed where player is spawned. Added a_InitSpawn flag to CreateAndInitializeWorld. (diff)
downloadcuberite-0a7c54261f0da1aa23c942ee6a2cf6fefb4b8ea5.tar
cuberite-0a7c54261f0da1aa23c942ee6a2cf6fefb4b8ea5.tar.gz
cuberite-0a7c54261f0da1aa23c942ee6a2cf6fefb4b8ea5.tar.bz2
cuberite-0a7c54261f0da1aa23c942ee6a2cf6fefb4b8ea5.tar.lz
cuberite-0a7c54261f0da1aa23c942ee6a2cf6fefb4b8ea5.tar.xz
cuberite-0a7c54261f0da1aa23c942ee6a2cf6fefb4b8ea5.tar.zst
cuberite-0a7c54261f0da1aa23c942ee6a2cf6fefb4b8ea5.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/Entity.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 500204a98..bb9d3c44b 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -1269,11 +1269,12 @@ void cEntity::DetectCacti(void)
-void cEntity::ScheduleMoveToWorld(cWorld * a_World, Vector3d a_NewPosition)
+void cEntity::ScheduleMoveToWorld(cWorld * a_World, Vector3d a_NewPosition, bool a_SetPortalCooldown)
{
m_NewWorld = a_World;
m_NewWorldPosition = a_NewPosition;
m_IsWorldChangeScheduled = true;
+ m_WorldChangeSetPortalCooldown = a_SetPortalCooldown;
}
@@ -1285,6 +1286,14 @@ bool cEntity::DetectPortal()
if (m_IsWorldChangeScheduled)
{
m_IsWorldChangeScheduled = false;
+
+ if (m_WorldChangeSetPortalCooldown)
+ {
+ // Delay the portal check.
+ m_PortalCooldownData.m_TicksDelayed = 0;
+ m_PortalCooldownData.m_ShouldPreventTeleportation = true;
+ }
+
MoveToWorld(m_NewWorld, false, m_NewWorldPosition);
return true;
}
@@ -1343,10 +1352,10 @@ bool cEntity::DetectPortal()
TargetPos.x *= 8.0;
TargetPos.z *= 8.0;
- cWorld * TargetWorld = cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetLinkedOverworldName(), dimNether, GetWorld()->GetName());
+ cWorld * TargetWorld = cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetLinkedOverworldName(), dimNether, GetWorld()->GetName(), false);
LOGD("Jumping nether -> overworld");
new cNetherPortalScanner(this, TargetWorld, TargetPos, 256);
- return false;
+ return true;
}
else
{
@@ -1367,10 +1376,10 @@ bool cEntity::DetectPortal()
TargetPos.x /= 8.0;
TargetPos.z /= 8.0;
- cWorld * TargetWorld = cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetLinkedNetherWorldName(), dimNether, GetWorld()->GetName());
+ cWorld * TargetWorld = cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetLinkedNetherWorldName(), dimNether, GetWorld()->GetName(), false);
LOGD("Jumping overworld -> nether");
new cNetherPortalScanner(this, TargetWorld, TargetPos, 128);
- return false;
+ return true;
}
}
case E_BLOCK_END_PORTAL: