summaryrefslogtreecommitdiffstats
path: root/src/Entities/FallingBlock.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-03-05 23:12:48 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-03-05 23:12:48 +0100
commit53231bebd650b9398060cee1434ad4c44152d36e (patch)
tree018e79175daa3664668512ad01b6d7f55d639d34 /src/Entities/FallingBlock.cpp
parentFixed MSVC warnings in DeprecatedBindings. (diff)
downloadcuberite-53231bebd650b9398060cee1434ad4c44152d36e.tar
cuberite-53231bebd650b9398060cee1434ad4c44152d36e.tar.gz
cuberite-53231bebd650b9398060cee1434ad4c44152d36e.tar.bz2
cuberite-53231bebd650b9398060cee1434ad4c44152d36e.tar.lz
cuberite-53231bebd650b9398060cee1434ad4c44152d36e.tar.xz
cuberite-53231bebd650b9398060cee1434ad4c44152d36e.tar.zst
cuberite-53231bebd650b9398060cee1434ad4c44152d36e.zip
Diffstat (limited to 'src/Entities/FallingBlock.cpp')
-rw-r--r--src/Entities/FallingBlock.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/Entities/FallingBlock.cpp b/src/Entities/FallingBlock.cpp
index 9fcd9ac80..a66c7e4ae 100644
--- a/src/Entities/FallingBlock.cpp
+++ b/src/Entities/FallingBlock.cpp
@@ -33,20 +33,16 @@ void cFallingBlock::SpawnOn(cClientHandle & a_ClientHandle)
void cFallingBlock::Tick(float a_Dt, cChunk & a_Chunk)
{
- float MilliDt = a_Dt * 0.001f;
- AddSpeedY(MilliDt * -9.8f);
- AddPosY(GetSpeedY() * MilliDt);
-
// GetWorld()->BroadcastTeleportEntity(*this); // Test position
- int BlockX = m_OriginalPosition.x;
+ int BlockX = POSX_TOINT;
int BlockY = (int)(GetPosY() - 0.5);
- int BlockZ = m_OriginalPosition.z;
+ int BlockZ = POSZ_TOINT;
if (BlockY < 0)
{
// Fallen out of this world, just continue falling until out of sight, then destroy:
- if (BlockY < 100)
+ if (BlockY < VOID_BOUNDARY)
{
Destroy(true);
}
@@ -86,6 +82,15 @@ void cFallingBlock::Tick(float a_Dt, cChunk & a_Chunk)
Destroy(true);
return;
}
+
+ float MilliDt = a_Dt * 0.001f;
+ AddSpeedY(MilliDt * -9.8f);
+ AddPosition(GetSpeed() * MilliDt);
+
+ if ((GetSpeedX() != 0) || (GetSpeedZ() != 0))
+ {
+ BroadcastMovementUpdate();
+ }
}