From 03cc643a6e3cf309fa76dac47b39de7f48024b0d Mon Sep 17 00:00:00 2001 From: Kir_Antipov Date: Tue, 5 Jul 2022 19:24:25 +0300 Subject: [PATCH] Fabric mods can be marked as Quilt-compatible --- README.md | 18 +++++++++++++++++- src/metadata/fabric/fabric-mod-metadata.ts | 9 ++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6746ab5..428511c 100644 --- a/README.md +++ b/README.md @@ -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 + } + }, + } + ``` + +
```yaml loaders: | diff --git a/src/metadata/fabric/fabric-mod-metadata.ts b/src/metadata/fabric/fabric-mod-metadata.ts index 0a6b8d5..c411171 100644 --- a/src/metadata/fabric/fabric-mod-metadata.ts +++ b/src/metadata/fabric/fabric-mod-metadata.ts @@ -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)); }