diff --git a/src/network/mcpe/NetworkSession.php b/src/network/mcpe/NetworkSession.php index 3c97db45e..73be3bee5 100644 --- a/src/network/mcpe/NetworkSession.php +++ b/src/network/mcpe/NetworkSession.php @@ -124,12 +124,14 @@ use function count; use function get_class; use function in_array; use function json_encode; +use function ksort; use function strlen; use function strtolower; use function substr; use function time; use function ucfirst; use const JSON_THROW_ON_ERROR; +use const SORT_NUMERIC; class NetworkSession{ private \PrefixedLogger $logger; @@ -821,6 +823,9 @@ class NetworkSession{ * @phpstan-param array $properties */ public function syncActorData(Entity $entity, array $properties) : void{ + //TODO: HACK! as of 1.18.10, the client responds differently to the same data ordered in different orders - for + //example, sending HEIGHT in the list before FLAGS when unsetting the SWIMMING flag results in a hitbox glitch + ksort($properties, SORT_NUMERIC); $this->sendDataPacket(SetActorDataPacket::create($entity->getId(), $properties, 0)); } diff --git a/src/network/mcpe/handler/InGamePacketHandler.php b/src/network/mcpe/handler/InGamePacketHandler.php index 97d45ee89..dc2a5e468 100644 --- a/src/network/mcpe/handler/InGamePacketHandler.php +++ b/src/network/mcpe/handler/InGamePacketHandler.php @@ -90,8 +90,6 @@ use pocketmine\network\mcpe\protocol\SubClientLoginPacket; use pocketmine\network\mcpe\protocol\TextPacket; use pocketmine\network\mcpe\protocol\types\ActorEvent; use pocketmine\network\mcpe\protocol\types\BlockPosition; -use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataProperties; -use pocketmine\network\mcpe\protocol\types\entity\FloatMetadataProperty; use pocketmine\network\mcpe\protocol\types\inventory\ContainerIds; use pocketmine\network\mcpe\protocol\types\inventory\MismatchTransactionData; use pocketmine\network\mcpe\protocol\types\inventory\NetworkInventoryAction; @@ -224,11 +222,6 @@ class InGamePacketHandler extends PacketHandler{ ($gliding !== null && !$this->player->toggleGlide($gliding)); if((bool) $mismatch){ $this->player->sendData([$this->player]); - }elseif($packet->hasFlag(PlayerAuthInputFlags::STOP_SWIMMING) || $packet->hasFlag(PlayerAuthInputFlags::STOP_GLIDING)){ - //TODO: HACK! workaround for a client bug where the AABB doesn't change back properly when stopping swimming or gliding - $this->player->sendData([$this->player], [ - EntityMetadataProperties::BOUNDING_BOX_HEIGHT => new FloatMetadataProperty($this->player->getSize()->getHeight()) - ]); } if($packet->hasFlag(PlayerAuthInputFlags::START_JUMPING)){