summaryrefslogtreecommitdiffstats
path: root/source/Entities
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-08-25 17:06:51 +0200
committermadmaxoft <github@xoft.cz>2013-08-25 17:06:51 +0200
commit83811b69292bff0ef4b24087a4a4d3e523b0076a (patch)
tree50bf797896f5df82af4cfcd642759d005c598044 /source/Entities
parentProjectile entities get saved into MCA files (diff)
parentReduced LeakFinder's stack buffers to half. (diff)
downloadcuberite-83811b69292bff0ef4b24087a4a4d3e523b0076a.tar
cuberite-83811b69292bff0ef4b24087a4a4d3e523b0076a.tar.gz
cuberite-83811b69292bff0ef4b24087a4a4d3e523b0076a.tar.bz2
cuberite-83811b69292bff0ef4b24087a4a4d3e523b0076a.tar.lz
cuberite-83811b69292bff0ef4b24087a4a4d3e523b0076a.tar.xz
cuberite-83811b69292bff0ef4b24087a4a4d3e523b0076a.tar.zst
cuberite-83811b69292bff0ef4b24087a4a4d3e523b0076a.zip
Diffstat (limited to 'source/Entities')
-rw-r--r--source/Entities/Pickup.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/Entities/Pickup.cpp b/source/Entities/Pickup.cpp
index 0417b861d..c8f36d503 100644
--- a/source/Entities/Pickup.cpp
+++ b/source/Entities/Pickup.cpp
@@ -73,18 +73,19 @@ void cPickup::Tick(float a_Dt, cChunk & a_Chunk)
if (!m_bCollected)
{
int BlockY = (int) floor(GetPosY());
- if (BlockY < cChunkDef::Height) // Don't do anything except for falling when above the world
+ if ((BlockY >= 0) && (BlockY < cChunkDef::Height)) // Don't do anything except for falling when outside the world
{
int BlockX = (int) floor(GetPosX());
int BlockZ = (int) floor(GetPosZ());
- //Position might have changed due to physics. So we have to make sure we have the correct chunk.
+ // Position might have changed due to physics. So we have to make sure we have the correct chunk.
cChunk * CurrentChunk = a_Chunk.GetNeighborChunk(BlockX, BlockZ);
if (CurrentChunk != NULL) // Make sure the chunk is loaded
{
int RelBlockX = BlockX - (CurrentChunk->GetPosX() * cChunkDef::Width);
int RelBlockZ = BlockZ - (CurrentChunk->GetPosZ() * cChunkDef::Width);
- BLOCKTYPE BlockBelow = CurrentChunk->GetBlock(RelBlockX, BlockY - 1, RelBlockZ);
+ // If the pickup is on the bottommost block position, make it think the void is made of air: (#131)
+ BLOCKTYPE BlockBelow = (BlockY > 0) ? CurrentChunk->GetBlock(RelBlockX, BlockY - 1, RelBlockZ) : E_BLOCK_AIR;
BLOCKTYPE BlockIn = CurrentChunk->GetBlock(RelBlockX, BlockY, RelBlockZ);
if (