diff options
author | 12xx12 <44411062+12xx12@users.noreply.github.com> | 2021-03-05 16:08:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-05 16:08:30 +0100 |
commit | 8405b8969f205ffae219361dfc03f3b4c680ce73 (patch) | |
tree | cc1aef4347d9e399b80a32afa16b657885fd3603 /src/Protocol/Protocol_1_8.cpp | |
parent | Add Mushrooms to Generator and fixed up the roofed forest (#5134) (diff) | |
download | cuberite-8405b8969f205ffae219361dfc03f3b4c680ce73.tar cuberite-8405b8969f205ffae219361dfc03f3b4c680ce73.tar.gz cuberite-8405b8969f205ffae219361dfc03f3b4c680ce73.tar.bz2 cuberite-8405b8969f205ffae219361dfc03f3b4c680ce73.tar.lz cuberite-8405b8969f205ffae219361dfc03f3b4c680ce73.tar.xz cuberite-8405b8969f205ffae219361dfc03f3b4c680ce73.tar.zst cuberite-8405b8969f205ffae219361dfc03f3b4c680ce73.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Protocol/Protocol_1_8.cpp | 109 |
1 files changed, 88 insertions, 21 deletions
diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp index 91c132c8b..e3bb7e5a3 100644 --- a/src/Protocol/Protocol_1_8.cpp +++ b/src/Protocol/Protocol_1_8.cpp @@ -280,6 +280,60 @@ void cProtocol_1_8_0::SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlo +void cProtocol_1_8_0::SendBossBarAdd(UInt32 a_UniqueID, const cCompositeChat & a_Title, float a_FractionFilled, BossBarColor a_Color, BossBarDivisionType a_DivisionType, bool a_DarkenSky, bool a_PlayEndMusic, bool a_CreateFog) +{ + // No such packet here +} + + + + + +void cProtocol_1_8_0::SendBossBarRemove(UInt32 a_UniqueID) +{ + // No such packet here +} + + + + + +void cProtocol_1_8_0::SendBossBarUpdateFlags(UInt32 a_UniqueID, bool a_DarkenSky, bool a_PlayEndMusic, bool a_CreateFog) +{ + // No such packet here +} + + + + + +void cProtocol_1_8_0::SendBossBarUpdateHealth(UInt32 a_UniqueID, float a_FractionFilled) +{ + // No such packet here +} + + + + + +void cProtocol_1_8_0::SendBossBarUpdateStyle(UInt32 a_UniqueID, BossBarColor a_Color, BossBarDivisionType a_DivisionType) +{ + // No such packet here +} + + + + + +void cProtocol_1_8_0::SendBossBarUpdateTitle(UInt32 a_UniqueID, const cCompositeChat & a_Title) +{ + // No such packet here +} + + + + + void cProtocol_1_8_0::SendCameraSetTo(const cEntity & a_Entity) { cPacketizer Pkt(*this, pktCameraSetTo); @@ -356,9 +410,22 @@ void cProtocol_1_8_0::SendDestroyEntity(const cEntity & a_Entity) { ASSERT(m_State == 3); // In game mode? - cPacketizer Pkt(*this, pktDestroyEntity); - Pkt.WriteVarInt32(1); - Pkt.WriteVarInt32(a_Entity.GetUniqueID()); + { + cPacketizer Pkt(*this, pktDestroyEntity); + Pkt.WriteVarInt32(1); + Pkt.WriteVarInt32(a_Entity.GetUniqueID()); + } + + if (!a_Entity.IsMob()) + { + return; + } + + const auto & Mob = static_cast<const cMonster &>(a_Entity); + if ((Mob.GetMobType() == mtEnderDragon) || (Mob.GetMobType() == mtWither)) + { + SendBossBarRemove(Mob.GetUniqueID()); + } } @@ -1021,54 +1088,54 @@ void cProtocol_1_8_0::SendPlayerListRemovePlayer(const cPlayer & a_Player) -void cProtocol_1_8_0::SendPlayerListUpdateGameMode(const cPlayer & a_Player) +void cProtocol_1_8_0::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_CustomName) { ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, pktPlayerList); - Pkt.WriteVarInt32(1); + Pkt.WriteVarInt32(3); Pkt.WriteVarInt32(1); Pkt.WriteUUID(a_Player.GetUUID()); - Pkt.WriteVarInt32(static_cast<UInt32>(a_Player.GetEffectiveGameMode())); + + if (a_CustomName.empty()) + { + Pkt.WriteBool(false); + } + else + { + Pkt.WriteBool(true); + Pkt.WriteString(Printf("{\"text\":\"%s\"}", a_CustomName.c_str())); + } } -void cProtocol_1_8_0::SendPlayerListUpdatePing(const cPlayer & a_Player) +void cProtocol_1_8_0::SendPlayerListUpdateGameMode(const cPlayer & a_Player) { ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, pktPlayerList); - Pkt.WriteVarInt32(2); + Pkt.WriteVarInt32(1); Pkt.WriteVarInt32(1); Pkt.WriteUUID(a_Player.GetUUID()); - Pkt.WriteVarInt32(static_cast<UInt32>(a_Player.GetClientHandle()->GetPing())); + Pkt.WriteVarInt32(static_cast<UInt32>(a_Player.GetEffectiveGameMode())); } -void cProtocol_1_8_0::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_CustomName) +void cProtocol_1_8_0::SendPlayerListUpdatePing(const cPlayer & a_Player) { ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, pktPlayerList); - Pkt.WriteVarInt32(3); + Pkt.WriteVarInt32(2); Pkt.WriteVarInt32(1); Pkt.WriteUUID(a_Player.GetUUID()); - - if (a_CustomName.empty()) - { - Pkt.WriteBool(false); - } - else - { - Pkt.WriteBool(true); - Pkt.WriteString(Printf("{\"text\":\"%s\"}", a_CustomName.c_str())); - } + Pkt.WriteVarInt32(static_cast<UInt32>(a_Player.GetClientHandle()->GetPing())); } |