diff options
Diffstat (limited to 'src/NetherPortalScanner.cpp')
-rw-r--r-- | src/NetherPortalScanner.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/NetherPortalScanner.cpp b/src/NetherPortalScanner.cpp index fe563509d..cebf09ceb 100644 --- a/src/NetherPortalScanner.cpp +++ b/src/NetherPortalScanner.cpp @@ -49,6 +49,12 @@ void cNetherPortalScanner::OnChunkAvailable(int a_ChunkX, int a_ChunkZ) if (blocks[i] == E_BLOCK_NETHER_PORTAL) { Vector3i Coordinate = cChunkDef::IndexToCoordinate(i); + if (Coordinate.y >= m_MaxY) + { + // This is above the map, don't consider it. + continue; + } + Vector3d PortalLoc = Vector3d(Coordinate.x + a_ChunkX * cChunkDef::Width, Coordinate.y, Coordinate.z + a_ChunkZ * cChunkDef::Width); if (!m_FoundPortal) { @@ -109,9 +115,9 @@ bool cNetherPortalScanner::OnAllChunksAvailable(void) // Find the bottom of this portal while (m_World->GetBlock(m_PortalLoc.x, m_PortalLoc.y, m_PortalLoc.z) == E_BLOCK_NETHER_PORTAL) { - m_PortalLoc.y -= 1.0; + m_PortalLoc.y -= 1; } - m_PortalLoc.y += 1.0; + m_PortalLoc.y += 1; // Figure out which way the portal is facing int BXP = m_World->GetBlock(m_PortalLoc.x + 1, m_PortalLoc.y, m_PortalLoc.z); @@ -284,7 +290,7 @@ void cNetherPortalScanner::OnDisabled(void) } LOGD("Placing player at {%f, %f, %f}", Position.x, Position.y, Position.z); - m_Entity->ScheduleMoveToWorld(m_World, Position); + m_Entity->ScheduleMoveToWorld(m_World, Position, true); delete this; } |