0
0
mirror of https://github.com/pmmp/BedrockProtocol.git synced 2025-02-23 01:06:25 +00:00
Dylan K. Taylor 455dbad93d JwtHeader: accept optional key thumbprint field (x5t)
this suddenly started appearing around 1pm UTC today, and no one seems to have any idea why.
My best guess is that Mojang updated the service used to provide Xbox Live authentication, and the new code accidentally includes this field.
This isn't a problem, but it caused every PocketMine-MP server to be unjoinable.

While we can just allow undefined properties in JsonMapper, that becomes problematic in PHP 8.2, which disallows dynamic properties on objects by default.
2023-03-29 23:38:17 +01:00
2023-02-19 15:56:16 +00:00
2021-07-14 15:23:03 +01:00
2021-07-14 15:23:03 +01:00
2022-01-10 21:21:59 +00:00
2021-07-14 15:23:03 +01:00
2022-07-13 00:47:47 +01:00
2023-02-19 15:13:36 +00:00

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.

Description
An implementation of the Minecraft: Bedrock Edition protocol in PHP
Readme 2.3 MiB
Languages
PHP 100%