summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-04-28 17:30:06 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-04-28 17:30:06 +0200
commit912f93a54448e2a080e5e18e5e67945479301760 (patch)
tree0c6cf8bd0556f251fac5e85439ec7e92ddf7d10d
parentAdded support for sending velocity and rotation in PACKET_SPAWN_MOB and PACKET_SPAWN_OBJECT (diff)
downloadcuberite-912f93a54448e2a080e5e18e5e67945479301760.tar
cuberite-912f93a54448e2a080e5e18e5e67945479301760.tar.gz
cuberite-912f93a54448e2a080e5e18e5e67945479301760.tar.bz2
cuberite-912f93a54448e2a080e5e18e5e67945479301760.tar.lz
cuberite-912f93a54448e2a080e5e18e5e67945479301760.tar.xz
cuberite-912f93a54448e2a080e5e18e5e67945479301760.tar.zst
cuberite-912f93a54448e2a080e5e18e5e67945479301760.zip
-rw-r--r--source/Pickup.cpp35
1 files changed, 20 insertions, 15 deletions
diff --git a/source/Pickup.cpp b/source/Pickup.cpp
index 438216266..7c1295121 100644
--- a/source/Pickup.cpp
+++ b/source/Pickup.cpp
@@ -68,30 +68,35 @@ void cPickup::Tick(float a_Dt, cChunk & a_Chunk)
if (!m_bCollected)
{
- int BlockX = (int) floor(GetPosX());
int BlockY = (int) floor(GetPosY());
- int BlockZ = (int) floor(GetPosZ());
- //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) //Making sure the chunk is loaded
+ if (BlockY < cChunkDef::Height) // Don't do anything except for falling when above the world
{
- int RelBlockX = BlockX - (CurrentChunk->GetPosX() * cChunkDef::Width);
- int RelBlockZ = BlockZ - (CurrentChunk->GetPosZ() * cChunkDef::Width);
-
- BLOCKTYPE BlockBelow = CurrentChunk->GetBlock( RelBlockX, BlockY - 1, RelBlockZ );
- BLOCKTYPE BlockIn = CurrentChunk->GetBlock( RelBlockX, BlockY, RelBlockZ );
-
- if( IsBlockLava(BlockBelow) || BlockBelow == E_BLOCK_FIRE
- || IsBlockLava(BlockIn) || BlockIn == E_BLOCK_FIRE )
+ 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.
+ 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);
+ BLOCKTYPE BlockIn = CurrentChunk->GetBlock(RelBlockX, BlockY, RelBlockZ);
+
+ if (
+ IsBlockLava(BlockBelow) || (BlockBelow == E_BLOCK_FIRE) ||
+ IsBlockLava(BlockIn) || (BlockIn == E_BLOCK_FIRE)
+ )
+ {
m_bCollected = true;
- m_Timer = 0; //We have to reset the timer.
- m_Timer += a_Dt; //In case we have to destroy the pickup in the same tick.
+ m_Timer = 0; // We have to reset the timer.
+ m_Timer += a_Dt; // In case we have to destroy the pickup in the same tick.
if (m_Timer > 500.f)
{
Destroy();
return;
}
+ }
}
}
}