summaryrefslogtreecommitdiffstats
path: root/src/Entities/Entity.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Entities/Entity.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 6e1dec957..98be99a27 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -1038,6 +1038,20 @@ void cEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
NextSpeed -= NextSpeed * (m_AirDrag * 20.0f) * DtSec.count();
}
NextSpeed.y += static_cast<float>(fallspeed);
+
+ // A real boat floats
+ if (IsBoat())
+ {
+ // Find top water block and sit there
+ int NextBlockY = BlockY;
+ BLOCKTYPE NextBlock = NextChunk->GetBlock(RelBlockX, NextBlockY, RelBlockZ);
+ while (IsBlockWater(NextBlock))
+ {
+ NextBlock = NextChunk->GetBlock(RelBlockX, ++NextBlockY, RelBlockZ);
+ }
+ NextPos.y = NextBlockY - 0.5;
+ NextSpeed.y = 0;
+ }
}
else
{
@@ -1913,6 +1927,14 @@ void cEntity::BroadcastMovementUpdate(const cClientHandle * a_Exclude)
+cEntity * cEntity::GetAttached()
+{
+ return m_AttachedTo;
+}
+
+
+
+
void cEntity::AttachTo(cEntity * a_AttachTo)
{