From 0ee608a1841828da45db8a8f6f3ff2be349e2157 Mon Sep 17 00:00:00 2001 From: Marc Neuhaus Date: Mon, 11 May 2026 22:42:25 +0200 Subject: [PATCH 1/5] Update minecraft-data for 26.1.2 protocol --- minecraft-data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/minecraft-data b/minecraft-data index 2dd48a4a..bc0c5957 160000 --- a/minecraft-data +++ b/minecraft-data @@ -1 +1 @@ -Subproject commit 2dd48a4adf77cd32b1d5a26dc92373be94768d06 +Subproject commit bc0c5957ff925778660f253f9d1ea51c06d14087 From 97d92eebf133a6010cb63caa7c2b4b3c2b885675 Mon Sep 17 00:00:00 2001 From: Marc Neuhaus Date: Tue, 12 May 2026 14:31:05 +0200 Subject: [PATCH 2/5] Initialize data submodule during git installs --- bin/ensure_minecraft_data.js | 9 +++++++++ package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 bin/ensure_minecraft_data.js diff --git a/bin/ensure_minecraft_data.js b/bin/ensure_minecraft_data.js new file mode 100644 index 00000000..22e65c3f --- /dev/null +++ b/bin/ensure_minecraft_data.js @@ -0,0 +1,9 @@ +#!/usr/bin/env node + +const fs = require('fs') +const { spawnSync } = require('child_process') + +if (fs.existsSync('minecraft-data/data/dataPaths.json')) process.exit(0) + +const result = spawnSync('git', ['submodule', 'update', '--init', '--recursive'], { stdio: 'inherit' }) +if (result.status !== 0) process.exit(result.status || 1) diff --git a/package.json b/package.json index 58de958a..045fc719 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "test:types": "tsc typings/test-typings && node typings/test-typings.js", "test": "npm run generate:types && npm run generate:data && npm run lint && npm run test:types && mocha", "lint": "standard", - "prepare": "npm run generate:data && npm run generate:types", + "prepare": "node ./bin/ensure_minecraft_data.js && npm run generate:data && npm run generate:types", "fix": "standard --fix" }, "standard": { From 38c55caf46a7ea273c0e941cbc0c55cbb51404c3 Mon Sep 17 00:00:00 2001 From: Marc Neuhaus Date: Tue, 12 May 2026 14:39:09 +0200 Subject: [PATCH 3/5] Fetch data source for git dependency installs --- bin/ensure_minecraft_data.js | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/bin/ensure_minecraft_data.js b/bin/ensure_minecraft_data.js index 22e65c3f..9c6a11d8 100644 --- a/bin/ensure_minecraft_data.js +++ b/bin/ensure_minecraft_data.js @@ -3,7 +3,27 @@ const fs = require('fs') const { spawnSync } = require('child_process') -if (fs.existsSync('minecraft-data/data/dataPaths.json')) process.exit(0) +const dataPaths = 'minecraft-data/data/dataPaths.json' +const dataRepo = 'https://github.com/mneuhaus/minecraft-data.git' +const dataBranch = 'pc_26_1_2' -const result = spawnSync('git', ['submodule', 'update', '--init', '--recursive'], { stdio: 'inherit' }) -if (result.status !== 0) process.exit(result.status || 1) +if (fs.existsSync(dataPaths)) process.exit(0) + +if (fs.existsSync('.git')) { + const result = spawnSync('git', ['submodule', 'update', '--init', '--recursive'], { stdio: 'inherit' }) + if (result.status !== 0) process.exit(result.status || 1) + if (fs.existsSync(dataPaths)) process.exit(0) +} + +fs.rmSync('minecraft-data', { recursive: true, force: true }) + +const clone = spawnSync('git', ['clone', '--depth', '1', '--filter=blob:none', '--sparse', '--branch', dataBranch, dataRepo, 'minecraft-data'], { stdio: 'inherit' }) +if (clone.status !== 0) process.exit(clone.status || 1) + +const sparse = spawnSync('git', ['-C', 'minecraft-data', 'sparse-checkout', 'set', 'data'], { stdio: 'inherit' }) +if (sparse.status !== 0) process.exit(sparse.status || 1) + +if (!fs.existsSync(dataPaths)) { + console.error(`Could not load ${dataPaths}`) + process.exit(1) +} From c093eeb0538c0e215dcbcebb13128ac6e294265e Mon Sep 17 00:00:00 2001 From: Marc Neuhaus Date: Tue, 12 May 2026 14:42:27 +0200 Subject: [PATCH 4/5] Include schemas in git install data checkout --- bin/ensure_minecraft_data.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ensure_minecraft_data.js b/bin/ensure_minecraft_data.js index 9c6a11d8..fe791465 100644 --- a/bin/ensure_minecraft_data.js +++ b/bin/ensure_minecraft_data.js @@ -20,7 +20,7 @@ fs.rmSync('minecraft-data', { recursive: true, force: true }) const clone = spawnSync('git', ['clone', '--depth', '1', '--filter=blob:none', '--sparse', '--branch', dataBranch, dataRepo, 'minecraft-data'], { stdio: 'inherit' }) if (clone.status !== 0) process.exit(clone.status || 1) -const sparse = spawnSync('git', ['-C', 'minecraft-data', 'sparse-checkout', 'set', 'data'], { stdio: 'inherit' }) +const sparse = spawnSync('git', ['-C', 'minecraft-data', 'sparse-checkout', 'set', 'data', 'schemas'], { stdio: 'inherit' }) if (sparse.status !== 0) process.exit(sparse.status || 1) if (!fs.existsSync(dataPaths)) { From 5261c21830dbf692a3c9655506aea07642afdd83 Mon Sep 17 00:00:00 2001 From: Marc Neuhaus Date: Tue, 12 May 2026 15:10:15 +0200 Subject: [PATCH 5/5] Fall back when draft data submodule is unavailable --- bin/ensure_minecraft_data.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/ensure_minecraft_data.js b/bin/ensure_minecraft_data.js index fe791465..9301cdea 100644 --- a/bin/ensure_minecraft_data.js +++ b/bin/ensure_minecraft_data.js @@ -11,8 +11,7 @@ if (fs.existsSync(dataPaths)) process.exit(0) if (fs.existsSync('.git')) { const result = spawnSync('git', ['submodule', 'update', '--init', '--recursive'], { stdio: 'inherit' }) - if (result.status !== 0) process.exit(result.status || 1) - if (fs.existsSync(dataPaths)) process.exit(0) + if (result.status === 0 && fs.existsSync(dataPaths)) process.exit(0) } fs.rmSync('minecraft-data', { recursive: true, force: true })