cyclops-infobook-html 3.1.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/bin/generate-mod-metadata.js +1 -1
- package/lib/infobook/IItem.d.ts +1 -1
- package/lib/modloader/ModLoader.d.ts +8 -2
- package/lib/modloader/ModLoader.js +39 -16
- package/lib/resource/ResourceHandler.js +2 -2
- package/lib/resource/ResourceLoader.js +1 -1
- package/lib/serialize/HtmlInfoBookSerializer.js +2 -1
- package/package.json +7 -4
- package/CHANGELOG.md +0 -76
package/README.md
CHANGED
|
@@ -54,6 +54,8 @@ Before you can execute this phase, you need a `modpack.json` file with contents
|
|
|
54
54
|
}
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
*The "forge" entry may be replaced by "neoforge".*
|
|
58
|
+
|
|
57
59
|
To start this phase, simply run `generate-mod-metadata modpack.json generate`.
|
|
58
60
|
|
|
59
61
|
Optionally, you can delete the resulting server files afterwards using `generate-mod-metadata modpack.json clean`.
|
|
@@ -62,7 +64,7 @@ If you want to re-download the mods without re-installing Forge, you can run `ge
|
|
|
62
64
|
|
|
63
65
|
### 2. Icon Generation
|
|
64
66
|
|
|
65
|
-
This phase should be done using the [
|
|
67
|
+
This phase should be done using the [Icon Exporter mod](https://github.com/CyclopsMC/IconExporter).
|
|
66
68
|
|
|
67
69
|
Simply create a modpack with all the mods that were downloaded in the previous step (including the Item Exporter mod),
|
|
68
70
|
start a world, and run the `/iconexporter export 64` command.
|
|
@@ -18,7 +18,7 @@ function run(command, configPath) {
|
|
|
18
18
|
const modLoader = new ModLoader_1.ModLoader({
|
|
19
19
|
mods: config.mods,
|
|
20
20
|
path: path_1.join(process.cwd(), 'server'),
|
|
21
|
-
versionForge: config.forge,
|
|
21
|
+
loader: 'forge' in config ? { versionForge: config.forge } : { versionNeoForge: config.neoforge },
|
|
22
22
|
versionMinecraft: config.minecraft,
|
|
23
23
|
});
|
|
24
24
|
switch (command) {
|
package/lib/infobook/IItem.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { ChildProcess } from "child_process";
|
|
|
6
6
|
export declare class ModLoader {
|
|
7
7
|
private readonly mods;
|
|
8
8
|
private readonly path;
|
|
9
|
-
private readonly
|
|
9
|
+
private readonly loader;
|
|
10
10
|
private readonly versionMinecraft;
|
|
11
11
|
constructor(args: IModLoaderArgs);
|
|
12
12
|
/**
|
|
@@ -76,14 +76,20 @@ export declare class ModLoader {
|
|
|
76
76
|
export interface IModLoaderArgs {
|
|
77
77
|
mods: IMod[];
|
|
78
78
|
path: string;
|
|
79
|
-
|
|
79
|
+
loader: ILoader;
|
|
80
80
|
versionMinecraft: string;
|
|
81
81
|
}
|
|
82
|
+
export declare type ILoader = {
|
|
83
|
+
versionForge: string;
|
|
84
|
+
} | {
|
|
85
|
+
versionNeoForge: string;
|
|
86
|
+
};
|
|
82
87
|
export declare type IMod = IModMaven | IModCurseforge | IModRaw;
|
|
83
88
|
export interface IModMaven {
|
|
84
89
|
type: 'maven';
|
|
85
90
|
artifact: string;
|
|
86
91
|
repo: string;
|
|
92
|
+
name?: string;
|
|
87
93
|
}
|
|
88
94
|
export interface IModCurseforge {
|
|
89
95
|
type: 'curseforge';
|
|
@@ -20,7 +20,7 @@ class ModLoader {
|
|
|
20
20
|
constructor(args) {
|
|
21
21
|
this.mods = args.mods;
|
|
22
22
|
this.path = args.path;
|
|
23
|
-
this.
|
|
23
|
+
this.loader = args.loader;
|
|
24
24
|
this.versionMinecraft = args.versionMinecraft;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
@@ -37,22 +37,41 @@ class ModLoader {
|
|
|
37
37
|
if (!fs.existsSync(this.path)) {
|
|
38
38
|
yield fs.promises.mkdir(this.path);
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
let installerFile;
|
|
41
|
+
if ('versionForge' in this.loader) {
|
|
42
|
+
// Download Forge installer
|
|
43
|
+
process.stdout.write('Downloading Forge...\n');
|
|
44
|
+
const forgeInstaller = `https://files.minecraftforge.net/maven/net/minecraftforge/forge/${this.versionMinecraft}-${this.loader.versionForge}/forge-${this.versionMinecraft}-${this.loader.versionForge}-installer.jar`;
|
|
45
|
+
const res = yield node_fetch_1.default(forgeInstaller);
|
|
46
|
+
if (!res.ok) {
|
|
47
|
+
throw new Error(`Failed to fetch (${res.statusText}): ${forgeInstaller}`);
|
|
48
|
+
}
|
|
49
|
+
installerFile = path_1.join(this.path, 'forge-installer.jar');
|
|
50
|
+
yield new Promise((resolve, reject) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
return fs.writeFile(installerFile, yield res.buffer(), (err) => err ? reject(err) : resolve());
|
|
52
|
+
}));
|
|
53
|
+
// Install Forge
|
|
54
|
+
process.stdout.write('Installing Forge...\n');
|
|
55
|
+
yield new Promise((resolve, reject) => child_process_1.exec(`cd ${this.path} && java -jar forge-installer.jar --installServer`).on('exit', resolve));
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
// Download NeoForge installer
|
|
59
|
+
process.stdout.write('Downloading NeoForge...\n');
|
|
60
|
+
const installer = `https://maven.neoforged.net/releases/net/neoforged/neoforge/${this.loader.versionNeoForge}/neoforge-${this.loader.versionNeoForge}-installer.jar`;
|
|
61
|
+
const res = yield node_fetch_1.default(installer);
|
|
62
|
+
if (!res.ok) {
|
|
63
|
+
throw new Error(`Failed to fetch (${res.statusText}): ${installer}`);
|
|
64
|
+
}
|
|
65
|
+
installerFile = path_1.join(this.path, 'neoforge-installer.jar');
|
|
66
|
+
yield new Promise((resolve, reject) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
return fs.writeFile(installerFile, yield res.buffer(), (err) => err ? reject(err) : resolve());
|
|
68
|
+
}));
|
|
69
|
+
// Install Forge
|
|
70
|
+
process.stdout.write('Installing NeoForge...\n');
|
|
71
|
+
yield new Promise((resolve, reject) => child_process_1.exec(`cd ${this.path} && java -jar neoforge-installer.jar --installServer`).on('exit', resolve));
|
|
46
72
|
}
|
|
47
|
-
const installerFile = path_1.join(this.path, 'forge-installer.jar');
|
|
48
|
-
yield new Promise((resolve, reject) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
return fs.writeFile(installerFile, yield res.buffer(), (err) => err ? reject(err) : resolve());
|
|
50
|
-
}));
|
|
51
|
-
// Install Forge
|
|
52
|
-
process.stdout.write('Installing Forge...\n');
|
|
53
|
-
yield new Promise((resolve, reject) => child_process_1.exec(`cd ${this.path} && java -jar forge-installer.jar --installServer`).on('exit', resolve));
|
|
54
73
|
// Wait a bit, because otherwise some files don't exist yet (while they should...)
|
|
55
|
-
process.stdout.write('Wait a bit after
|
|
74
|
+
process.stdout.write('Wait a bit after mod loader installation...\n');
|
|
56
75
|
yield new Promise((resolve) => setTimeout(resolve, 10000));
|
|
57
76
|
// Cleanup
|
|
58
77
|
process.stdout.write('Cleaning up...\n');
|
|
@@ -95,7 +114,11 @@ class ModLoader {
|
|
|
95
114
|
}
|
|
96
115
|
else if (mod.type === 'maven') {
|
|
97
116
|
process.stdout.write(` - ${mod.artifact} from ${mod.repo}...\n`);
|
|
98
|
-
yield mvn_artifact_download_1.default(mod.artifact, modsDir, mod.repo);
|
|
117
|
+
const name = yield mvn_artifact_download_1.default(mod.artifact, modsDir, mod.repo);
|
|
118
|
+
// Rename file if needed
|
|
119
|
+
if ('name' in mod) {
|
|
120
|
+
fs.renameSync(name, path_1.join(modsDir, mod.name));
|
|
121
|
+
}
|
|
99
122
|
}
|
|
100
123
|
else if (mod.type === 'raw') {
|
|
101
124
|
process.stdout.write(` - ${mod.name} from ${mod.url}...\n`);
|
|
@@ -179,7 +179,7 @@ class ResourceHandler {
|
|
|
179
179
|
*/
|
|
180
180
|
addItemTranslationKey(item, translationKey) {
|
|
181
181
|
const { namespace, path } = ResourceHandler.splitItemId(item.item);
|
|
182
|
-
ResourceHandler.addItemKeyedRegistryEntry(this.itemTranslationKeys, namespace, path, item.
|
|
182
|
+
ResourceHandler.addItemKeyedRegistryEntry(this.itemTranslationKeys, namespace, path, item.components, translationKey);
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
185
|
* Get an item translation key.
|
|
@@ -188,7 +188,7 @@ class ResourceHandler {
|
|
|
188
188
|
*/
|
|
189
189
|
getItemTranslationKey(item) {
|
|
190
190
|
const { namespace, path } = ResourceHandler.splitItemId(item.item);
|
|
191
|
-
return ResourceHandler.getItemKeyedRegistryEntry(this.itemTranslationKeys, namespace, path, item.
|
|
191
|
+
return ResourceHandler.getItemKeyedRegistryEntry(this.itemTranslationKeys, namespace, path, item.components);
|
|
192
192
|
}
|
|
193
193
|
/**
|
|
194
194
|
* Add an fluid translation key.
|
|
@@ -126,7 +126,7 @@ class ResourceLoader {
|
|
|
126
126
|
// Ignore mods without language files
|
|
127
127
|
}
|
|
128
128
|
// Handle advancements
|
|
129
|
-
const advancementsDir = path_1.join(fullPath, '
|
|
129
|
+
const advancementsDir = path_1.join(fullPath, 'advancement');
|
|
130
130
|
try {
|
|
131
131
|
if ((yield fs_1.promises.stat(langDir)).isDirectory()) {
|
|
132
132
|
yield this.loadAssetsAdvancements(modid, advancementsDir, '');
|
|
@@ -177,7 +177,7 @@ class HtmlInfoBookSerializer {
|
|
|
177
177
|
if (item.item === 'minecraft:air') {
|
|
178
178
|
return slot ? '<div class="item item-slot"> </div>' : '<div class="item"> </div>';
|
|
179
179
|
}
|
|
180
|
-
const icon = resourceHandler.getItemIconFile(item.item, item.
|
|
180
|
+
const icon = resourceHandler.getItemIconFile(item.item, item.components);
|
|
181
181
|
if (!icon) {
|
|
182
182
|
throw new Error(`Could not find an icon for item ${JSON.stringify(item)}`);
|
|
183
183
|
}
|
|
@@ -229,6 +229,7 @@ class HtmlInfoBookSerializer {
|
|
|
229
229
|
value = value.replace(/§o([^§]*)§r/g, '<em>$1</em>');
|
|
230
230
|
value = value.replace(/§N/g, '<br />');
|
|
231
231
|
// Colors to HTML
|
|
232
|
+
value = value.replace(/§r([^§]*)§0/g, '<span style="color: #000000">$1</span>');
|
|
232
233
|
value = value.replace(/§1([^§]*)§0/g, '<span style="color: #0000AA">$1</span>');
|
|
233
234
|
value = value.replace(/§2([^§]*)§0/g, '<span style="color: #00AA00">$1</span>');
|
|
234
235
|
value = value.replace(/§3([^§]*)§0/g, '<span style="color: #00AAAA">$1</span>');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cyclops-infobook-html",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Output Cyclops infobooks as HTML",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": "git@github.com:CyclopsMC/infobook-html.git",
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
"testEnvironment": "node"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@types/jest": "^
|
|
53
|
+
"@types/jest": "^28.0.0",
|
|
54
54
|
"@types/minimist": "^1.2.0",
|
|
55
55
|
"coveralls": "^3.0.3",
|
|
56
|
-
"jest": "^
|
|
56
|
+
"jest": "^28.0.0",
|
|
57
57
|
"manual-git-changelog": "^1.0.1",
|
|
58
58
|
"pre-commit": "^1.2.2",
|
|
59
|
-
"ts-jest": "^
|
|
59
|
+
"ts-jest": "^28.0.0",
|
|
60
60
|
"tslint": "^6.0.0",
|
|
61
61
|
"tslint-eslint-rules": "^5.4.0",
|
|
62
62
|
"typescript": "^4.0.0"
|
|
@@ -90,5 +90,8 @@
|
|
|
90
90
|
"rimraf": "^3.0.0",
|
|
91
91
|
"xml2js": "^0.4.19",
|
|
92
92
|
"yauzl": "^2.10.0"
|
|
93
|
+
},
|
|
94
|
+
"resolutions": {
|
|
95
|
+
"@types/istanbul-reports": "3.0.0"
|
|
93
96
|
}
|
|
94
97
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
All notable changes to this project will be documented in this file.
|
|
3
|
-
|
|
4
|
-
<a name="v3.1.0"></a>
|
|
5
|
-
## [v3.1.0](https://github.com/CyclopsMC/infobook-html/compare/v3.0.0...v3.1.0) - 2024-01-31
|
|
6
|
-
|
|
7
|
-
### Added
|
|
8
|
-
* [Support text field appendix](https://github.com/CyclopsMC/infobook-html/commit/6f24bbbd606b6cfd1237e3bf740e73ffc23008be)
|
|
9
|
-
* [Allowing raw mod URLs in modpack](https://github.com/CyclopsMC/infobook-html/commit/11c9ed5adc554ae7dafa66a202ac83fcacd240fb)
|
|
10
|
-
|
|
11
|
-
<a name="v3.0.0"></a>
|
|
12
|
-
## [v3.0.0](https://github.com/CyclopsMC/infobook-html/compare/v2.0.0...v3.0.0) - 2022-03-10
|
|
13
|
-
|
|
14
|
-
### Changed
|
|
15
|
-
* [Update to MC 1.18](https://github.com/CyclopsMC/infobook-html/commit/1fb77959593a2b84cb14e56406f0df20ad450e16)
|
|
16
|
-
|
|
17
|
-
<a name="v2.0.0"></a>
|
|
18
|
-
## [v2.0.0](https://github.com/CyclopsMC/infobook-html/compare/v1.1.2...v2.0.0) - 2021-02-03
|
|
19
|
-
|
|
20
|
-
### Changed
|
|
21
|
-
* [Update to MC 1.16](https://github.com/CyclopsMC/infobook-html/commit/249b211cb524414db95e3600dcdf14d9304926db)
|
|
22
|
-
* [Also extract mod data](https://github.com/CyclopsMC/infobook-html/commit/c11023465f93c2018deaa10e14270102398dfb2a)
|
|
23
|
-
* [Update footer year](https://github.com/CyclopsMC/infobook-html/commit/c946bab5c16c293b8a6a01a1c7ee1eb9c28b0ad6)
|
|
24
|
-
|
|
25
|
-
### Fixed
|
|
26
|
-
* [Fix incorrect dumpregistries command](https://github.com/CyclopsMC/infobook-html/commit/90bf5675f8a71170e36e91d41c01d5ec94fab430)
|
|
27
|
-
* [Fix server start failing after install in a hacky way](https://github.com/CyclopsMC/infobook-html/commit/03319253969e45b76d98b7b918bbf493c5985693)
|
|
28
|
-
|
|
29
|
-
<a name="v1.1.2"></a>
|
|
30
|
-
## [v1.1.2](https://github.com/CyclopsMC/infobook-html/compare/v1.1.1...v1.1.2) - 2019-07-31
|
|
31
|
-
|
|
32
|
-
### Fixed
|
|
33
|
-
* [Fix some URLs ending with two slashes](https://github.com/CyclopsMC/infobook-html/commit/8bb6b5f2efaa5babdbb0365258a911e82121ec74)
|
|
34
|
-
|
|
35
|
-
<a name="v1.1.1"></a>
|
|
36
|
-
## [v1.1.1](https://github.com/CyclopsMC/infobook-html/compare/v1.1.0...v1.1.1) - 2019-07-31
|
|
37
|
-
|
|
38
|
-
### Added
|
|
39
|
-
* [Allow baseUrl to be overridden via CLI](https://github.com/CyclopsMC/infobook-html/commit/c0090fd3fedc664cb33049bef5bc7e27225cb2b8)
|
|
40
|
-
|
|
41
|
-
### Fixed
|
|
42
|
-
* [Fix _lang dirs not being served on GitHub pages](https://github.com/CyclopsMC/infobook-html/commit/bb0c7bda1a8081322d1192ff293bbee1bdb411b0)
|
|
43
|
-
* [Fix language links not resolving to baseIRI](https://github.com/CyclopsMC/infobook-html/commit/e87eb5a8cf5e5a1651350dfc49923503e3badb7e)
|
|
44
|
-
* [Always end directory URLs with a slash](https://github.com/CyclopsMC/infobook-html/commit/9185cefa713e2d07783ff1f9b800926e24af8a8e)
|
|
45
|
-
|
|
46
|
-
<a name="v1.1.0"></a>
|
|
47
|
-
## [v1.1.0](https://github.com/CyclopsMC/infobook-html/compare/v1.0.1...v1.1.0) - 2019-07-29
|
|
48
|
-
|
|
49
|
-
### Added
|
|
50
|
-
* [Add furnace recipe handler](https://github.com/CyclopsMC/infobook-html/commit/7b6f2728c47283ed4c2e7a29da17a59af91be8bd)
|
|
51
|
-
* [Add support for combined formatting codes and newlines](https://github.com/CyclopsMC/infobook-html/commit/47a857e5a42465fa27c08ad0473065118cfa6fac)
|
|
52
|
-
* [Add support for predefined crafting recipes](https://github.com/CyclopsMC/infobook-html/commit/ecc794b36be7cdb2e7835723d62e729e9d89a629)
|
|
53
|
-
|
|
54
|
-
### Fixed
|
|
55
|
-
* [Fix item icons not being selected based on nbt](https://github.com/CyclopsMC/infobook-html/commit/1fe8f2938af881cc1a8911ccce4dafeaf6a9e25f)
|
|
56
|
-
* [Fix too many ad blocks being added](https://github.com/CyclopsMC/infobook-html/commit/5db0b9321116c710ced4cb9a6bcbfb2de0224324)
|
|
57
|
-
|
|
58
|
-
### Changed
|
|
59
|
-
* [Make page controls slightly smaller](https://github.com/CyclopsMC/infobook-html/commit/c2bd0167b93eeab8e8feb343e5e3f8a0634c8379)
|
|
60
|
-
* [Add support for multiple crafting recipes](https://github.com/CyclopsMC/infobook-html/commit/232f4c293564c818ce73b278b665282f12a7e4d7)
|
|
61
|
-
* [Make templateItem field public](https://github.com/CyclopsMC/infobook-html/commit/dd22d9bbfa3ac6d2b7e9aa6c3eb2e98d91e45556)
|
|
62
|
-
* [Throw error when translation keys are not found](https://github.com/CyclopsMC/infobook-html/commit/904c82275a84a3027b25660c0d87581d16decd43)
|
|
63
|
-
* [Throw error if predefined is not found](https://github.com/CyclopsMC/infobook-html/commit/43cac0f927e5f8c5dbc05312e6008fe7ea96b345)
|
|
64
|
-
* [Handle tagged crafting recipes](https://github.com/CyclopsMC/infobook-html/commit/d6d2dc821a868e790bc229da035c546a5b3e8ade)
|
|
65
|
-
* [Exit with non-zero exit code on error](https://github.com/CyclopsMC/infobook-html/commit/33e3ef8fee72fc72d5608ddb865c53c91b24f59c)
|
|
66
|
-
|
|
67
|
-
<a name="v1.0.1"></a>
|
|
68
|
-
## [v1.0.1](https://github.com/CyclopsMC/infobook-html/compare/v1.0.0...v1.0.1) - 2019-07-25
|
|
69
|
-
|
|
70
|
-
### Fixed
|
|
71
|
-
* [Package assets](https://github.com/CyclopsMC/infobook-html/commit/1d6eda2f7618a7fb312427481f90528dd07185c9)
|
|
72
|
-
|
|
73
|
-
<a name="v1.0.0"></a>
|
|
74
|
-
## [v1.0.0] - 2019-06-25
|
|
75
|
-
|
|
76
|
-
Initial release
|