PHP code example of hydronetwork / bedrock-protocol
1. Go to this page and download the library: Download hydronetwork/bedrock-protocol library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hydronetwork / bedrock-protocol example snippets
foreach(PacketBatchUtils::decodePackets(new BinaryStream($payload), $protocolContext, PacketPool::getInstance()) as $packetObject){
var_dump($packetObject); //tada
}
/** @var Packet[] $packets */
$stream = new BinaryStream();
PacketBatchUtils::encodePackets($stream, $protocolContext, $packets);
$batchPayload = $stream->getBuffer();