diff options
author | Mattes D <github@xoft.cz> | 2013-12-15 15:52:39 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2013-12-15 15:52:39 +0100 |
commit | af4237de77e0ec36b9610eb81fffb424e88806c8 (patch) | |
tree | d6f1f1737388e7bf65a475a1396d30bed745094b /src/Protocol | |
parent | Merge pull request #432 from mc-server/Broadcast_Effects (diff) | |
parent | APIDump: Documented New functions (diff) | |
download | cuberite-af4237de77e0ec36b9610eb81fffb424e88806c8.tar cuberite-af4237de77e0ec36b9610eb81fffb424e88806c8.tar.gz cuberite-af4237de77e0ec36b9610eb81fffb424e88806c8.tar.bz2 cuberite-af4237de77e0ec36b9610eb81fffb424e88806c8.tar.lz cuberite-af4237de77e0ec36b9610eb81fffb424e88806c8.tar.xz cuberite-af4237de77e0ec36b9610eb81fffb424e88806c8.tar.zst cuberite-af4237de77e0ec36b9610eb81fffb424e88806c8.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Protocol/Protocol17x.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 0daf1c932..edf7d2529 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -491,7 +491,15 @@ void cProtocol172::SendPlayerAbilities(void) { Flags |= 0x01; } - // TODO: Other flags (god mode, flying, can fly + if (m_Client->GetPlayer()->IsFlying()) + { + Flags |= 0x02; + } + if (m_Client->GetPlayer()->CanFly()) + { + Flags |= 0x04; + } + // TODO: Other flags (god mode) Pkt.WriteByte(Flags); // TODO: Pkt.WriteFloat(m_Client->GetPlayer()->GetMaxFlyingSpeed()); Pkt.WriteFloat(0.05f); @@ -1278,7 +1286,25 @@ void cProtocol172::HandlePacketPlayerAbilities(cByteBuffer & a_ByteBuffer) HANDLE_READ(a_ByteBuffer, ReadByte, Byte, Flags); HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, FlyingSpeed); HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, WalkingSpeed); - // TODO: m_Client->HandlePlayerAbilities(); + + bool IsFlying, CanFly; + if ((Flags & 2) != 0) + { + IsFlying = true; + } + else + { + IsFlying = false; + } + if ((Flags & 4) != 0) + { + CanFly = true; + } + else + { + CanFly = false; + } + m_Client->HandlePlayerAbilities(CanFly, IsFlying, FlyingSpeed, WalkingSpeed); } |