From aac4f6c0e11ca5bb35dfba0f6543dd08b3ec5fe5 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 6 May 2023 18:18:05 +0100 Subject: [PATCH 1/3] Fixed all game modes allowing flight moral of the story: do not trust that mojang things do what they say they do - the spectator ability layer always applies, regardless of whether the player is actually in spectator mode or not ... --- src/network/mcpe/NetworkSession.php | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/network/mcpe/NetworkSession.php b/src/network/mcpe/NetworkSession.php index 1b90547e7..92a992ffb 100644 --- a/src/network/mcpe/NetworkSession.php +++ b/src/network/mcpe/NetworkSession.php @@ -887,20 +887,26 @@ class NetworkSession{ AbilitiesLayer::ABILITY_PRIVILEGED_BUILDER => false, ]; + $layers = [ + //TODO: dynamic flying speed! FINALLY!!!!!!!!!!!!!!!!! + new AbilitiesLayer(AbilitiesLayer::LAYER_BASE, $boolAbilities, 0.05, 0.1), + ]; + if(!$for->hasBlockCollision()){ + //TODO: HACK! In 1.19.80, the client starts falling in our faux spectator mode when it clips into a + //block. We can't seem to prevent this short of forcing the player to always fly when block collision is + //disabled. Also, for some reason the client always reads flight state from this layer if present, even + //though the player isn't in spectator mode. + + $layers[] = new AbilitiesLayer(AbilitiesLayer::LAYER_SPECTATOR, [ + AbilitiesLayer::ABILITY_FLYING => true, + ], null, null); + } + $this->sendDataPacket(UpdateAbilitiesPacket::create(new AbilitiesData( $isOp ? CommandPermissions::OPERATOR : CommandPermissions::NORMAL, $isOp ? PlayerPermissions::OPERATOR : PlayerPermissions::MEMBER, $for->getId(), - [ - //TODO: dynamic flying speed! FINALLY!!!!!!!!!!!!!!!!! - new AbilitiesLayer(AbilitiesLayer::LAYER_BASE, $boolAbilities, 0.05, 0.1), - - //TODO: HACK! In 1.19.80, the client starts falling in our faux spectator mode when it clips into a - //block. I have no idea why this works, since we don't actually use the real spectator mode. - new AbilitiesLayer(AbilitiesLayer::LAYER_SPECTATOR, [ - AbilitiesLayer::ABILITY_FLYING => true, - ], null, null) - ] + $layers ))); } From c3ceeeace712f4eac380b78d1851e7dfb89f557c Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 6 May 2023 18:20:18 +0100 Subject: [PATCH 2/3] Release 4.20.4 --- changelogs/4.20.md | 7 +++++++ src/VersionInfo.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/changelogs/4.20.md b/changelogs/4.20.md index bc8c931b2..37a0ef37b 100644 --- a/changelogs/4.20.md +++ b/changelogs/4.20.md @@ -64,3 +64,10 @@ Released 6th May 2023. - This was caused by creating a new timings handler for each call, regardless of whether a timer already existed for the given event and callback. - Fixed `Full Server Tick` and other records being missing from timings reports. - This was caused by timings handler depth not getting reset when timings was disabled and later re-enabled. + +# 4.20.4 +Released 6th May 2023. + +## Fixes +- Fixed players being forced into flight mode in every game mode. + - Moral of the story: do not assume anything in Mojang internals does what its name suggests... diff --git a/src/VersionInfo.php b/src/VersionInfo.php index 0b72d7f9e..60013af1b 100644 --- a/src/VersionInfo.php +++ b/src/VersionInfo.php @@ -32,7 +32,7 @@ use function str_repeat; final class VersionInfo{ public const NAME = "PocketMine-MP"; public const BASE_VERSION = "4.20.4"; - public const IS_DEVELOPMENT_BUILD = true; + public const IS_DEVELOPMENT_BUILD = false; public const BUILD_CHANNEL = "stable"; private function __construct(){ From 283ff28aa91e107521d1495340f584f1766f3dae Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 6 May 2023 18:20:19 +0100 Subject: [PATCH 3/3] 4.20.5 is next --- src/VersionInfo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/VersionInfo.php b/src/VersionInfo.php index 60013af1b..d577d8069 100644 --- a/src/VersionInfo.php +++ b/src/VersionInfo.php @@ -31,8 +31,8 @@ use function str_repeat; final class VersionInfo{ public const NAME = "PocketMine-MP"; - public const BASE_VERSION = "4.20.4"; - public const IS_DEVELOPMENT_BUILD = false; + public const BASE_VERSION = "4.20.5"; + public const IS_DEVELOPMENT_BUILD = true; public const BUILD_CHANNEL = "stable"; private function __construct(){