Fabric mods can be marked as Quilt-compatible

This commit is contained in:
Kir_Antipov 2022-07-05 19:24:25 +03:00
parent 411eed8f51
commit 03cc643a6e
2 changed files with 25 additions and 2 deletions

View file

@ -525,7 +525,23 @@ changelog-file: CHANGELOG.md
#### loaders
A list of supported mod loaders. If no value is provided, `fabric` will be used for valid Fabric mods, `forge` will be used for valid Forge mods, and `quilt` will be used for valid Quilt mods.
A list of supported mod loaders. If no value is provided, `fabric` will be used for valid Fabric mods, `forge` will be used for valid Forge mods, `quilt` will be used for valid Quilt mods, and `fabric, quilt` will be used for Fabric mods that were marked as Quilt-compatible.
Fabric mods can be marked as Quilt-compatible like so:
- `fabric.mod.json`
```json
{
// ...
"custom": {
"mc-publish": {
"quilt": true
}
},
}
```
<br>
```yaml
loaders: |

View file

@ -39,6 +39,13 @@ function getDependenciesByKind(config: any, kind: DependencyKind): Dependency[]
return dependencies;
}
function getLoaders(config: any): string[] {
if (config[action.name]?.quilt ?? config.custom?.[action.name]?.quilt) {
return ["fabric", "quilt"];
}
return ["fabric"];
}
export default class FabricModMetadata extends ModConfig {
public readonly id: string;
public readonly name: string;
@ -51,7 +58,7 @@ export default class FabricModMetadata extends ModConfig {
this.id = String(this.config.id ?? "");
this.name = String(this.config.name ?? this.id);
this.version = String(this.config.version ?? "*");
this.loaders = ["fabric"];
this.loaders = getLoaders(this.config);
this.dependencies = DependencyKind.getValues().flatMap(x => getDependenciesByKind(this.config, x));
}