summaryrefslogtreecommitdiffstats
path: root/src/Entities/Floater.cpp
diff options
context:
space:
mode:
authorTycho Bickerstaff <work.tycho@gmail.com>2013-12-21 14:32:40 +0100
committerTycho Bickerstaff <work.tycho@gmail.com>2013-12-21 14:32:40 +0100
commit779aca60511055832e776ab4a6299a2b7e049a16 (patch)
treedfb031e9bd01b25ab0199286cf6e660f26489817 /src/Entities/Floater.cpp
parentMerge branch 'master' into cmake (diff)
parentMerge branch 'master', remote-tracking branch 'upstream/master' (diff)
downloadcuberite-779aca60511055832e776ab4a6299a2b7e049a16.tar
cuberite-779aca60511055832e776ab4a6299a2b7e049a16.tar.gz
cuberite-779aca60511055832e776ab4a6299a2b7e049a16.tar.bz2
cuberite-779aca60511055832e776ab4a6299a2b7e049a16.tar.lz
cuberite-779aca60511055832e776ab4a6299a2b7e049a16.tar.xz
cuberite-779aca60511055832e776ab4a6299a2b7e049a16.tar.zst
cuberite-779aca60511055832e776ab4a6299a2b7e049a16.zip
Diffstat (limited to 'src/Entities/Floater.cpp')
-rw-r--r--src/Entities/Floater.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/Entities/Floater.cpp b/src/Entities/Floater.cpp
index 1aa0413d9..ac7a82f91 100644
--- a/src/Entities/Floater.cpp
+++ b/src/Entities/Floater.cpp
@@ -1,14 +1,19 @@
+
#include "Globals.h"
#include "Floater.h"
#include "Player.h"
#include "../ClientHandle.h"
+
+
+
+
cFloater::cFloater(double a_X, double a_Y, double a_Z, Vector3d a_Speed, int a_PlayerID) :
cEntity(etFloater, a_X, a_Y, a_Z, 0.98, 0.98),
+ m_PickupCountDown(0),
m_PlayerID(a_PlayerID),
- m_CanPickupItem(false),
- m_PickupCountDown(0)
+ m_CanPickupItem(false)
{
SetSpeed(a_Speed);
}
@@ -29,9 +34,9 @@ void cFloater::SpawnOn(cClientHandle & a_Client)
void cFloater::Tick(float a_Dt, cChunk & a_Chunk)
{
HandlePhysics(a_Dt, a_Chunk);
- if (IsBlockWater(m_World->GetBlock((int) GetPosX(), (int) GetPosY(), (int) GetPosZ())))
+ if (IsBlockWater(m_World->GetBlock((int) GetPosX(), (int) GetPosY(), (int) GetPosZ())) && m_World->GetBlockMeta((int) GetPosX(), (int) GetPosY(), (int) GetPosZ()) == 0)
{
- if (m_World->GetTickRandomNumber(100) == 0)
+ if ((!m_CanPickupItem) && (m_World->GetTickRandomNumber(100) == 0))
{
SetPosY(GetPosY() - 1);
m_CanPickupItem = true;
@@ -40,7 +45,7 @@ void cFloater::Tick(float a_Dt, cChunk & a_Chunk)
}
else
{
- SetSpeedY(1);
+ SetSpeedY(0.7);
}
}
SetSpeedX(GetSpeedX() * 0.95);
@@ -55,4 +60,8 @@ void cFloater::Tick(float a_Dt, cChunk & a_Chunk)
}
}
BroadcastMovementUpdate();
-} \ No newline at end of file
+}
+
+
+
+