summaryrefslogtreecommitdiffstats
path: root/source/Entities/Entity.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-09-19 21:35:58 +0200
committermadmaxoft <github@xoft.cz>2013-09-19 21:35:58 +0200
commit18d795d8da6f2d46d9aefaa710e8a15c9e402db4 (patch)
treeb74ee54901145e49618390621fe0bc9a618fc3aa /source/Entities/Entity.cpp
parentProtoProxy: Removed the per-packet sleep from the DEBUG version. (diff)
downloadcuberite-18d795d8da6f2d46d9aefaa710e8a15c9e402db4.tar
cuberite-18d795d8da6f2d46d9aefaa710e8a15c9e402db4.tar.gz
cuberite-18d795d8da6f2d46d9aefaa710e8a15c9e402db4.tar.bz2
cuberite-18d795d8da6f2d46d9aefaa710e8a15c9e402db4.tar.lz
cuberite-18d795d8da6f2d46d9aefaa710e8a15c9e402db4.tar.xz
cuberite-18d795d8da6f2d46d9aefaa710e8a15c9e402db4.tar.zst
cuberite-18d795d8da6f2d46d9aefaa710e8a15c9e402db4.zip
Diffstat (limited to 'source/Entities/Entity.cpp')
-rw-r--r--source/Entities/Entity.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/source/Entities/Entity.cpp b/source/Entities/Entity.cpp
index dc3c7796e..d465c75bd 100644
--- a/source/Entities/Entity.cpp
+++ b/source/Entities/Entity.cpp
@@ -549,12 +549,11 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
int RelBlockX = BlockX - (NextChunk->GetPosX() * cChunkDef::Width);
int RelBlockZ = BlockZ - (NextChunk->GetPosZ() * cChunkDef::Width);
BLOCKTYPE BlockIn = NextChunk->GetBlock( RelBlockX, BlockY, RelBlockZ );
- BLOCKTYPE BlockBelow = NextChunk->GetBlock( RelBlockX, BlockY - 1, RelBlockZ );
+ BLOCKTYPE BlockBelow = (BlockY > 0) ? NextChunk->GetBlock(RelBlockX, BlockY - 1, RelBlockZ) : E_BLOCK_AIR;
if (!g_BlockIsSolid[BlockIn]) // Making sure we are not inside a solid block
{
if (m_bOnGround) // check if it's still on the ground
{
- BLOCKTYPE BlockBelow = NextChunk->GetBlock( RelBlockX, BlockY - 1, RelBlockZ );
if (!g_BlockIsSolid[BlockBelow]) // Check if block below is air or water.
{
m_bOnGround = false;
@@ -613,7 +612,7 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
{
fallspeed = m_Gravity * a_Dt / 3; // Fall 3x slower in water.
}
- else if ((IsBlockRail(BlockBelow)) && (IsMinecart())) // Rails aren't solid, except for Minecarts
+ else if (IsBlockRail(BlockBelow) && IsMinecart()) // Rails aren't solid, except for Minecarts
{
fallspeed = 0;
m_bOnGround = true;