All Projects → pmmp → BedrockProtocol

pmmp / BedrockProtocol

Licence: LGPL-3.0 License
An implementation of the Minecraft: Bedrock Edition protocol in PHP

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to BedrockProtocol

RakLib
RakNet server implementation written in PHP
Stars: ✭ 58 (-1.69%)
Mutual labels:  on-packagist, phpstan-strict, php81, github-actions-enabled, phpstan-l9
Math
PHP library containing math related code used in PocketMine-MP
Stars: ✭ 35 (-40.68%)
Mutual labels:  on-packagist, phpstan-strict, php81, github-actions-enabled, phpstan-l9
ext-chunkutils2
PHP extension in C++ implementing the modern Minecraft: Bedrock subchunk format for PocketMine-MP 4.0
Stars: ✭ 26 (-55.93%)
Mutual labels:  php81, github-actions-enabled
SPL
[deprecated] Miscellaneous PHP library files required by PocketMine-MP and related projects
Stars: ✭ 13 (-77.97%)
Mutual labels:  on-packagist, github-actions-enabled
Pocketmine Mp
A server software for Minecraft: Bedrock Edition in PHP
Stars: ✭ 2,594 (+4296.61%)
Mutual labels:  phpstan-strict, phpstan-l9
DevTools
Development tools plugin for PocketMine-MP
Stars: ✭ 79 (+33.9%)
Mutual labels:  github-actions-enabled
ExamplePlugin
Example PocketMine-MP plugin, showing some basic features of the API
Stars: ✭ 26 (-55.93%)
Mutual labels:  phpstan-strict
magento2-fast-vm
Optimal vagrant developer box for Magento2. Folders synced by nfs/rsync. This box includes Magento developer utilities.
Stars: ✭ 89 (+50.85%)
Mutual labels:  php81
framework
FEAST Framework
Stars: ✭ 66 (+11.86%)
Mutual labels:  php81
mdserver-web
Simple Linux Panel
Stars: ✭ 1,064 (+1703.39%)
Mutual labels:  php81
ext-encoding
High-performance specialized replacements for PHP's pack() and unpack() functions
Stars: ✭ 13 (-77.97%)
Mutual labels:  php81
BuilderTools
🪓 Powerful World Editor plugin for PocketMine servers
Stars: ✭ 74 (+25.42%)
Mutual labels:  phpstan-l9

BedrockProtocol

CI

An implementation of the Minecraft: Bedrock Edition protocol in PHP

This library implements all of the packets in the Minecraft: Bedrock Edition protocol, as well as a few extra things needed to support them. However, at the time of writing, it does not include the following:

  • Anything related to JWT handling/verification
  • Anything related to encryption
  • Anything related to compression

Decoding packets

Assuming you've decrypted and decompressed a Minecraft packet successfully, you're next going to want to decode it. With this library, that's currently done using PacketBatch, like so:

$batch = new PacketBatch($payload);
foreach($batch->getPackets($packetPool, $protocolContext, $maxPackets) as [$packetObject, $packetPayload]){
  if($packetObject !== null){
    $packetObject->decode(PacketSerializer::decoder($packetPayload, 0, $protocolContext));
    var_dump($packetObject); //tada
  }else{
    var_dump("Got unknown packet", $packetPayload);
  }
}

Encoding packets

This is easy:

/** @var Packet[] $packets */
$batch = PacketBatch::fromPackets($protocolContext, ...$packets);
$batchPayload = $batch->getBuffer();

Footnotes

This library is a little rough around the edges, since it's only ever been intended for PocketMine-MP usage. It's only recently that this mess has been separated from the core to allow it to be used by other things. This means that API changes might be in order, and your feedback would be nice to drive them. If you want to improve BedrockProtocol, please open issues with suggestions, or better, make pull requests.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].