Files
T
09821c14cc Update proto.yml for Minecraft 1.21.6 (#1039)
* Update proto.yml for Minecraft 1.21.6

Add support for new dialog system and waypoint tracking features introduced in 1.21.6:

## New Features Added:
- Dialog system with interactive buttons and warning screens
- Waypoint tracking system with operations (track/untrack/update)
- Custom click actions for enhanced UI interactions
- Game mode change functionality

## New Packets:
### Client-bound (Server → Client):
- packet_show_dialog: Display interactive dialogs
- packet_clear_dialog: Dismiss current dialog
- packet_waypoint: Manage tracked waypoints

### Server-bound (Client → Server):
- packet_custom_click_action: Handle dialog interactions
- packet_change_game_mode: Request game mode changes

## New Types:
- Dialog, DialogButton, DialogButtonAction: Dialog system structures
- TrackedWaypoint, WaypointOperation: Waypoint system structures

All packets properly integrated into play state with correct packet IDs and mappings.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix packet ordering based on Java diff analysis

- Move SERVERBOUND_CHANGE_GAME_MODE between set_difficulty and message_acknowledgement
- Move CLIENTBOUND_WAYPOINT, CLIENTBOUND_CLEAR_DIALOG, CLIENTBOUND_SHOW_DIALOG after server_links
- Move SERVERBOUND_CUSTOM_CLICK_ACTION to end of serverbound packet list

This ensures packet IDs match Minecraft's protocol registration order from 1.21.6 source.

* Complete minecraft-data 1.21.6 update with protocol compilation

Add missing components for proper minecraft-data structure:

- data/pc/1.21.5/proto.yml: Copy of previous version proto.yml for 1.21.5
- data/pc/1.21.6/protocol.json: Compiled protocol from new 1.21.6 proto.yml

This follows the standard minecraft-data update workflow:
1. Preserve old version proto.yml in versioned directory
2. Update latest proto.yml with new version features
3. Compile protocol.json from updated proto.yml

Generated using tools/js/compileProtocol.js build process.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix dataPaths.json protocol paths for 1.21.6

Update 1.21.6 entry to point to correct protocol files:
- protocol: pc/1.21.5 → pc/1.21.6 (use new generated protocol.json)
- proto: pc/latest → pc/1.21.6 (use versioned proto.yml)

This ensures minecraft-data correctly resolves protocol definitions for 1.21.6
instead of falling back to 1.21.5 or latest versions.

Required for proper protocol loading and compatibility testing.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Update dataPaths.json

* Update dataPaths.json

* 1.21.5 SlotComponent fixe

* 1.21.6 protocol updates

* update

* fix

* Update dataPaths.json for 1.21.6->5 entities

* Add entityActionUsesStringMapper feature for 1.21.6

This feature indicates when the entity_action packet uses string mappings
instead of numeric actionId values, which was introduced in Minecraft 1.21.6.

* fix tracked_waypoint

* 1.21.6 entity metadataKeys

* fix packet_teams duplicate field

* Fix declare_commands packet parsing for 1.21.6

Missing minecraft:resource in parser condition caused registry field
to be skipped, leading to buffer misalignment and parsing failures.

Added minecraft:resource back to the condition:
if minecraft:resource_or_tag or minecraft:resource_or_tag_key or minecraft:resource or minecraft:resource_key or minecraft:resource_selector

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* add workflow dispatch to mcdata-generator

* fix readme updater

* apply packet_entity_action and packet_game_state_change changes to all pc versions

* Revert "apply packet_entity_action and packet_game_state_change changes to all pc versions"

This reverts commit af0800b6d4ef6d69f16394ae4310f379eb30dee6.

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: extremeheat <extreme@protonmail.ch>
2025-08-17 22:39:09 +02:00

194 lines
8.0 KiB
JavaScript

const fs = require('fs')
const cp = require('child_process')
const github = require('gh-helpers')()
const exec = (cmd) => github.mock ? console.log('> ', cmd) : (console.log('> ', cmd), cp.execSync(cmd, { stdio: 'inherit' }))
const pcManifestURL = 'https://launchermeta.mojang.com/mc/game/version_manifest.json'
const changelogURL = 'https://feedback.minecraft.net/hc/en-us/sections/360001186971-Release-Changelogs'
const download = (url, dest) => exec(`curl -L ${url} -o ${dest}`)
function buildFirstIssue (title, result, jarData) {
const protocolVersion = jarData?.protocol_version || 'Failed to obtain from JAR'
const name = jarData?.name || result.id
const date = result.releaseTime
return {
title,
body: `
A new Minecraft Java Edition version is available (as of ${date}), version **${result.id}**
## Official Changelog
* ${changelogURL}
## Protocol Details
(I will close this issue automatically if "${result.id}" is added to data/pc/common/versions.json on "master")
<table>
<tr><td><b>Name</b></td><td>${name}</td>
<tr><td><b>Protocol ID</b></td><td>${protocolVersion}</td>
<tr><td><b>Release Date</b></td><td>${date}</td>
<tr><td><b>Release Type</b></td><td>${result.type}</td>
<tr><td><b>Data Version</b></td><td>${jarData?.world_version}</td>
<tr><td><b>Java Version</b></td><td>${jarData?.java_version}</td>
</table>
<hr/>
🤖 I am a bot, I check for updates every 2 hours without a trigger. You can close this issue to prevent any further updates.
`
}
}
async function createInitialPull (edition, issueUrl, { version, protocolVersion }) {
exec('cd tools/js && npm install')
exec(`cd tools/js && npm run version ${edition} ${version} ${protocolVersion}`)
const branchNameVersion = version.replace(/[^a-zA-Z0-9]/g, '.').toLowerCase()
const branchName = `${edition}-${branchNameVersion}`
const title = `Initial data for ${edition} ${version}`
exec(`git checkout -b ${branchName}`)
exec(`git add --all`)
exec(`git commit -m "${title}"`)
exec(`git push origin ${branchName}`)
// createPullRequest(title: string, body: string, fromBranch: string, intoBranch?: string): Promise<{ number: number, url: string }>;
const pr = await github.createPullRequest(title, `${title}.\n\nRef: ${issueUrl}`, branchName, 'master')
return pr
}
const protocolVersions = {
pc: require('../../data/pc/common/protocolVersions.json'),
bedrock: require('../../data/bedrock/common/protocolVersions.json')
}
const supportedVersions = {
pc: require('../../data/pc/common/versions.json'),
bedrock: require('../../data/bedrock/common/versions.json')
}
async function updateManifestPC () {
const manifest = await fetch(pcManifestURL).then(res => res.json())
// fs.writeFileSync('./manifest.json', JSON.stringify(manifest, null, 2))
const knownVersions = protocolVersions.pc.reduce((acc, cur) => (acc[cur.minecraftVersion] = cur, acc), {})
const latestVersion = manifest.latest.snapshot
const latestVersionData = manifest.versions.find(v => v.id === latestVersion)
const latestVersionIsSnapshot = latestVersionData.type !== 'release'
const title = `Support Minecraft PC ${latestVersion}`
const issueStatus = await github.findIssue({ titleIncludes: title }) || {}
if (latestVersionIsSnapshot) {
// don't make issues for snapshots
if (supportedVersions.pc.includes(latestVersion) || knownVersions[latestVersion]) {
console.log('Latest version is a known snapshot, no work to do')
return
}
} else {
if (supportedVersions.pc.includes(latestVersion)) {
if (issueStatus.isOpen) {
github.close(issueStatus.id, `Closing as PC ${latestVersion} is now supported`)
}
console.log('Latest PC version is supported.')
return
} else if (knownVersions[latestVersion]) {
console.log(`Latest PC version ${latestVersion} is known in protocolVersions.json, but not in versions.json (protocol version ${knownVersions[latestVersion].version})`)
return
} else {
console.log(`Latest PC version ${latestVersion} is not known in protocolVersions.json, adding and making issue`)
}
}
let versionJson
try {
versionJson = await addEntryFor(latestVersion, latestVersionData)
} catch (e) {
console.error(e)
if (latestVersionIsSnapshot) {
console.warn('Failed to update protocolVersions.json for the snapshot', latestVersion)
} else {
console.log('Latest PC version is not supported and we failed to load data. Opening issue...')
const issuePayload = buildFirstIssue(title, latestVersionData)
github.createIssue(issuePayload)
fs.writeFileSync('./issue.md', issuePayload.body)
console.log('OK, wrote to ./issue.md', issuePayload)
}
}
if (!latestVersionIsSnapshot && !issueStatus.isOpen && !issueStatus.isClosed) {
console.log('Opening issue', versionJson)
const issuePayload = buildFirstIssue(title, latestVersionData, versionJson)
const issue = await github.createIssue(issuePayload)
fs.writeFileSync('./issue.md', issuePayload.body)
console.log('Created issue', issue)
// Now create an initial PR with the new version data
const pr = await createInitialPull('pc', issue.url, {
minecraftVersion: versionJson.id,
version: latestVersion,
protocolVersion: versionJson.protocol_version
})
console.log('Created PR', pr)
// Ask minecraft-data-generator to handle new update
const dispatchPayload = {
owner: 'PrismarineJS',
repo: 'minecraft-data-generator',
workflow: 'handle-mcdata-update.yml',
branch: 'main',
inputs: {
version: latestVersion
}
}
console.log('Sending workflow dispatch', dispatchPayload)
await github.sendWorkflowDispatch(dispatchPayload)
}
async function addEntryFor (releaseVersion, releaseData) {
const latestReleaseManifest = await fetch(releaseData.url).then(res => res.json())
// Download client jar
if (!fs.existsSync(`./${releaseVersion}.jar`)) {
const clientJarUrl = latestReleaseManifest.downloads.client.url
console.log('Downloading client jar', clientJarUrl)
download(clientJarUrl, `./${releaseVersion}.jar`)
}
// Log the byte size of the client jar
const clientJarSize = fs.statSync(`./${releaseVersion}.jar`).size
console.log(`Downloaded client jar ${releaseVersion}.jar (${clientJarSize} bytes), extracting its version.json...`)
// unzip with tar / unzip, Actions image uses 7z
if (process.platform === 'win32') cp.execSync(`tar -xf ./${releaseVersion}.jar version.json`)
else cp.execSync(`7z -y e ./${releaseVersion}.jar version.json`, { stdio: 'inherit' })
const versionJson = require('./version.json')
let majorVersion
if (versionJson.id && versionJson.id.includes('.')) {
majorVersion = versionJson.id.split('.', 2).join('.')
} else {
console.error(`Version '${versionJson.id}' appears to be a snapshot (no dot in name). Using the last known majorVersion in protocolVersions.json for this version (may be incorrect)`)
majorVersion = protocolVersions.pc[0].majorVersion
}
const newEntry = {
minecraftVersion: versionJson.id,
version: versionJson.protocol_version,
dataVersion: versionJson.world_version,
usesNetty: true,
majorVersion,
releaseType: latestVersionData.type
}
console.log('Adding new entry to pc protocolVersions.json', newEntry)
const updatedProtocolVersions = [newEntry, ...protocolVersions.pc]
fs.writeFileSync('../../data/pc/common/protocolVersions.json', JSON.stringify(updatedProtocolVersions, null, 2))
if (process.env.CI) {
console.log('Committing changes to protocolVersions.json')
// https://github.com/actions/checkout/pull/1184
cp.execSync('git config user.name "github-actions[bot]"')
cp.execSync('git config user.email "41898282+github-actions[bot]@users.noreply.github.com"')
cp.execSync('git add ../../data/pc/common/protocolVersions.json')
cp.execSync(`git commit -m "Add ${versionJson.id} to pc protocolVersions.json"`)
cp.execSync('git push')
}
return versionJson
}
}
updateManifestPC()