fix: attach clientSideOnly to mods toml if found in root#329
fix: attach clientSideOnly to mods toml if found in root#329ci010 merged 3 commits intoVoxelum:masterfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes handling of the clientSideOnly property in Forge mod TOML files by checking for it both at the root level and within nested [[mods]] objects, addressing cases where some mods place this property at the root instead of the expected location.
- Added
clientSideOnlyproperty to theForgeModTOMLDatainterface - Updated mod parsing logic to check both root and nested mod object for
clientSideOnlyproperty
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
packages/mod-parser/forge.ts
Outdated
| loaderVersion: root.loaderVersion as string ?? '', | ||
| modLoader: root.modLoader as string ?? '', | ||
| issueTrackerURL: root.issueTrackerURL as string ?? '', | ||
| clientSideOnly: (root.clientSideOnly as boolean || tomlMod.clientSideOnly as boolean) ?? false, |
There was a problem hiding this comment.
The logical OR operator will not work as expected here. If root.clientSideOnly is false, the expression will evaluate tomlMod.clientSideOnly, potentially overriding an explicit false value. Use nullish coalescing instead: (root.clientSideOnly as boolean) ?? (tomlMod.clientSideOnly as boolean) ?? false
| clientSideOnly: (root.clientSideOnly as boolean || tomlMod.clientSideOnly as boolean) ?? false, | |
| clientSideOnly: (root.clientSideOnly as boolean) ?? (tomlMod.clientSideOnly as boolean) ?? false, |
|
Can you also update the test? Or I can merge first and add the test later. |
d678f9f to
4c478f6
Compare
Fixes #328
Some mods seem to just place it at the root instead of in the ``[[mods]]` nested object.