Skip to content

Commit 7267469

Browse files
Copilotrubensworks
andcommitted
fix: restore cyclops-infobook-html dep, add workspace for generate-icons, fix game_launching timeout
Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
1 parent 915f46a commit 7267469

9 files changed

Lines changed: 1405 additions & 46 deletions

File tree

‎.github/workflows/deploy.yml‎

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ jobs:
88
uses: actions/checkout@v4
99
with:
1010
persist-credentials: false
11-
- name: Checkout Infobook-html 📚
12-
uses: actions/checkout@v4
13-
with:
14-
repository: CyclopsMC/Infobook-html
15-
path: infobook-html
1611
- name: Setup Java ☕
1712
uses: actions/setup-java@v4
1813
with:
@@ -31,27 +26,9 @@ jobs:
3126
key: minecraft-${{ hashFiles('modpack.json') }}
3227
restore-keys: |
3328
minecraft-
34-
- name: Apply icon generation script to Infobook-html 🔧
35-
run: |
36-
cp infobook-html-additions/bin/generate-icons.ts infobook-html/bin/generate-icons.ts
37-
cp infobook-html-additions/lib/modloader/IconsGenerator.ts infobook-html/lib/modloader/IconsGenerator.ts
38-
mkdir -p infobook-html/test/modloader
39-
cp infobook-html-additions/test/modloader/IconsGenerator-test.ts infobook-html/test/modloader/IconsGenerator-test.ts
40-
jq '.bin["generate-icons"] = "bin/generate-icons.js"' infobook-html/package.json > /tmp/pkg-patched.json
41-
mv /tmp/pkg-patched.json infobook-html/package.json
42-
jq '.compilerOptions.skipLibCheck = true' infobook-html/tsconfig.json > /tmp/tsconfig-patched.json
43-
mv /tmp/tsconfig-patched.json infobook-html/tsconfig.json
44-
sed -i 's/\.map(() => \[\])/\.map((): any[] => [])/' infobook-html/lib/infobook/appendix/InfoBookAppendixHandlerCraftingRecipe.ts
45-
- name: Build and link Infobook-html 🔗
46-
run: |
47-
cd infobook-html
48-
npm install --legacy-peer-deps --ignore-scripts
49-
npm run build
50-
npm link
5129
- name: Install and Build 🔧
5230
run: |
53-
npm install --legacy-peer-deps --ignore-scripts
54-
npm link cyclops-infobook-html --legacy-peer-deps
31+
npm install --legacy-peer-deps
5532
npm run build
5633
npm run lint
5734
- name: Download mods and generate metadata 📦
@@ -69,3 +46,4 @@ jobs:
6946
BRANCH: gh-pages
7047
FOLDER: output
7148
CLEAN: true
49+

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ mod_assets
1010
registries
1111
icons
1212
headlessmc
13+
HeadlessMC

‎infobook-html-additions/lib/modloader/IconsGenerator.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,15 @@ export class IconsGenerator {
257257
sendCommand('gui');
258258
transitionTo('checking_screen');
259259
}, 5000);
260+
} else if (Date.now() - stateSettledAt > 300000 && !commandSent) {
261+
// 5-minute timeout: if game output is not being relayed to HMC stdout
262+
// (e.g. HMCLog4JAppender terminal is null), proceed assuming game is loaded
263+
commandSent = true;
264+
process.stdout.write('[HMC] Game load detection timeout, proceeding assuming game is loaded...\n');
265+
setTimeout(() => {
266+
sendCommand('gui');
267+
transitionTo('checking_screen');
268+
}, 5000);
260269
}
261270
break;
262271

@@ -424,6 +433,7 @@ export class IconsGenerator {
424433
return output.includes('Mod loading complete') ||
425434
output.includes('[minecraft/Minecraft]: Loaded 0 advancements') ||
426435
output.includes('HMC Specifics initialized') ||
436+
output.includes('HMC-Specifics initialized') ||
427437
(output.includes('[Render thread/INFO]') && output.includes('Loaded '));
428438
}
429439

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "cyclops-infobook-html-additions",
3+
"version": "1.0.0",
4+
"private": true,
5+
"description": "Icon generation additions for cyclops-infobook-html",
6+
"bin": {
7+
"generate-icons": "bin/generate-icons.js"
8+
},
9+
"scripts": {
10+
"build": "tsc",
11+
"prepare": "npm run build"
12+
},
13+
"dependencies": {
14+
"@types/minimist": "^1.2.0",
15+
"@types/node": "^13.1.0",
16+
"@types/node-fetch": "^2.5.0",
17+
"minimist": "^1.2.0",
18+
"node-fetch": "^2.6.0",
19+
"typescript": "^5.0.0"
20+
}
21+
}

‎infobook-html-additions/test/modloader/IconsGenerator-test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ describe('IconsGenerator', () => {
205205
expect(generator.isGameFullyLoaded('[INFO] HMC Specifics initialized')).toBe(true);
206206
});
207207

208+
it('should return true when HMC-Specifics initialized (with hyphen, actual log format)', () => {
209+
expect(generator.isGameFullyLoaded('[Render thread/INFO] [me.earth.headlessmc.mc.Initializer/]: HMC-Specifics initialized!')).toBe(true);
210+
});
211+
208212
it('should return true when Minecraft advancements message is present', () => {
209213
expect(generator.isGameFullyLoaded(
210214
'[Render thread/INFO] [minecraft/Minecraft]: Loaded 0 advancements'
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"compileOnSave": true,
3+
"compilerOptions": {
4+
"module": "commonjs",
5+
"lib": [
6+
"dom",
7+
"es6"
8+
],
9+
"target": "es6",
10+
"noImplicitAny": true,
11+
"removeComments": false,
12+
"preserveConstEnums": true,
13+
"sourceMap": true,
14+
"inlineSources": true,
15+
"declaration": true,
16+
"skipLibCheck": true
17+
},
18+
"include": [
19+
"bin/**/*",
20+
"lib/**/*"
21+
],
22+
"exclude": [
23+
"**/node_modules",
24+
"**/test/*"
25+
]
26+
}

0 commit comments

Comments
 (0)