diff options
author | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-05-03 09:48:39 +0200 |
---|---|---|
committer | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-05-03 09:48:39 +0200 |
commit | b3d4e0fca665502b727f0088a3a20aac1b9ad073 (patch) | |
tree | 89e7bd48177595a5fd69ff411268777444eb351d /src/Entities/Player.cpp | |
parent | Fix crash on world travel (#3180) (diff) | |
download | cuberite-b3d4e0fca665502b727f0088a3a20aac1b9ad073.tar cuberite-b3d4e0fca665502b727f0088a3a20aac1b9ad073.tar.gz cuberite-b3d4e0fca665502b727f0088a3a20aac1b9ad073.tar.bz2 cuberite-b3d4e0fca665502b727f0088a3a20aac1b9ad073.tar.lz cuberite-b3d4e0fca665502b727f0088a3a20aac1b9ad073.tar.xz cuberite-b3d4e0fca665502b727f0088a3a20aac1b9ad073.tar.zst cuberite-b3d4e0fca665502b727f0088a3a20aac1b9ad073.zip |
Diffstat (limited to 'src/Entities/Player.cpp')
-rw-r--r-- | src/Entities/Player.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index d131699d3..a5868b528 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -2468,17 +2468,21 @@ void cPlayer::Detach() int PosZ = POSZ_TOINT; // Search for a position within an area to teleport player after detachment - // Position must be solid land, and occupied by a nonsolid block + // Position must be solid land with two air blocks above. // If nothing found, player remains where they are - for (int x = PosX - 2; x <= (PosX + 2); ++x) + for (int x = PosX - 1; x <= (PosX + 1); ++x) { for (int y = PosY; y <= (PosY + 3); ++y) { - for (int z = PosZ - 2; z <= (PosZ + 2); ++z) + for (int z = PosZ - 1; z <= (PosZ + 1); ++z) { - if (!cBlockInfo::IsSolid(m_World->GetBlock(x, y, z)) && cBlockInfo::IsSolid(m_World->GetBlock(x, y - 1, z))) + if ( + (m_World->GetBlock(x, y, z) == E_BLOCK_AIR) && + (m_World->GetBlock(x, y + 1, z) == E_BLOCK_AIR) && + cBlockInfo::IsSolid(m_World->GetBlock(x, y - 1, z)) + ) { - TeleportToCoords(x, y, z); + TeleportToCoords(x + 0.5, y, z + 0.5); return; } } |