Skip to content

Commit 0daaa1d

Browse files
authored
fix: attach clientSideOnly to mods toml if found in root (#329)
* fix: attach clientSideOnly to mods toml if found in root * feat: write test * fix: other test
1 parent 91ed3c1 commit 0daaa1d

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed
1.08 KB
Binary file not shown.

packages/mod-parser/forge.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ describe('Forge', () => {
1616
test('should not crash if the toml does not have the dependencies', async ({ mock }) => {
1717
const metadata = await readForgeModToml(`${mock}/mods/sample-mod-1.13-no-deps.jar`)
1818
// eslint-disable-next-line no-template-curly-in-string
19-
expect(metadata).toEqual([{ authors: 'mezz', credits: '', dependencies: [], description: 'JEI is an item and recipe viewing mod for Minecraft, built from the ground up for stability and performance.\n', displayName: 'Just Enough Items', displayURL: 'https://minecraft.curseforge.com/projects/jei', issueTrackerURL: 'https://github.com/mezz/JustEnoughItems/issues?q=is%3Aissue', loaderVersion: '[14,)', logoFile: '', modLoader: 'javafml', modid: 'jei', provides: [], updateJSONURL: '', version: '${file.jarVersion}' }])
19+
expect(metadata).toEqual([{ authors: 'mezz', credits: '', dependencies: [], description: 'JEI is an item and recipe viewing mod for Minecraft, built from the ground up for stability and performance.\n', displayName: 'Just Enough Items', displayURL: 'https://minecraft.curseforge.com/projects/jei', issueTrackerURL: 'https://github.com/mezz/JustEnoughItems/issues?q=is%3Aissue', loaderVersion: '[14,)', logoFile: '', modLoader: 'javafml', modid: 'jei', provides: [], updateJSONURL: '', version: '${file.jarVersion}', clientSideOnly: false }])
20+
})
21+
22+
test('should read if the mod is client side only', async ({ mock }) => {
23+
const metadata = await readForgeModToml(`${mock}/mods/sample-mod-1.13-no-deps-client-only.jar`)
24+
expect(metadata).toEqual([{ authors: 'mezz', credits: '', dependencies: [], description: 'JEI is an item and recipe viewing mod for Minecraft, built from the ground up for stability and performance.\n', displayName: 'Just Enough Items', displayURL: 'https://minecraft.curseforge.com/projects/jei', issueTrackerURL: 'https://github.com/mezz/JustEnoughItems/issues?q=is%3Aissue', loaderVersion: '[14,)', logoFile: '', modLoader: 'javafml', modid: 'jei', provides: [], updateJSONURL: '', version: '${file.jarVersion}', clientSideOnly: true }])
2025
})
2126

2227
test('should read >1.13 forge mod jar', async ({ mock }) => {
@@ -67,6 +72,7 @@ describe('Forge', () => {
6772
modLoader: 'javafml',
6873
loaderVersion: '[14,)',
6974
version: '6.0.0.26',
75+
clientSideOnly: false,
7076
},
7177
],
7278
usedForgePackage: true,

packages/mod-parser/forge.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ export interface ForgeModTOMLData {
196196
* A URL to refer people to when problems occur with this mod
197197
*/
198198
issueTrackerURL: string
199+
/**
200+
* If true, the mod is client side only
201+
*/
202+
clientSideOnly: boolean
199203
}
200204

201205
export interface ForgeModASMData {
@@ -500,6 +504,7 @@ export async function readForgeModToml(mod: ForgeModInput, manifest?: Record<str
500504
loaderVersion: root.loaderVersion as string ?? '',
501505
modLoader: root.modLoader as string ?? '',
502506
issueTrackerURL: root.issueTrackerURL as string ?? '',
507+
clientSideOnly: (root.clientSideOnly as boolean) ?? (tomlMod.clientSideOnly as boolean) ?? false,
503508
}
504509
all.push(modObject)
505510
}

0 commit comments

Comments
 (0)