summaryrefslogtreecommitdiffstats
path: root/src/Entities/Entity.cpp
diff options
context:
space:
mode:
authorbeeduck <b33duck@gmail.com>2016-07-18 22:10:00 +0200
committerMattes D <github@xoft.cz>2016-07-18 22:10:00 +0200
commitdb65e11d57fb52395a3ba2e9372bdaf29aca691c (patch)
tree25bcc8449ab859676dcc2dea7b318051c22e51f1 /src/Entities/Entity.cpp
parentUpdate README.md (#3266) (diff)
downloadcuberite-db65e11d57fb52395a3ba2e9372bdaf29aca691c.tar
cuberite-db65e11d57fb52395a3ba2e9372bdaf29aca691c.tar.gz
cuberite-db65e11d57fb52395a3ba2e9372bdaf29aca691c.tar.bz2
cuberite-db65e11d57fb52395a3ba2e9372bdaf29aca691c.tar.lz
cuberite-db65e11d57fb52395a3ba2e9372bdaf29aca691c.tar.xz
cuberite-db65e11d57fb52395a3ba2e9372bdaf29aca691c.tar.zst
cuberite-db65e11d57fb52395a3ba2e9372bdaf29aca691c.zip
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)
{