diff --git a/.eslintignore b/.eslintignore
deleted file mode 100644
index 61743e4..0000000
--- a/.eslintignore
+++ /dev/null
@@ -1 +0,0 @@
-examples/viewer
\ No newline at end of file
diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index cd19a23..0000000
--- a/.gitattributes
+++ /dev/null
@@ -1 +0,0 @@
-data/*/*.json linguist-generated
\ No newline at end of file
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..a71776b
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,3 @@
+github: PrismarineJS
+open_collective: prismarinejs
+custom: https://rysolv.com/repos/detail/74691b23-938d-4b2f-b65a-5c47bf5b3f0f
\ No newline at end of file
diff --git a/.github/helper-bot/index.js b/.github/helper-bot/index.js
new file mode 100644
index 0000000..8dffc6c
--- /dev/null
+++ b/.github/helper-bot/index.js
@@ -0,0 +1,139 @@
+// Automatic version update checker for Minecraft bedrock edition.
+const fs = require('fs')
+const cp = require('child_process')
+const helper = require('gh-helpers')()
+const latestVesionEndpoint = 'https://itunes.apple.com/lookup?bundleId=com.mojang.minecraftpe&time=' + Date.now()
+const changelogURL = 'https://feedback.minecraft.net/hc/en-us/sections/360001186971-Release-Changelogs'
+
+// Relevant infomation for us is:
+// "version": "1.17.10",
+// "currentVersionReleaseDate": "2021-07-13T15:35:49Z",
+// "releaseNotes": "What's new in 1.17.10:\nVarious bug fixes",
+
+function buildFirstIssue (title, result, externalPatches) {
+ let commitData = ''
+ let protocolVersion = '?'
+ const date = new Date(result.currentVersionReleaseDate).toUTCString()
+
+ for (const name in externalPatches) {
+ const [patches, diff] = externalPatches[name]
+ commitData += '### ' + name + '\n'
+ for (const [name, url] of patches) {
+ commitData += `${name}\n`
+ }
+ if (diff) commitData += `\n**[See the diff between *${result.currentVersionReleaseDate}* and now](${diff})**\n`
+ else commitData += '\n(No changes so far)\n'
+ }
+ try { protocolVersion = getProtocolVersion() } catch (e) { console.log(e) }
+
+ return {
+ title,
+ body: `
+A new Minecraft Bedrock version is available (as of ${date}), version **${result.version}**
+
+## Official Changelog
+* ${result.releaseNotes} *(via App Store)*
+* ${changelogURL}
+
+## 3rd party protocol patches
+${commitData}
+
+## Protocol Details
+(I will close this issue automatically if "${result.version}" is added to index.d.ts on "master" and there are no X's below)
+
+ | Name | ${result.version} |
+
| Protocol ID | ${protocolVersion} |
+
+
+
+-----
+
+🤖 I am a bot, I check for updates every 2 hours without a trigger. You can close this issue to prevent any further updates.
+ `
+ }
+}
+
+function getCommitsInRepo (repo, containing, since) {
+ const endpoint = `https://api.github.com/repos/${repo}/commits`
+ console.log('Getting', endpoint)
+ cp.execSync(`curl -L ${endpoint} -o commits.json`, { stdio: 'inherit', shell: true })
+ const commits = JSON.parse(fs.readFileSync('./commits.json', 'utf-8'))
+ const relevant = []
+ for (const commit of commits) {
+ if (commit.commit.message.includes(containing)) {
+ console.log('commit url', commit.html_url)
+ relevant.push([commit.commit.message, commit.html_url])
+ }
+ }
+ if (since) {
+ cp.execSync(`curl -L ${endpoint}?since=${since} -o commits.json`, { stdio: 'inherit', shell: true })
+ const commits = JSON.parse(fs.readFileSync('./commits.json', 'utf-8'))
+ if (commits.length) {
+ const head = commits[0].sha
+ const tail = commits[commits.length - 1].sha
+ return [relevant, `https://github.com/${repo}/compare/${tail}..${head}`]
+ }
+ }
+ return [relevant]
+}
+
+function getProtocolVersion () {
+ if (!fs.existsSync('./ProtocolInfo.php')) cp.execSync('curl -LO https://raw.githubusercontent.com/pmmp/PocketMine-MP/stable/src/pocketmine/network/mcpe/protocol/ProtocolInfo.php', { stdio: 'inherit', shell: true })
+ const currentApi = fs.readFileSync('./ProtocolInfo.php', 'utf-8')
+ const [, latestProtocolVersion] = currentApi.match(/public const CURRENT_PROTOCOL = (\d+);/)
+ return latestProtocolVersion
+}
+
+async function fetchLatest () {
+ if (!fs.existsSync('./results.json')) cp.execSync(`curl -L "${latestVesionEndpoint}" -o results.json`, { stdio: 'inherit', shell: true })
+ const json = require('./results.json')
+ const result = json.results[0]
+ // console.log(json)
+
+ if (!fs.existsSync('./index.d.ts')) cp.execSync('curl -LO https://raw.githubusercontent.com/PrismarineJS/bedrock-protocol/master/index.d.ts', { stdio: 'inherit', shell: true })
+ const currentApi = fs.readFileSync('./index.d.ts', 'utf-8')
+ const supportedVersions = currentApi.match(/type Version = ([^\n]+)/)[1].replace(/\||'/g, ' ').split(' ').map(k => k.trim()).filter(k => k.length)
+ console.log(supportedVersions)
+
+ let { version, currentVersionReleaseDate, releaseNotes } = result
+ console.log(version, currentVersionReleaseDate, releaseNotes)
+
+ const title = `Support Minecraft ${result.version}`
+ const issueStatus = await helper.findIssue({ titleIncludes: title }) || {}
+
+ if (supportedVersions.includes(version)) {
+ if (issueStatus.isOpen) {
+ helper.close(issueStatus.id, `Closing as ${version} is now supported`)
+ }
+ console.log('Latest version is supported.')
+ return
+ }
+
+
+ if (issueStatus.isClosed) {
+ // We already made an issue, but someone else already closed it, don't do anything else
+ console.log('I already made an issue, but it was closed')
+ return
+ }
+
+ version = version.replace('.0', '')
+ const issuePayload = buildFirstIssue(title, result, {
+ PocketMine: getCommitsInRepo('pmmp/PocketMine-MP', version, currentVersionReleaseDate),
+ gophertunnel: getCommitsInRepo('Sandertv/gophertunnel', version, currentVersionReleaseDate),
+ CloudburstMC: getCommitsInRepo('CloudburstMC/Protocol', version, currentVersionReleaseDate)
+ })
+
+ if (issueStatus.isOpen) {
+ helper.updateIssue(issueStatus.id, issuePayload)
+ } else {
+ helper.createIssue(issuePayload)
+ }
+
+ fs.writeFileSync('./issue.md', issuePayload.body)
+ console.log('OK, wrote to ./issue.md', issuePayload)
+}
+
+fetchLatest()
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7803afb..4176a31 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -5,21 +5,32 @@ on:
branches: [ '*', '!gh-pages' ]
pull_request:
branches: [ '*', '!gh-pages' ]
+ workflow_dispatch:
+ inputs:
+ via:
+ description: 'trigger origin'
+ required: true
jobs:
build:
- runs-on: ubuntu-latest
- timeout-minutes: 10
-
strategy:
+ fail-fast: false
matrix:
- node-version: [14.x]
-
+ os: [ubuntu-latest, windows-latest]
+ node-version: [22.x]
+ runs-on: ${{ matrix.os }}
+ timeout-minutes: 14
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
+ # Old versions of bedrock use old libssl that Ubuntu no longer ships with; need manual install
+ - name: (Linux) Install libssl 1.1
+ if: runner.os == 'Linux'
+ run: |
+ wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
+ sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
- run: npm install
- run: npm test
diff --git a/.github/workflows/commands.yml b/.github/workflows/commands.yml
new file mode 100644
index 0000000..111d139
--- /dev/null
+++ b/.github/workflows/commands.yml
@@ -0,0 +1,22 @@
+name: Repo Commands
+
+on:
+ issue_comment: # Handle comment commands
+ types: [created]
+ pull_request_target: # Handle renamed PRs
+ types: [edited]
+
+jobs:
+ comment-trigger:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check out repository
+ uses: actions/checkout@v3
+ - name: Run command handlers
+ uses: PrismarineJS/prismarine-repo-actions@master
+ with:
+ # NOTE: You must specify a Personal Access Token (PAT) with repo access here. While you can use the default GITHUB_TOKEN, actions taken with it will not trigger other actions, so if you have a CI workflow, commits created by this action will not trigger it.
+ token: ${{ secrets.PAT_PASSWORD }}
+ # See `Options` section below for more info on these options
+ install-command: npm install
+ /fixlint.fix-command: npm run fix
diff --git a/.github/workflows/update-helper.yml b/.github/workflows/update-helper.yml
new file mode 100644
index 0000000..d9380da
--- /dev/null
+++ b/.github/workflows/update-helper.yml
@@ -0,0 +1,24 @@
+name: Update Helper
+on:
+ workflow_dispatch:
+ schedule:
+ - cron: "0 */2 * * *"
+
+jobs:
+ helper:
+ name: update-checker
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@master
+ - name: Set up Node.js
+ uses: actions/setup-node@master
+ with:
+ node-version: 22.0.0
+ - name: Install Github Actions helper
+ run: npm i gh-helpers
+ # The env vars contain the relevant trigger information, so we don't need to pass it
+ - name: Runs helper
+ run: cd .github/helper-bot && node index.js
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.gitignore b/.gitignore
index 8bdb3f2..c14d132 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,10 +2,7 @@ node_modules/
npm-debug.log
package-lock.json
__*
-src/**/*.json
# Runtime generated data
-data/**/sample
-data/**/read.js
-data/**/write.js
-data/**/size.js
-tools/bds*
\ No newline at end of file
+data/
+tools/bds*
+tools/pmmp*
\ No newline at end of file
diff --git a/.npmignore b/.npmignore
index a085593..da98b5e 100644
--- a/.npmignore
+++ b/.npmignore
@@ -1,7 +1,10 @@
node_modules/
npm-debug.log
__*
-src/**/*.json
# Runtime generated data
-data/**/sample
-tools/bds*
\ No newline at end of file
+data/
+tools/bds*
+# Extra data
+examples
+test
+.github
diff --git a/HISTORY.md b/HISTORY.md
index d6f0347..799d0a9 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -1,10 +1,250 @@
+## 3.49.0
+* [1.21.111 (#649)](https://github.com/PrismarineJS/bedrock-protocol/commit/b48518a6e79e72101fe7136433cbd6277339fc5c) (thanks @Slauh)
+* [Skin Data Changes (#647)](https://github.com/PrismarineJS/bedrock-protocol/commit/407756b93880cdda4fdbff194fc4163ceedf4e82) (thanks @thejfkvis)
+
+## 3.48.1
+* [Update login client skinData (#635)](https://github.com/PrismarineJS/bedrock-protocol/commit/6b1474d2c6f93b47dee9d4816de59579f82ed5a9) (thanks @TSL534)
+
+## 3.48.0
+* [1.21.100 (#632)](https://github.com/PrismarineJS/bedrock-protocol/commit/06fb3de3a0023d03201dbcee7e9178c269462766) (thanks @extremeheat)
+
+## 3.47.0
+* [1.21.93 support (#623)](https://github.com/PrismarineJS/bedrock-protocol/commit/14daa2d95aac90ffcc7b42d625e270020ec2f162) (thanks @CreeperG16)
+
+## 3.46.0
+* [1.21.90 support (#617)](https://github.com/PrismarineJS/bedrock-protocol/commit/c66cdd3d62d2fa9c581693d8c70d7b41f355b63e) (thanks @CreeperG16)
+
+## 3.45.0
+* [1.21.80 (#602)](https://github.com/PrismarineJS/bedrock-protocol/commit/e71fd513ddbd432983f221980080b61e11576965) (thanks @extremeheat)
+
+## 3.44.0
+* [1.21.70 (#594)](https://github.com/PrismarineJS/bedrock-protocol/commit/065f41db8cfc8cbd8106bd9e376c899ec25f3f77) (thanks @CreeperG16)
+
+## 3.43.1
+* [Fix server not correctly removing clients (#588)](https://github.com/PrismarineJS/bedrock-protocol/commit/47f342ca958ba87a7719783bd5c855cebdd4aa65) (thanks @EntifiedOptics)
+
+## 3.43.0
+* [1.21.60 support (#570)](https://github.com/PrismarineJS/bedrock-protocol/commit/eeb5e47e35f31cc571a9a8a491f5a89b27e637f1) (thanks @CreeperG16)
+* [Fix version feature handling (#572)](https://github.com/PrismarineJS/bedrock-protocol/commit/0ed8e32be85f05926cd97d5f0317ed004ae5eefa) (thanks @ItsMax123)
+
+## 3.42.3
+* [Fix Server `maxPlayers` option (#565)](https://github.com/PrismarineJS/bedrock-protocol/commit/38dc5a256105a44786d5455570d5a130e64ef561) (thanks @extremeheat)
+
+## 3.42.2
+* Fix missing type serialization error
+
+## 3.42.1
+* [Add 1.21.40 login fields (#553)](https://github.com/PrismarineJS/bedrock-protocol/commit/24d3200181c060162b04fb233fef6e0d6d1a93aa) (thanks @extremeheat)
+* [Remove protodef varint types (#552)](https://github.com/PrismarineJS/bedrock-protocol/commit/347e303ce422bdb6f6dfd4cba57d7d3937214707) (thanks @extremeheat)
+
+## 3.42.0
+* [1.21.50 support](https://github.com/PrismarineJS/bedrock-protocol/commit/1c0836bff03d50cb12a3e45763eac6c9f605e00c) (thanks @extremeheat)
+* [Dynamic compression & batch header (#544)](https://github.com/PrismarineJS/bedrock-protocol/commit/911e0e890febc00102cd1e5406731e66f7bad0ef) (thanks @LucienHH)
+
+## 3.41.0
+* [1.21.42 support](https://github.com/PrismarineJS/bedrock-protocol/commit/dd5c4de4f2624c3654af66e9a40a65eb13de0850) (thanks @CreeperG16)
+
+## 3.40.0
+* [1.21.30 support (#527)](https://github.com/PrismarineJS/bedrock-protocol/commit/fc30c96135ec20dca1257f702152cba61d4a59be) (thanks @pokecosimo)
+* [Update tests (#528)](https://github.com/PrismarineJS/bedrock-protocol/commit/cb530c8b45bf505f75e0e39241d88085c5564ae8) (thanks @extremeheat)
+
+## 3.39.0
+* [1.21.20](https://github.com/PrismarineJS/bedrock-protocol/commit/3be55777fab4949179d3a7108ee29bbd8fada5a7) (thanks @extremeheat)
+* [update disconnect packet](https://github.com/PrismarineJS/bedrock-protocol/commit/4c3f62567e0f6ce20b70ea23238fce8606011e95) (thanks @extremeheat)
+
+## 3.38.0
+* [Support 1.21.2, and add missing versions to type definitions (#510)](https://github.com/PrismarineJS/bedrock-protocol/commit/5d3986924d3f262708d7c7e55a7f410f12c7903c) (thanks @CreeperG16)
+* [Fix example in README.md for 1.21 (#506)](https://github.com/PrismarineJS/bedrock-protocol/commit/c4593aa355d6ce9e2ac65cc2102cd9285a6b6449) (thanks @Ant767)
+* [Don't send now deprecated tick sync packets on 1.21 and newer (#504)](https://github.com/PrismarineJS/bedrock-protocol/commit/84c5231b92df9f5f1a09b29a05e7abfed62f1c2b) (thanks @w0ahL)
+
+## 3.37.0
+* [Support 1.21.0](https://github.com/PrismarineJS/bedrock-protocol/commit/5b2d78792c9b4c070d727a9028a6b3a266483e1c) (thanks @CreeperG16)
+* [Fix typo in types (#501)](https://github.com/PrismarineJS/bedrock-protocol/commit/16e15d80a5084a19ed2fbabc023789ee38922b3a) (thanks @Kaaaaii)
+
+## 3.36.0
+* [Support 1.20.80](https://github.com/PrismarineJS/bedrock-protocol/commit/bd32aa8d04555fa2fdc4ecd6abbeb6124e2ae8bb) (thanks @extremeheat)
+
+## 3.35.0
+* [Support 1.20.71](https://github.com/PrismarineJS/bedrock-protocol/commit/d8e707112acc038b6c9564d9a21b2f977326e47f) (thanks @extremeheat)
+* [Note `npm update` command in readme](https://github.com/PrismarineJS/bedrock-protocol/commit/ab93d0d0824bd0ace250fb73f703dc7b60ecd780) (thanks @extremeheat)
+
+## 3.34.0
+* [1.20.61 support (#480)](https://github.com/PrismarineJS/bedrock-protocol/commit/c278a03f952d23320b80f8c09b6372d41eeff26a) (thanks @extremeheat)
+* [Compressor handling update for 1.20.60 (#479)](https://github.com/PrismarineJS/bedrock-protocol/commit/d3161badc65f2eba4b6e7c9e974ca4e3529a7e94) (thanks @extremeheat)
+* [Update and rename CONTRIBUTING.md to docs/CONTRIBUTING.md (#475)](https://github.com/PrismarineJS/bedrock-protocol/commit/be6f0cde9f7970a4f9aa376c589c58d8cb4187c3) (thanks @extremeheat)
+* [Add flow and deviceType options to relay (#464)](https://github.com/PrismarineJS/bedrock-protocol/commit/842e66266f09e8670a644a618d0ac4157746cd43) (thanks @GameParrot)
+
+## 3.33.1
+* [Fix zigzag type move in prismarine-nbt (#471)](https://github.com/PrismarineJS/bedrock-protocol/commit/7b74cbf7129646adc80d50304afce6240848cfae) (thanks @extremeheat)
+
+## 3.33.0
+* [1.20.50 (#466)](https://github.com/PrismarineJS/bedrock-protocol/commit/d53211c6a1fe5f941ce547886ad6ec031ae05d9d) (thanks @extremeheat)
+* [Add 1.20.30 and 1.20.40 to index.d.ts (#461)](https://github.com/PrismarineJS/bedrock-protocol/commit/2ecf01d63e64b910b87f303fc4fb2b30f392cb28) (thanks @CreeperG16)
+
+## 3.32.0
+* [1.20.40 support (#459)](https://github.com/PrismarineJS/bedrock-protocol/commit/63eb673c1f30beb58f97e3b37295129000bf6a10) (thanks @CreeperG16)
+* [Update Minecraft wiki link to new domain (#455)](https://github.com/PrismarineJS/bedrock-protocol/commit/689658c4ab1ccb3ef1ae812d78d090212b1acf3f) (thanks @Spongecade)
+
+## 3.31.0
+* [1.20.30](https://github.com/PrismarineJS/bedrock-protocol/commit/22502b90fdc29f6327239c6c201370c8f839c892) (thanks @extremeheat)
+* [Add links field to server resource_packs_info](https://github.com/PrismarineJS/bedrock-protocol/commit/f92db61c89851dfbdbc906f926fc1433162854d0) (thanks @extremeheat)
+* [Update API.md (#448)](https://github.com/PrismarineJS/bedrock-protocol/commit/8f3b6c5aecf24d6f8d235afe2a9d911840e6a3f8) (thanks @Laamy)
+
+## 3.30.1
+* [Update Mojang public key used for logins (#443)](https://github.com/PrismarineJS/bedrock-protocol/commit/f0f1351d40966192e38ee9fe21b7c37754abba04) (thanks @GameParrot)
+* [index.d.ts: Fixed a typo (#441)](https://github.com/PrismarineJS/bedrock-protocol/commit/2c00402a9e9a0a283e712bf4f52190a57ea12c3f) (thanks @kotinash)
+* [Mark `listen` and `close` as async (#440)](https://github.com/PrismarineJS/bedrock-protocol/commit/50cd489f6e16fa6fe04b1825617d8246bd3935f4) (thanks @MrSterdy)
+* [Stop disconnecting when upstream packet deserialization fails (#435)](https://github.com/PrismarineJS/bedrock-protocol/commit/141442057464b3247ace8468863f27a3c334306e) (thanks @MrSterdy)
+* [Add 1.20.0 and 1.20.10 to index.d.ts (#431)](https://github.com/PrismarineJS/bedrock-protocol/commit/010d57e78a9130c612e48db7a32f841de83e9c68) (thanks @CreeperG16)
+
+## 3.30.0
+* 1.20.10 support (thanks @CreeperG16)
+* [Fix upstream relay batchingInterval (#425)](https://github.com/PrismarineJS/bedrock-protocol/commit/b2c141c25f3fad9641644742b6cc1a71bc601d61) (thanks @GameParrot)
+
+## 3.29.1
+* Add missing data to client login user chain (#420)
+* Add FAQ entry and replit warning on client ping error (#415)
+* Types: Fix Relay authTitle type (#418)
+
+## 3.29.0
+* 1.20.0 support
+
+## 3.28.1
+* Fix `followPort` option (@LucienHH)
+* Typescript definition fixes (@hvlxh)
+
+## 3.28.0
+* 1.19.80 support
+
+## 3.27.1
+* Fix `raknetBackend` option not being applied correctly
+
+## 3.27.0
+* Corrections to types (@stevarino)
+* Expose ServerAdvertisement class (#368) @hvlxh
+* Update mc-data links
+
+## 3.26.0
+* 1.19.70 support (@CreeperG16)
+* types: add some type hints (#354) @hvlxh
+
+## 3.25.0
+* 1.19.63 support (@stevarino)
+* Add close packet in server player API doc (#347) @hvlxh
+
+## 3.24.0
+* 1.19.62 support (@CreeperG16)
+
+## 3.23.0
+* 1.19.60 support (@CreeperG16)
+* added onMsaCode, profilesFolder to ClientOptions (@jarco-dev)
+
+## 3.22.0
+* 1.19.50 support (@WillQizza)
+
+## 3.21.0
+* 1.19.40 support (#314)
+* types: Fix missing field in ServerAdvertisement (#313) (@minerj101)
+
+## 3.20.1
+* Fix buffer length calculation in ServerAdvertisement (#292) (thanks @KurtThiemann)
+* Handle Relay serialization errors by kicking (#290)
+
+## 3.20.0
+* Preliminary 1.19.30 support, improve error handling and server pong data (#284)
+
+## 3.19.0
+* Add option for port redirection, fix Realm handling (#282)
+* Add Port Redirect Functionality (#278) @stevarino
+* Add Get-AppxPackage command to FAQ.md (#276) @stevarino
+* Remove viewer example
+
+## 3.18.0
+* 1.19.21 support (#266)
+
+## 3.17.0
+* relay: Add multi-user login support (#258)
+* Add fields from 1.19.20 to login chain data (#259) @CleSucre
+* Fix nbt encoding size on single null tag NBT (#264)
+* test: Add -u flag unzipping vanilla server (#262)
+
+## 3.16.0
+* 1.19.20 support (#251)
+* Add new raknet library option (raknet-node) (#211) @b23r0
+
+## 3.15.0
+* 1.19.10 support
+* Remove Realm fetch when joining via invite (#228) @LucienHH
+* Add Realm support to Relay (#226) @ATXLtheAxolotl
+
+## 3.14.0
+* 1.19 support
+* Better handle ping timeout, update documentation (#218) @stevarino
+
+## 3.13.0
+* Update API documentation
+* Emit generic 'packet' event for server clients (#205) @ATXLtheAxolotl
+* Add XUID field for client offline mode client chain (#203)
+
+## 3.12.0
+* 1.18.30 support
+
+## 3.11.1
+* Bump minecraft-data version
+
+## 3.11.0
+* Implement Realm joining (#193) @LucienHH
+* Refactor client connection sequence (#189) @extremeheat
+* Add profilesFolder to Relay (#192) @CreeperG16
+* Emit error from relay when server can't be pinged (#191)
+* Pass relay onMsaCode to client (#190) @Heath123
+* Mark raknet-native as required dependency (#188)
+* Ignore unconnected packets, remove babel (#185)
+
+## 3.10.0
+* Support 1.18.11 (#179) @extremeheat
+* Switch to sync zlib with 512k chunks, adjustable compression level (#174) @extremeheat
+
+## 3.9.0
+* Proxy fixes, logging and doc updates [#169](https://github.com/PrismarineJS/bedrock-protocol/pull/169)
+
+## 3.8.0
+* 1.18.0 support
+
+## 3.7.0
+* 1.17.40 support
+
+## 3.6.0
+* 1.17.30 support
+* minecraft-data used for protocol data
+
+## 3.5.1
+* Fix 1.17.10 npc packet serialization (#119)
+
+## 3.5.0
+* Add 1.17.10 support [#109](https://github.com/PrismarineJS/bedrock-protocol/pull/109)
+* You can switch to the JS implementation of raknet by setting `useNativeRaknet: false` in options.
+
+## 3.4.0
+* Initial 1.17 support [#99](https://github.com/PrismarineJS/bedrock-protocol/pull/99)
+* update connect version based on ping response & fix typings (u9g) [#101](https://github.com/PrismarineJS/bedrock-protocol/pull/101)
+* fix: ping types. (JammSpread) [#100](https://github.com/PrismarineJS/bedrock-protocol/pull/100)
+
+## 3.3.0
+* Protocol updates for 1.16, with some minor breaking changes to protocol fields [#95](https://github.com/PrismarineJS/bedrock-protocol/pull/95)
+* Fix npm install issues
+
+## 3.2.1
+* Add `authTitle` option to Relay proxy [#92](https://github.com/PrismarineJS/bedrock-protocol/pull/92)
+* Protocol, type definition fixes
+
## 3.2.0
-* Fix empty chunks on proxy spawn (#89)
-* Send skin data to server (#88)
-* Support xbox title + live.com auth (#86)
+* Fix empty chunks on proxy spawn [#89](https://github.com/PrismarineJS/bedrock-protocol/pull/89)
+* Send skin data to server [#88](https://github.com/PrismarineJS/bedrock-protocol/pull/88)
+* Support xbox title + live.com auth [#86](https://github.com/PrismarineJS/bedrock-protocol/pull/86)
* Protocol updates and fixes
-* Fix third party servers, optional client encryption (#83)
+* Fix third party servers, optional client encryption [#83](https://github.com/PrismarineJS/bedrock-protocol/pull/83)
## 3.1.0
* Add support for 1.16
diff --git a/README.md b/README.md
index 124f1b2..5e3add2 100644
--- a/README.md
+++ b/README.md
@@ -1,20 +1,20 @@
# bedrock-protocol
[](http://npmjs.com/package/bedrock-protocol)
[](https://github.com/PrismarineJS/bedrock-protocol/actions?query=workflow%3A%22CI%22)
-[](https://discord.gg/GsEFRM8)
[](https://gitpod.io/#https://github.com/PrismarineJS/bedrock-protocol)
+[](https://discord.gg/GsEFRM8)
-Minecraft Bedrock Edition (aka MCPE) protocol library, supporting authentication and encryption. Help [contribute](CONTRIBUTING.md).
+Minecraft Bedrock Edition (aka MCPE) protocol library, supporting authentication and encryption. Help [contribute](docs/CONTRIBUTING.md).
-This is a work in progress. You can track the progress in https://github.com/PrismarineJS/bedrock-protocol/pull/34.
+[Protocol doc](https://prismarinejs.github.io/minecraft-data/?v=bedrock_1.19.10&d=protocol)
## Features
- - Supports Minecraft Bedrock version 1.16.201, 1.16.210, 1.16.220
+ - Supports Minecraft Bedrock version 1.16.201, 1.16.210, 1.16.220, 1.17.0, 1.17.10, 1.17.30, 1.17.40, 1.18.0, 1.18.11, 1.18.30, 1.19.1, 1.19.10, 1.19.20, 1.19.21, 1.19.30, 1.19.40, 1.19.41, 1.19.50, 1.19.60, 1.19.62, 1.19.63, 1.19.70, 1.19.80, 1.20.0, 1.20.10, 1.20.30, 1.20.40, 1.20.50, 1.20.61, 1.20.71, 1.20.80, 1.21.0, 1.21.2, 1.21.21, 1.21.30, 1.21.42, 1.21.50, 1.21.60, 1.21.70, 1.21.80, 1.21.90, 1.21.93, 1.21.100, 1.21.111
- Parse and serialize packets as JavaScript objects
- Automatically respond to keep-alive packets
- - [Proxy and mitm connections](docs/API.md)
+ - [Proxy and mitm connections](docs/API.md#proxy-docs)
- Client
- Authentication
- Encryption
@@ -34,40 +34,55 @@ Want to contribute on something important for PrismarineJS ? go to https://githu
`npm install bedrock-protocol`
+To update bedrock-protocol (or any Node.js package) and its dependencies after a previous install, you must run `npm update --depth 9999`
+
## Usage
### Client example
+Example to connect to a server in offline mode, and relay chat messages back:
+
```js
const bedrock = require('bedrock-protocol')
const client = bedrock.createClient({
host: 'localhost', // optional
port: 19132, // optional, default 19132
username: 'Notch', // the username you want to join as, optional if online mode
- offline: true // optional, default false. if true, do not login with Xbox Live. You will not be asked to sign-in if set to true.
- // Optional for some servers which verify the title ID:
- // authTitle: bedrock.title.MinecraftNintendoSwitch
+ offline: true // optional, default false. if true, do not login with Xbox Live. You will not be asked to sign-in if set to true.
})
-client.on('text', (packet) => { // Listen for chat messages and echo them back.
- if (packet.source_name != client.options.username) {
+client.on('text', (packet) => { // Listen for chat messages from the server and echo them back.
+ if (packet.source_name != client.username) {
client.queue('text', {
- type: 'chat', needs_translation: false, source_name: client.username, xuid: '', platform_chat_id: '',
+ type: 'chat', needs_translation: false, source_name: client.username, xuid: '', platform_chat_id: '', filtered_message: '',
message: `${packet.source_name} said: ${packet.message} on ${new Date().toLocaleString()}`
})
}
})
```
+### Client example joining a Realm
+
+Example to connect to a Realm that the authenticating account is owner of or has been invited to:
+
+```js
+const bedrock = require('bedrock-protocol')
+const client = bedrock.createClient({
+ realms: {
+ pickRealm: (realms) => realms[0] // Function which recieves an array of joined/owned Realms and must return a single Realm. Can be async
+ }
+})
+```
+
### Server example
*Can't connect locally on Windows? See the [faq](docs/FAQ.md)*
```js
const bedrock = require('bedrock-protocol')
-const server = new bedrock.createServer({
+const server = bedrock.createServer({
host: '0.0.0.0', // optional. host to bind as.
port: 19132, // optional
- version: '1.16.220', // optional. The server version, latest if not specified.
+ version: '1.17.10', // optional. The server version, latest if not specified.
})
server.on('connect', client => {
@@ -89,11 +104,11 @@ ping({ host: 'play.cubecraft.net', port: 19132 }).then(res => {
## Documentation
-For documentation on the protocol, and packets/fields see the [proto.yml](data/latest/proto.yml) and [types.yml](data/latest/proto.yml) files.
+For documentation on the protocol, and packets/fields see the [protocol documentation](https://prismarinejs.github.io/minecraft-data/protocol).
-See [API documentation](docs/API.md)
+* See [API documentation](docs/API.md)
-See [faq](docs/FAQ.md)
+* See [frequently asked questions and answers](docs/FAQ.md)