From 8964d0f654e17c30c13e49ff85143b0bfb1dd579 Mon Sep 17 00:00:00 2001 From: Icyadam14 Date: Wed, 27 Nov 2024 02:47:54 -0500 Subject: [PATCH 01/10] Support 1.21.1 --- .github/workflows/ci.yml | 2 +- README.md | 2 +- viewer/lib/version.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 904d54a1..1dafcd68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: strategy: matrix: - mcVersion: ['1.8.8', '1.9.4', '1.10.2', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.1', '1.16.4', '1.17.1', '1.18.1', '1.19', '1.20.1'] + mcVersion: ['1.8.8', '1.9.4', '1.10.2', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.1', '1.16.4', '1.17.1', '1.18.1', '1.19', '1.20.1', '1.21.1'] fail-fast: false steps: diff --git a/README.md b/README.md index 7f52d92d..4fd4be96 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Web based viewer for servers and bots [viewer](https://prismarinejs.github.io/prismarine-viewer/) -Supports versions 1.8.8, 1.9.4, 1.10.2, 1.11.2, 1.12.2, 1.13.2, 1.14.4, 1.15.2, 1.16.1, 1.16.4, 1.17.1, 1.18.1, 1.19, 1.20.1. +Supports versions 1.8.8, 1.9.4, 1.10.2, 1.11.2, 1.12.2, 1.13.2, 1.14.4, 1.15.2, 1.16.1, 1.16.4, 1.17.1, 1.18.1, 1.19, 1.20.1, 1.21.1. ## Install diff --git a/viewer/lib/version.js b/viewer/lib/version.js index d6808954..196930e6 100644 --- a/viewer/lib/version.js +++ b/viewer/lib/version.js @@ -1,4 +1,4 @@ -const supportedVersions = ['1.8.8', '1.9.4', '1.10.2', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.1', '1.16.4', '1.17.1', '1.18.1', '1.19', '1.20.1'] +const supportedVersions = ['1.8.8', '1.9.4', '1.10.2', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.1', '1.16.4', '1.17.1', '1.18.1', '1.19', '1.20.1', '1.21.1'] const lastOfMajor = {} for (const version of supportedVersions) { From a97117b3c1078803eef9911026bdc3c58ab3816d Mon Sep 17 00:00:00 2001 From: Icyadam14 Date: Wed, 27 Nov 2024 02:53:39 -0500 Subject: [PATCH 02/10] Update actions/upload-artifact to v4 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1dafcd68..8b77226a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: run: sudo apt-get install -y libxi-dev libglu1-mesa-dev - run: npm install - run: npm run jestTest -- -t ${{ matrix.mcVersion }} - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: test_picture path: test/test_*.png From 774dce2c5cba699c38f3798a958a502cccd6250b Mon Sep 17 00:00:00 2001 From: Icyadam14 Date: Wed, 27 Nov 2024 03:33:57 -0500 Subject: [PATCH 03/10] Attempt to fix CI --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index afddea82..b52e160a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: - run: npm run jestTest -- -t ${{ matrix.mcVersion }} - uses: actions/upload-artifact@v4 with: - name: test_picture + name: test_picture-${{ github.run_id }}-${{ github.job }} path: test/test_*.png DeployPages: runs-on: ubuntu-latest @@ -57,7 +57,7 @@ jobs: - name: Download build uses: actions/download-artifact@v4.1.7 with: - name: test_picture + name: test_picture-${{ github.run_id }}-${{ github.job }} - name: Create commits run: | git config user.name 'rom1504bot' From 18c47592bdc13f8c71a7ab91547ece54a6ef9169 Mon Sep 17 00:00:00 2001 From: Icyadam14 Date: Wed, 27 Nov 2024 03:53:42 -0500 Subject: [PATCH 04/10] Adding some logging to debug CI --- .github/workflows/ci.yml | 4 ++-- viewer/prerender.js | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b52e160a..afddea82 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: - run: npm run jestTest -- -t ${{ matrix.mcVersion }} - uses: actions/upload-artifact@v4 with: - name: test_picture-${{ github.run_id }}-${{ github.job }} + name: test_picture path: test/test_*.png DeployPages: runs-on: ubuntu-latest @@ -57,7 +57,7 @@ jobs: - name: Download build uses: actions/download-artifact@v4.1.7 with: - name: test_picture-${{ github.run_id }}-${{ github.job }} + name: test_picture - name: Create commits run: | git config user.name 'rom1504bot' diff --git a/viewer/prerender.js b/viewer/prerender.js index 8f525adb..c5d6a385 100644 --- a/viewer/prerender.js +++ b/viewer/prerender.js @@ -18,7 +18,15 @@ const supportedVersions = require('./lib/version').supportedVersions for (const version of supportedVersions) { const assets = mcAssets(version) + // Check if assets is null or undefined + if (!assets) { + console.log('Error: assets is null or undefined') + } const atlas = makeTextureAtlas(assets) + // Check if atlas is null or undefined + if (!atlas) { + console.log('Error: atlas is null or undefined') + } const out = fs.createWriteStream(path.resolve(texturesPath, version + '.png')) const stream = atlas.canvas.pngStream() stream.on('data', (chunk) => out.write(chunk)) From 39f61d4b0fd58b3d4e90f3a66b164730d687745e Mon Sep 17 00:00:00 2001 From: Icyadam14 Date: Wed, 27 Nov 2024 03:57:57 -0500 Subject: [PATCH 05/10] Adding more logging --- viewer/lib/modelsBuilder.js | 4 ++++ viewer/prerender.js | 8 -------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/viewer/lib/modelsBuilder.js b/viewer/lib/modelsBuilder.js index 1a6ab5cb..b594c3ae 100644 --- a/viewer/lib/modelsBuilder.js +++ b/viewer/lib/modelsBuilder.js @@ -56,6 +56,10 @@ function prepareModel (model, texturesJson) { } else { let name = face.texture name = cleanupBlockName(name) + console.log(name) + if (!texturesJson[name]) { + console.log('missing texture', name) + } face.texture = JSON.parse(JSON.stringify(texturesJson[name])) } diff --git a/viewer/prerender.js b/viewer/prerender.js index c5d6a385..8f525adb 100644 --- a/viewer/prerender.js +++ b/viewer/prerender.js @@ -18,15 +18,7 @@ const supportedVersions = require('./lib/version').supportedVersions for (const version of supportedVersions) { const assets = mcAssets(version) - // Check if assets is null or undefined - if (!assets) { - console.log('Error: assets is null or undefined') - } const atlas = makeTextureAtlas(assets) - // Check if atlas is null or undefined - if (!atlas) { - console.log('Error: atlas is null or undefined') - } const out = fs.createWriteStream(path.resolve(texturesPath, version + '.png')) const stream = atlas.canvas.pngStream() stream.on('data', (chunk) => out.write(chunk)) From 15e8cce8003c0f1e27ec56c7b8b884dbe10e7f2f Mon Sep 17 00:00:00 2001 From: Icyadam14 Date: Wed, 27 Nov 2024 04:00:38 -0500 Subject: [PATCH 06/10] Adjusted logs --- viewer/lib/modelsBuilder.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/viewer/lib/modelsBuilder.js b/viewer/lib/modelsBuilder.js index b594c3ae..47345bdc 100644 --- a/viewer/lib/modelsBuilder.js +++ b/viewer/lib/modelsBuilder.js @@ -54,12 +54,11 @@ function prepareModel (model, texturesJson) { if (face.texture.charAt(0) === '#') { face.texture = JSON.parse(JSON.stringify(model.textures[face.texture.substr(1)])) } else { + console.log(face) let name = face.texture + console.log(name) name = cleanupBlockName(name) console.log(name) - if (!texturesJson[name]) { - console.log('missing texture', name) - } face.texture = JSON.parse(JSON.stringify(texturesJson[name])) } From 46e6caf7a230d4a6a9b55c551e532be229bd3cd7 Mon Sep 17 00:00:00 2001 From: Icyadam14 Date: Wed, 27 Nov 2024 04:10:19 -0500 Subject: [PATCH 07/10] More logging changes --- viewer/lib/modelsBuilder.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/viewer/lib/modelsBuilder.js b/viewer/lib/modelsBuilder.js index 47345bdc..41d5fb6f 100644 --- a/viewer/lib/modelsBuilder.js +++ b/viewer/lib/modelsBuilder.js @@ -54,11 +54,9 @@ function prepareModel (model, texturesJson) { if (face.texture.charAt(0) === '#') { face.texture = JSON.parse(JSON.stringify(model.textures[face.texture.substr(1)])) } else { - console.log(face) + console.log(texturesJson) let name = face.texture - console.log(name) name = cleanupBlockName(name) - console.log(name) face.texture = JSON.parse(JSON.stringify(texturesJson[name])) } From a1d85dfde872beef3dbe8c3f3a79c877e18f3846 Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Wed, 8 Jan 2025 12:44:59 +0100 Subject: [PATCH 08/10] Update modelsBuilder.js for logging --- viewer/lib/modelsBuilder.js | 1 + 1 file changed, 1 insertion(+) diff --git a/viewer/lib/modelsBuilder.js b/viewer/lib/modelsBuilder.js index 41d5fb6f..def1b378 100644 --- a/viewer/lib/modelsBuilder.js +++ b/viewer/lib/modelsBuilder.js @@ -57,6 +57,7 @@ function prepareModel (model, texturesJson) { console.log(texturesJson) let name = face.texture name = cleanupBlockName(name) + console.log(name) face.texture = JSON.parse(JSON.stringify(texturesJson[name])) } From 74291c9cb5b9b56369de7771ad688a3487e4630e Mon Sep 17 00:00:00 2001 From: hunter Date: Wed, 15 Jan 2025 09:01:54 -0500 Subject: [PATCH 09/10] Check if face.texture is a texture reference even in absence of a # prefix. --- viewer/lib/modelsBuilder.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/viewer/lib/modelsBuilder.js b/viewer/lib/modelsBuilder.js index def1b378..a625c114 100644 --- a/viewer/lib/modelsBuilder.js +++ b/viewer/lib/modelsBuilder.js @@ -53,11 +53,14 @@ function prepareModel (model, texturesJson) { if (face.texture.charAt(0) === '#') { face.texture = JSON.parse(JSON.stringify(model.textures[face.texture.substr(1)])) + } else if ( + !(cleanupBlockName(face.texture) in texturesJson) + && face.texture in model.textures + ) { + face.texture = JSON.parse(JSON.stringify(model.textures[face.texture])) } else { - console.log(texturesJson) let name = face.texture name = cleanupBlockName(name) - console.log(name) face.texture = JSON.parse(JSON.stringify(texturesJson[name])) } From 64641c8d8e645e05f93a418e433efac009eb463b Mon Sep 17 00:00:00 2001 From: hunter Date: Wed, 15 Jan 2025 09:10:22 -0500 Subject: [PATCH 10/10] Formatting fix. --- viewer/lib/modelsBuilder.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/viewer/lib/modelsBuilder.js b/viewer/lib/modelsBuilder.js index a625c114..a7736c6b 100644 --- a/viewer/lib/modelsBuilder.js +++ b/viewer/lib/modelsBuilder.js @@ -54,8 +54,8 @@ function prepareModel (model, texturesJson) { if (face.texture.charAt(0) === '#') { face.texture = JSON.parse(JSON.stringify(model.textures[face.texture.substr(1)])) } else if ( - !(cleanupBlockName(face.texture) in texturesJson) - && face.texture in model.textures + !(cleanupBlockName(face.texture) in texturesJson) && + face.texture in model.textures ) { face.texture = JSON.parse(JSON.stringify(model.textures[face.texture])) } else {