From 6dc95b944caa8a74a7cb6b92562e0a4bb240bcdb Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 15 Sep 2025 19:10:10 +0100 Subject: [PATCH] maybe don't make a mess? --- src/network/mcpe/NetworkSession.php | 4 +++- src/network/mcpe/handler/InGamePacketHandler.php | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/network/mcpe/NetworkSession.php b/src/network/mcpe/NetworkSession.php index ecb91c57b..11c703bc9 100644 --- a/src/network/mcpe/NetworkSession.php +++ b/src/network/mcpe/NetworkSession.php @@ -111,7 +111,6 @@ use pocketmine\promise\PromiseResolver; use pocketmine\Server; use pocketmine\timings\Timings; use pocketmine\utils\AssumptionFailedError; -use pocketmine\utils\Binary; use pocketmine\utils\BinaryDataException; use pocketmine\utils\BinaryStream; use pocketmine\utils\ObjectSet; @@ -497,6 +496,9 @@ class NetworkSession{ } } + private string $noisyPacketBuffer = ""; + private int $noisyPacketsDropped = 0; + /** * @throws PacketHandlingException */ diff --git a/src/network/mcpe/handler/InGamePacketHandler.php b/src/network/mcpe/handler/InGamePacketHandler.php index e9c6556ef..8a4f957ec 100644 --- a/src/network/mcpe/handler/InGamePacketHandler.php +++ b/src/network/mcpe/handler/InGamePacketHandler.php @@ -117,6 +117,7 @@ use function is_nan; use function json_decode; use function max; use function mb_strlen; +use function microtime; use function sprintf; use function str_starts_with; use function strlen; @@ -128,6 +129,9 @@ use const JSON_THROW_ON_ERROR; class InGamePacketHandler extends PacketHandler{ private const MAX_FORM_RESPONSE_DEPTH = 2; //modal/simple will be 1, custom forms 2 - they will never contain anything other than string|int|float|bool|null + protected float $lastRightClickTime = 0.0; + protected ?UseItemTransactionData $lastRightClickData = null; + protected ?Vector3 $lastPlayerAuthInputPosition = null; protected ?float $lastPlayerAuthInputYaw = null; protected ?float $lastPlayerAuthInputPitch = null; @@ -494,7 +498,7 @@ class InGamePacketHandler extends PacketHandler{ $blockPos = $data->getBlockPosition(); $vBlockPos = new Vector3($blockPos->getX(), $blockPos->getY(), $blockPos->getZ()); - $this->player->interactBlock($vBlockPos, $data->getFace(), $data->getClickPosition()); + $this->player->interactBlock($vBlockPos, $data->getFace(), $clickPos); //always sync this in case plugins caused a different result than the client expected //we *could* try to enhance detection of plugin-altered behaviour, but this would require propagating //more information up the stack. For now I think this is good enough.