mirror of
https://github.com/barkeser2002/minecraft-data.git
synced 2026-11-24 04:46:14 +03:00
* 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>
127 lines
4.5 KiB
JavaScript
127 lines
4.5 KiB
JavaScript
const fs = require('fs')
|
|
const { join } = require('path')
|
|
|
|
const rootPath = join(__dirname, '..', '..')
|
|
const data = join(__dirname, '..', '..', 'data')
|
|
|
|
function getJSON (path) {
|
|
return JSON.parse(fs.readFileSync(path, 'utf-8'))
|
|
}
|
|
|
|
function writeJSON (path, data) {
|
|
fs.writeFileSync(path, JSON.stringify(data, null, 2), 'utf-8')
|
|
}
|
|
|
|
// Reads and updates the JSON after processing in callback
|
|
function alterJSON (path, callback) {
|
|
const jsonContents = getJSON(path)
|
|
if (callback(jsonContents) !== false) {
|
|
writeJSON(path, jsonContents)
|
|
}
|
|
}
|
|
|
|
function bumpReadmeVersion (edition, version) {
|
|
const readmePath = join(rootPath, 'README.md')
|
|
let readmeContents = fs.readFileSync(readmePath, 'utf-8')
|
|
if (!readmeContents.includes(version)) {
|
|
if (edition === 'pc') readmeContents = readmeContents.replace('\n<!--NEXT PC-->', `, ${version}\n<!--NEXT PC-->`)
|
|
if (edition === 'bedrock') readmeContents = readmeContents.replace('\n<!--NEXT BEDROCK-->', `, ${version}\n<!--NEXT BEDROCK-->`)
|
|
}
|
|
fs.writeFileSync(readmePath, readmeContents, 'utf-8')
|
|
}
|
|
|
|
function updateProtocol (edition, version, protocolVersionNumber) {
|
|
const dataRoot = join(data, edition)
|
|
const protocolVersionsPath = join(dataRoot, 'common', 'protocolVersions.json')
|
|
const versionsPath = join(dataRoot, 'common', 'versions.json')
|
|
const versionPath = join(dataRoot, version, 'version.json')
|
|
|
|
const protocolVersionsEntry = {
|
|
version: parseInt(protocolVersionNumber),
|
|
minecraftVersion: version,
|
|
majorVersion: version.split('.').slice(0, 2).join('.'),
|
|
releaseType: 'release'
|
|
}
|
|
|
|
let didUpdateProtocol = false
|
|
|
|
// Move the latest/proto.yml to its associated folder defined in the !version meta field
|
|
const latestProtoPath = join(dataRoot, 'latest', 'proto.yml')
|
|
const protoYml = fs.readFileSync(latestProtoPath, 'utf-8')
|
|
const oldProtoVersion = protoYml.match(/!version: ([0-9.]+)/)[1]
|
|
// Check if $oldVersion/proto.yml already exists
|
|
const oldProtoPath = join(dataRoot, oldProtoVersion, 'proto.yml')
|
|
if (fs.existsSync(oldProtoPath)) {
|
|
console.log(`Can't move ${latestProtoPath} to ${oldProtoPath} because the file already exists.`)
|
|
} else {
|
|
fs.copyFileSync(latestProtoPath, oldProtoPath)
|
|
if (edition === 'bedrock') {
|
|
fs.copyFileSync(join(dataRoot, 'latest', 'types.yml'), join(dataRoot, oldProtoVersion, 'types.yml'))
|
|
}
|
|
didUpdateProtocol = true
|
|
// Update references to the old version in the dataPaths.json file
|
|
alterJSON(join(data, 'dataPaths.json'), dataPaths => {
|
|
let latestVersionData
|
|
for (const v in dataPaths[edition]) {
|
|
const e = dataPaths[edition][v]
|
|
// if .proto points to latest, update it to the old version
|
|
if (e.proto === `${edition}/latest`) {
|
|
e.proto = `${edition}/${oldProtoVersion}`
|
|
}
|
|
latestVersionData = structuredClone(e) // eslint-disable-line
|
|
}
|
|
if (!dataPaths[edition][version]) {
|
|
dataPaths[edition][version] = latestVersionData
|
|
}
|
|
latestVersionData.proto = `${edition}/latest`
|
|
latestVersionData.protocol = `${edition}/${version}`
|
|
latestVersionData.version = `${edition}/${version}`
|
|
})
|
|
}
|
|
|
|
// Update commons/protocolVersions.json (pc does this auto with cron)
|
|
alterJSON(protocolVersionsPath, protoVers => {
|
|
if (!protoVers.find(v => v.version === protocolVersionsEntry.version)) {
|
|
protoVers.unshift(protocolVersionsEntry)
|
|
}
|
|
})
|
|
// Update commons/version.json
|
|
alterJSON(versionsPath, versions => {
|
|
if (!versions.includes(version)) {
|
|
versions.push(version)
|
|
}
|
|
})
|
|
|
|
// Update the $version/version.json file
|
|
fs.mkdirSync(join(dataRoot, version), { recursive: true })
|
|
if (!fs.existsSync(versionPath)) {
|
|
writeJSON(versionPath, protocolVersionsEntry)
|
|
}
|
|
|
|
// Update the '!version' meta field in the latest/proto.yml
|
|
if (didUpdateProtocol) {
|
|
const protoYmlUpdate = protoYml.replace(/!version: [0-9.]+/, `!version: ${version}`)
|
|
fs.writeFileSync(join(dataRoot, 'latest', 'proto.yml'), protoYmlUpdate, 'utf-8')
|
|
}
|
|
}
|
|
|
|
const platforms = {
|
|
bedrock: updateProtocol,
|
|
pc: updateProtocol
|
|
}
|
|
|
|
if (process.argv.length !== 5) {
|
|
console.log(`Usage: npm run version <${Object.keys(platforms).join('|')}> {version} {protocol_version}`)
|
|
process.exit(1)
|
|
}
|
|
|
|
const [,, platform, version, protocol] = process.argv
|
|
|
|
if (platforms[platform] === undefined) {
|
|
console.log(`Received platform "${platform}", expected one of (${Object.keys(platforms).join(', ')})`)
|
|
process.exit(1)
|
|
}
|
|
|
|
platforms[platform](platform, version, protocol)
|
|
bumpReadmeVersion(platform, version)
|