summaryrefslogtreecommitdiffstats
path: root/src/Protocol
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2021-11-11 22:02:29 +0100
committerGitHub <noreply@github.com>2021-11-11 22:02:29 +0100
commitd49ce751ba6f8f2eb171633cea30a1119935f8c7 (patch)
tree25cb23102c0d778cada555c0c25e6dc3247a6514 /src/Protocol
parentPrevent placing of hangables on illegal blocks and break when support block broken (#5301) (diff)
downloadcuberite-d49ce751ba6f8f2eb171633cea30a1119935f8c7.tar
cuberite-d49ce751ba6f8f2eb171633cea30a1119935f8c7.tar.gz
cuberite-d49ce751ba6f8f2eb171633cea30a1119935f8c7.tar.bz2
cuberite-d49ce751ba6f8f2eb171633cea30a1119935f8c7.tar.lz
cuberite-d49ce751ba6f8f2eb171633cea30a1119935f8c7.tar.xz
cuberite-d49ce751ba6f8f2eb171633cea30a1119935f8c7.tar.zst
cuberite-d49ce751ba6f8f2eb171633cea30a1119935f8c7.zip
Diffstat (limited to 'src/Protocol')
-rw-r--r--src/Protocol/Protocol_1_14.cpp3
-rw-r--r--src/Protocol/Protocol_1_8.cpp15
2 files changed, 10 insertions, 8 deletions
diff --git a/src/Protocol/Protocol_1_14.cpp b/src/Protocol/Protocol_1_14.cpp
index 0d0bc49a0..f38227edd 100644
--- a/src/Protocol/Protocol_1_14.cpp
+++ b/src/Protocol/Protocol_1_14.cpp
@@ -90,9 +90,6 @@ void cProtocol_1_14::SendLogin(const cPlayer & a_Player, const cWorld & a_World)
// cPacketizer Pkt(*this, pktDifficulty);
// Pkt.WriteBEInt8(1);
}
-
- // Send player abilities:
- SendPlayerAbilities();
}
diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp
index d29126e4e..e2e8ca499 100644
--- a/src/Protocol/Protocol_1_8.cpp
+++ b/src/Protocol/Protocol_1_8.cpp
@@ -934,13 +934,12 @@ void cProtocol_1_8_0::SendPlayerAbilities(void)
{
ASSERT(m_State == 3); // In game mode?
- cPacketizer Pkt(*this, pktPlayerAbilities);
Byte Flags = 0;
- cPlayer * Player = m_Client->GetPlayer();
- if (Player->IsGameModeCreative())
+ const cPlayer * Player = m_Client->GetPlayer();
+
+ if (Player->IsGameModeCreative() || Player->IsGameModeSpectator())
{
- Flags |= 0x01;
- Flags |= 0x08; // Godmode, used for creative
+ Flags |= 0x01; // Invulnerability.
}
if (Player->IsFlying())
{
@@ -950,6 +949,12 @@ void cProtocol_1_8_0::SendPlayerAbilities(void)
{
Flags |= 0x04;
}
+ if (Player->IsGameModeCreative())
+ {
+ Flags |= 0x08; // Godmode: creative instant break.
+ }
+
+ cPacketizer Pkt(*this, pktPlayerAbilities);
Pkt.WriteBEUInt8(Flags);
Pkt.WriteBEFloat(static_cast<float>(0.05 * Player->GetFlyingMaxSpeed()));
Pkt.WriteBEFloat(static_cast<float>(0.1 * Player->GetNormalMaxSpeed()));