Skip to content

Commit 43acab7

Browse files
Merge branch 'master' into pc-1_21_10
2 parents cb57fb5 + 1555cce commit 43acab7

File tree

100 files changed

+818662
-464
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+818662
-464
lines changed

.github/copilot-instructions.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ This will ensure all data matches schema among other checks.
3131

3232
There are no 'releases' in this repo beyond updating the data itself. Instead, we have a workflow that will automatically create tagged releases if the user runs the /makerelease slash command, so you can inform the user about that if a release is needed.
3333

34+
## Testing
35+
Always run tests after data changes to ensure local tests are passing:
36+
37+
```sh
38+
cd tools/js
39+
npm install
40+
npm test -- --bail 2>&1 | tail -100
41+
```
42+
3443
## Data
3544

3645
Most data is generated with data generators. For mcpc, data is generated with [minecraft-data-generator](https://github.com/PrismarineJS/minecraft-data-generator).
@@ -57,7 +66,28 @@ Not all data is generated. Some data (like protocol schemas) is manually curated
5766

5867
### Protocol data
5968

60-
We use a special yaml-like DSL to generate protocol.json files. Refer to doc/protocol.md for info.
61-
These files are stored inside proto.yml files in the latest/ folder (like bedrock/latest/proto.yml) for the latest version, otherwise in the versioned folder (like pc/1.20/proto.yml).
69+
We use a special YAML-like DSL to generate protocol.json files. Refer to doc/protocol.md for info.
70+
These files are stored inside proto.yml (and an imported types.yml support file on bedrock) files in the latest/ folder (like bedrock/latest/proto.yml) for the latest version, otherwise in the versioned folder (like pc/1.20/proto.yml).
71+
72+
👉 Run `npm run build` in tools/js to regenerate protocol.json files after making changes to the protocol yaml files.
73+
74+
❌ Don't make changes to protocol.json files directly. Instead, update the relevant proto.yml file in latest/ and regenerate protocol.json by running `npm run build` in tools/js.
75+
76+
If you need to edit many files at once, consider writing a simple Node.js script to replace. E.g., from `cd tools/js && npm i && node __replace_something.js`):
77+
```js
78+
const cp = require('child_process')
79+
const fs = require('fs')
80+
const glob = require('glob')
81+
const pcVersionsOrdered = require('../../data/pc/common/versions.json')
82+
const after1_20_5 = pcVersionsOrdered.slice(pcVersionsOrdered.indexOf('1.20.5')) // everything after 1.20.5...
83+
for (const version of pcVersionsOrdered) {
84+
// globSync, fs.readFileSync...fs.writeFileSync ; avoid async
85+
}
86+
```
87+
88+
When updating, apply minimum required changes when possible.
6289

63-
Notably, run `npm run build` in tools/js to regenerate protocol.json files after making changes to the protocol yaml files. So, don't make changes to protocol.json files directly. Instead, update the relevant proto.yml file in latest/ and regenerate protocol.json by running `npm run build` in tools/js.
90+
1. Do not rename fields or packets unless their value has changed, even if they may have 'officially' changed. If their values *have* significantly changed (varint -> i32 maybe insignificant from primitive standpoint, string to number is), it maybe a good idea to rename the field or packet.
91+
2. Do not rename existing enums or other data, even if they were renamed in the game. You may add or remove data as is needed as this does not unnecessarily affect existing code relying on old names.
92+
3. Always read the information in doc/protocol.md to understand our YAML format.
93+
4. Try to inline types as much as possible--this includes mappers and switch statements. Don't create extra types unless they are actually re-used in multiple places, or very large to warrant seperation.

.github/helper-bot/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ async function createInitialPR (edition, issueUrl, { version, protocolVersion })
1818
if (protocolVersion) exec(pm, ['run', 'version', edition, version, protocolVersion], { cwd: toolsJs })
1919
exec(pm, ['run', 'build'], { cwd: toolsJs })
2020
const branchNameVersion = sanitizeBranch(version)
21-
const branchName = `${edition}-${branchNameVersion}`
21+
const branchName = `${edition}_${branchNameVersion}`
2222
const title = `🎈 Add Minecraft ${edition} ${version} data`
2323
// First, delete any existing branch
2424
try {
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Bedrock Version Bump
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
minecraftVersion:
7+
description: 'Bedrock Minecraft version (e.g., 1.21.124)'
8+
required: true
9+
type: string
10+
protocolVersion:
11+
description: 'Protocol version number (e.g., 860)'
12+
required: true
13+
type: string
14+
createPr:
15+
description: 'Create a pull request with the changes'
16+
required: false
17+
type: boolean
18+
default: true
19+
20+
jobs:
21+
bump-bedrock-version:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
token: ${{ secrets.PAT_PASSWORD || secrets.GITHUB_TOKEN }}
28+
29+
- name: Set up Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: 22
33+
34+
- name: Install dependencies
35+
run: |
36+
cd tools/js
37+
npm install
38+
39+
- name: Run version bump script
40+
run: |
41+
cd tools/js
42+
npm run version bedrock ${{ github.event.inputs.minecraftVersion }} ${{ github.event.inputs.protocolVersion }}
43+
44+
- name: Build protocol files
45+
run: |
46+
cd tools/js
47+
npm run build
48+
49+
- name: Run tests
50+
run: |
51+
cd tools/js
52+
npm test
53+
54+
- name: Create Pull Request
55+
if: ${{ github.event.inputs.createPr == 'true' }}
56+
uses: peter-evans/create-pull-request@v6
57+
with:
58+
token: ${{ secrets.PAT_PASSWORD || secrets.GITHUB_TOKEN }}
59+
commit-message: |
60+
Add bedrock ${{ github.event.inputs.minecraftVersion }} protocol data
61+
62+
Updates:
63+
- Protocol version → ${{ github.event.inputs.protocolVersion }}
64+
- Minecraft version → ${{ github.event.inputs.minecraftVersion }}
65+
- Moved previous proto.yml to versioned folder
66+
- Updated protocolVersions.json, versions.json, and dataPaths.json
67+
- Regenerated protocol.json files
68+
branch: bedrock-bump-${{ github.event.inputs.minecraftVersion }}
69+
delete-branch: true
70+
title: Add bedrock ${{ github.event.inputs.minecraftVersion }} data
71+
body: |
72+
## Bedrock Version Bump
73+
74+
This PR adds support for Minecraft Bedrock Edition version **${{ github.event.inputs.minecraftVersion }}** with protocol version **${{ github.event.inputs.protocolVersion }}**.
75+
76+
### Changes
77+
- ✅ Protocol version bumped to ${{ github.event.inputs.protocolVersion }}
78+
- ✅ Minecraft version updated to ${{ github.event.inputs.minecraftVersion }}
79+
- ✅ Previous proto.yml files moved to versioned folder
80+
- ✅ Updated protocolVersions.json and versions.json
81+
- ✅ Regenerated all protocol.json files
82+
- ✅ All tests passing
83+
84+
### How this was generated
85+
This PR was automatically generated using the bedrock version bump workflow.
86+
87+
---
88+
🤖 Generated by GitHub Actions workflow
89+
labels: |
90+
bedrock
91+
version-bump
92+
automated

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Supports
1111
* Minecraft PC version 0.30c (classic), 1.7.10, 1.8.8, 1.9 (15w40b, 1.9, 1.9.1-pre2, 1.9.2, 1.9.4),
1212
1.10 (16w20a, 1.10-pre1, 1.10, 1.10.1, 1.10.2), 1.11 (16w35a, 1.11, 1.11.2), 1.12 (17w15a, 17w18b, 1.12-pre4, 1.12, 1.12.1, 1.12.2), 1.13 (17w50a, 1.13, 1.13.1, 1.13.2-pre1, 1.13.2-pre2, 1.13.2), 1.14 (1.14, 1.14.1, 1.14.3, 1.14.4), 1.15 (1.15, 1.15.1, 1.15.2), 1.16 (20w13b, 20w14a, 1.16-rc1, 1.16, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.16.5), 1.17, 1.17.1, 1.18 (1.18, 1.18.1, 1.18.2), 1.19 (1.19, 1.19.2, 1.19.3, 1.19.4), 1.20 (1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4, 1.20.5, 1.20.6), 1.21 (1.21, 1.21.1, 1.21.3), 1.21.8
1313
<!--NEXT PC-->
14-
* Minecraft bedrock version 0.14, 0.15, 1.0, 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.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.20, 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
14+
* Minecraft bedrock version 0.14, 0.15, 1.0, 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.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.20, 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, 1.21.120, 1.21.124, 1.21.130
1515
<!--NEXT BEDROCK-->
1616

1717
## Wrappers

data/bedrock/1.16.201/proto.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ packet_available_commands:
13151315
# If the values_len < 0xff => byte
13161316
# If the values_len < 0xffff => short
13171317
# If the values_len < 0xffffff => int
1318-
_enum_type: '["enum_size_based_on_values_len"]'
1318+
_enum_type: ["enum_size_based_on_values_len"]
13191319
# Here all the enum values for all of the possible commands are stored to one array palette
13201320
enum_values: string[]$values_len
13211321
# Integer parameters may sometimes have a prefix, such as the XP command:

data/bedrock/1.16.210/proto.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1354,7 +1354,7 @@ packet_available_commands:
13541354
# If the values_len < 0xff => byte
13551355
# If the values_len < 0xffff => short
13561356
# If the values_len < 0xffffff => int
1357-
_enum_type: '["enum_size_based_on_values_len"]'
1357+
_enum_type: ["enum_size_based_on_values_len"]
13581358
# Here all the enum values for all of the possible commands are stored to one array palette
13591359
enum_values: string[]$values_len
13601360
# Integer parameters may sometimes have a prefix, such as the XP command:

data/bedrock/1.16.220/proto.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1487,7 +1487,7 @@ packet_available_commands:
14871487
# If the values_len < 0xff => byte,
14881488
# If the values_len < 0xffff => short,
14891489
# If the values_len < 0xffffff => int
1490-
_enum_type: '["enum_size_based_on_values_len"]'
1490+
_enum_type: ["enum_size_based_on_values_len"]
14911491
# Here all the enum values for all of the possible commands are stored to one array palette
14921492
enum_values: string[]$values_len
14931493
# Integer parameters may sometimes have a prefix, such as the XP command:

data/bedrock/1.17.0/proto.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1489,7 +1489,7 @@ packet_available_commands:
14891489
# If the values_len < 0xff => byte,
14901490
# If the values_len < 0xffff => short,
14911491
# If the values_len < 0xffffff => int
1492-
_enum_type: '["enum_size_based_on_values_len"]'
1492+
_enum_type: ["enum_size_based_on_values_len"]
14931493
# Here all the enum values for all of the possible commands are stored to one array palette
14941494
enum_values: string[]$values_len
14951495
# Integer parameters may sometimes have a prefix, such as the XP command:

data/bedrock/1.17.10/proto.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,7 @@ packet_available_commands:
15721572
# If the values_len < 0xff => byte,
15731573
# If the values_len < 0xffff => short,
15741574
# If the values_len < 0xffffff => int
1575-
_enum_type: '["enum_size_based_on_values_len"]'
1575+
_enum_type: ["enum_size_based_on_values_len"]
15761576
# Here all the enum values for all of the possible commands are stored to one array palette
15771577
enum_values: string[]$values_len
15781578
# Integer parameters may sometimes have a prefix, such as the XP command:

data/bedrock/1.17.30/proto.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,7 @@ packet_available_commands:
15841584
# If the values_len < 0xff => byte,
15851585
# If the values_len < 0xffff => short,
15861586
# If the values_len < 0xffffff => int
1587-
_enum_type: '["enum_size_based_on_values_len"]'
1587+
_enum_type: ["enum_size_based_on_values_len"]
15881588
# Here all the enum values for all of the possible commands are stored to one array palette
15891589
enum_values: string[]$values_len
15901590
# Integer parameters may sometimes have a prefix, such as the XP command:

0 commit comments

Comments
 (0)