Skip to content

An implementation of the Minecraft: Bedrock Edition protocol in PHP

License

Notifications You must be signed in to change notification settings

Refaltor77/BedrockProtocol

This branch is 3 commits ahead of, 77 commits behind pmmp/BedrockProtocol:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Oct 14, 2023
e978c3d · Oct 14, 2023
Sep 20, 2023
Nov 8, 2021
Oct 14, 2023
Jul 12, 2023
Nov 30, 2022
Jul 14, 2021
Jul 14, 2021
Nov 1, 2021
Jan 10, 2022
Jul 14, 2021
Feb 19, 2023
Sep 20, 2023
Jul 12, 2022

Repository files navigation

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:

foreach(PacketBatchUtils::decodePackets(new BinaryStream($payload), $protocolContext, PacketPool::getInstance()) as $packetObject){
    var_dump($packetObject); //tada
}

Encoding packets

This is easy:

/** @var Packet[] $packets */
$stream = new BinaryStream();
PacketBatchUtils::encodePackets($stream, $protocolContext, $packets);
$batchPayload = $stream->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.

About

An implementation of the Minecraft: Bedrock Edition protocol in PHP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%