minecraft-data
Advanced tools
Comparing version 3.44.0 to 3.45.0
# History | ||
## 3.45.0 | ||
* update `minecraft-data` | ||
## 3.44.0 | ||
@@ -4,0 +8,0 @@ |
const fs = require('fs') | ||
const cp = require('child_process') | ||
const https = require('https') | ||
const helper = require('./github-helper') | ||
@@ -8,20 +7,2 @@ const pcManifestURL = 'https://launchermeta.mojang.com/mc/game/version_manifest.json' | ||
// this is a polyfill for node <18 | ||
const fetch = globalThis.fetch || function (url) { | ||
return new Promise((resolve, reject) => { | ||
https.get(url, (res) => { | ||
let data = '' | ||
res.on('data', (chunk) => { | ||
data += chunk | ||
}) | ||
res.on('end', () => { | ||
resolve({ | ||
ok: true, | ||
text: () => Promise.resolve(data), | ||
json: () => Promise.resolve(JSON.parse(data)) | ||
}) | ||
}) | ||
}).on('error', reject) | ||
}) | ||
} | ||
const download = (url, dest) => cp.execSync(`curl -L ${url} -o ${dest}`) | ||
@@ -69,39 +50,74 @@ | ||
const knownVersions = protocolVersions.pc.reduce((acc, cur) => (acc[cur.minecraftVersion] = cur, acc), {}) | ||
const latestRelease = manifest.latest.release | ||
const latestVersion = manifest.latest.snapshot | ||
const latestVersionData = manifest.versions.find(v => v.id === latestVersion) | ||
const latestVersionIsSnapshot = latestVersionData.type !== 'release' | ||
const title = `Support Minecraft PC ${latestRelease}` | ||
const title = `Support Minecraft PC ${latestVersion}` | ||
const issueStatus = await helper.getIssueStatus(title) | ||
if (supportedVersions.pc.includes(latestRelease)) { | ||
if (issueStatus.open) { | ||
helper.close(issueStatus.id, `Closing as PC ${latestRelease} is now supported`) | ||
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 | ||
} | ||
console.log('Latest PC version is supported.') | ||
return | ||
} else if (knownVersions[latestRelease]) { | ||
console.log(`Latest PC version ${latestRelease} is known in protocolVersions.json, but not in versions.json (protocol version ${knownVersions[latestRelease].version})`) | ||
return | ||
} else { | ||
console.log(`Latest PC version ${latestRelease} is not known in protocolVersions.json, adding and making issue`) | ||
if (supportedVersions.pc.includes(latestVersion)) { | ||
if (issueStatus.open) { | ||
helper.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`) | ||
} | ||
} | ||
const latestReleaseData = manifest.versions.find(v => v.id === latestRelease) | ||
// Note: We don't use the below check to track if the version is supported properly or not | ||
// (data like protocol/blocks/items/etc is present), just to make sure the known protocol version is correct. | ||
let versionJson | ||
try { | ||
const latestReleaseManifest = await fetch(latestReleaseData.url).then(res => res.json()) | ||
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) | ||
helper.createIssue(issuePayload) | ||
fs.writeFileSync('./issue.md', issuePayload.body) | ||
console.log('OK, wrote to ./issue.md', issuePayload) | ||
} | ||
} | ||
if (!latestVersionIsSnapshot && !issueStatus.open && !issueStatus.closed) { | ||
console.log('Opening issue', versionJson) | ||
const issuePayload = buildFirstIssue(title, latestVersionData, versionJson) | ||
helper.createIssue(issuePayload) | ||
fs.writeFileSync('./issue.md', issuePayload.body) | ||
console.log('OK, wrote to ./issue.md', issuePayload) | ||
} | ||
async function addEntryFor (releaseVersion, releaseData) { | ||
const latestReleaseManifest = await fetch(releaseData.url).then(res => res.json()) | ||
// Download client jar | ||
if (!fs.existsSync(`./${latestRelease}.jar`)) { | ||
if (!fs.existsSync(`./${releaseVersion}.jar`)) { | ||
const clientJarUrl = latestReleaseManifest.downloads.client.url | ||
console.log('Downloading client jar', clientJarUrl) | ||
download(clientJarUrl, `./${latestRelease}.jar`) | ||
download(clientJarUrl, `./${releaseVersion}.jar`) | ||
} | ||
// Log the byte size of the client jar | ||
const clientJarSize = fs.statSync(`./${latestRelease}.jar`).size | ||
console.log(`Downloaded client jar ${latestRelease}.jar (${clientJarSize} bytes), extracting its version.json...`) | ||
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 ./${latestRelease}.jar version.json`) | ||
else cp.execSync(`7z -y e ./${latestRelease}.jar version.json`, { stdio: 'inherit' }) | ||
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') | ||
@@ -123,3 +139,3 @@ | ||
majorVersion, | ||
releaseType: latestReleaseData.type | ||
releaseType: latestVersionData.type | ||
} | ||
@@ -140,20 +156,3 @@ console.log('Adding new entry to pc protocolVersions.json', newEntry) | ||
if (!issueStatus.open && !issueStatus.closed) { | ||
console.log('Opening issue', versionJson) | ||
const issuePayload = buildFirstIssue(title, latestReleaseData, versionJson) | ||
helper.createIssue(issuePayload) | ||
fs.writeFileSync('./issue.md', issuePayload.body) | ||
console.log('OK, wrote to ./issue.md', issuePayload) | ||
} | ||
} catch (e) { | ||
console.error(e) | ||
console.log('Latest PC version is not supported and we failed to load data. Opening issue...') | ||
const issuePayload = buildFirstIssue(title, latestReleaseData) | ||
helper.createIssue(issuePayload) | ||
fs.writeFileSync('./issue.md', issuePayload.body) | ||
console.log('OK, wrote to ./issue.md', issuePayload) | ||
return versionJson | ||
} | ||
@@ -160,0 +159,0 @@ } |
[ | ||
{ | ||
"name": "smallWorld", | ||
"description": "world height is 128 blocks", | ||
"version": "0.14.3" | ||
}, | ||
{ | ||
"name": "usesPalettedChunks", | ||
"description": "the chunk format uses local palettes", | ||
"versions": ["1.16_major", "latest"] | ||
}, | ||
{ | ||
"name": "newRecipeSchema", | ||
@@ -4,0 +14,0 @@ "description": "New recipe schema", |
[ | ||
{ | ||
"name": "usesPalettedChunks", | ||
"description": "the chunk format uses local palettes", | ||
"versions": ["1.9", "latest"] | ||
}, | ||
{ | ||
"name": "mobSpawner", | ||
@@ -537,3 +542,3 @@ "description": "spawner is called mob_spawner", | ||
"description": "chunk light data is sent in a separate packet", | ||
"versions": ["1.14", "1.16"] | ||
"versions": ["1.14", "latest"] | ||
}, | ||
@@ -546,2 +551,7 @@ { | ||
{ | ||
"name": "biomesSentSeparately", | ||
"description": "biomes sent in own packet", | ||
"versions": ["1.15", "1.17_major"] | ||
}, | ||
{ | ||
"name": "acknowledgePlayerDigging", | ||
@@ -771,3 +781,8 @@ "description": "player digging packets should be responded to", | ||
"versions": ["1.15_major", "latest"] | ||
}, | ||
{ | ||
"name": "newLightingDataFormat", | ||
"description": "in 1.17, light encoding changed to handle new world height", | ||
"versions": ["1.17", "latest"] | ||
} | ||
] |
@@ -0,1 +1,6 @@ | ||
## 3.45.0 | ||
* [add features for prismarine chunk (#763)](https://github.com/PrismarineJS/minecraft-data/commit/1b9380edb159721bef2342d4214b0ebb3128c812) (thanks @extremeheat) | ||
* [1.20 block data fixes (#766)](https://github.com/PrismarineJS/minecraft-data/commit/b130830580ea0cc5551cd736bdc139ac79d3eba7) (thanks @MathiasElgaard) | ||
* [Handle snapshots in update checking workflow (#767)](https://github.com/PrismarineJS/minecraft-data/commit/b5037850d0f3abf77b2197535b042e23d012aad6) (thanks @extremeheat) | ||
## 3.44.0 | ||
@@ -2,0 +7,0 @@ * [Elytra support (#761)](https://github.com/PrismarineJS/minecraft-data/commit/72a267757b8fbb8462f3c3f25001754af9d1f7c4) (thanks @lkwilson) |
{ | ||
"name": "minecraft-data", | ||
"version": "3.44.0", | ||
"version": "3.45.0", | ||
"description": "Provide easy access to minecraft data in node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
150942534
4504873
4