diff --git a/src/network/mcpe/handler/InGamePacketHandler.php b/src/network/mcpe/handler/InGamePacketHandler.php index 450445c873..5c25d54228 100644 --- a/src/network/mcpe/handler/InGamePacketHandler.php +++ b/src/network/mcpe/handler/InGamePacketHandler.php @@ -390,7 +390,9 @@ class InGamePacketHandler extends PacketHandler{ }else{ $blocks[] = $blockPos; } - $this->player->getLocation()->getWorld()->sendBlocks([$this->player], $blocks); + foreach($this->player->getWorld()->createBlockUpdatePackets($blocks) as $packet){ + $this->session->sendDataPacket($packet); + } } } @@ -616,7 +618,9 @@ class InGamePacketHandler extends PacketHandler{ try{ if(!$block->updateText($this->player, $text)){ - $this->player->getWorld()->sendBlocks([$this->player], [$pos]); + foreach($this->player->getWorld()->createBlockUpdatePackets([$pos]) as $updatePacket){ + $this->session->sendDataPacket($updatePacket); + } } }catch(\UnexpectedValueException $e){ throw BadPacketException::wrap($e); diff --git a/src/world/World.php b/src/world/World.php index 837498e9b9..eeb85d567e 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -763,7 +763,9 @@ class World implements ChunkManager{ $p->onChunkChanged($chunk); } }else{ - $this->sendBlocks($this->getChunkPlayers($chunkX, $chunkZ), $blocks); + foreach($this->createBlockUpdatePackets($blocks) as $packet){ + $this->broadcastPacketToPlayersUsingChunk($chunkX, $chunkZ, $packet); + } } } } @@ -822,10 +824,11 @@ class World implements ChunkManager{ } /** - * @param Player[] $target * @param Vector3[] $blocks + * + * @return ClientboundPacket[] */ - public function sendBlocks(array $target, array $blocks) : void{ + public function createBlockUpdatePackets(array $blocks) : array{ $packets = []; foreach($blocks as $b){ @@ -842,7 +845,7 @@ class World implements ChunkManager{ } } - $this->server->broadcastPackets($target, $packets); + return $packets; } public function clearCache(bool $force = false) : void{