From 3b1b7d40f7416f9dc79c4bceb711ca192667bcc6 Mon Sep 17 00:00:00 2001 From: Kir_Antipov Date: Sat, 11 Mar 2023 14:03:43 +0000 Subject: [PATCH] Made an interface that represents `mods.toml` --- src/loaders/forge/raw-forge-metadata.ts | 105 ++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 src/loaders/forge/raw-forge-metadata.ts diff --git a/src/loaders/forge/raw-forge-metadata.ts b/src/loaders/forge/raw-forge-metadata.ts new file mode 100644 index 0000000..37114a3 --- /dev/null +++ b/src/loaders/forge/raw-forge-metadata.ts @@ -0,0 +1,105 @@ +import { ACTION_NAME } from "@/action"; +import { ForgeDependency } from "./forge-dependency"; +import { ForgeMod } from "./forge-mod"; +import { ForgeMetadataCustomPayload } from "./forge-metadata-custom-payload"; + +// TODO: Remove the deprecated stuff in v4.0. + +/** + * The metadata file for a Forge mod. + */ +export interface RawForgeMetadata { + /** + * The language loader for the mod. + * + * Used to specify an alternative language for the mod, such as Kotlin, if one exists. + * The Forge-provided Java loader is `javafml`. + */ + modLoader: string; + + /** + * The acceptable version range of the language loader, expressed as a Maven version spec. + * + * For the Forge-provided Java loader, the version is the major version of the Forge version. + */ + loaderVersion: string; + + /** + * The license for the mod(s) in this JAR. + * + * This string may be any valid string, but it is suggested to set the value to be the + * name of your license, and/or a link to that license. + */ + license: string; + + /** + * Whether to display this mod's resources as a separate option in the resource pack menu. + * + * If disabled, the mod's resources will be rolled into the "Mod resources" pack. + * + * Defaults to `false`. + */ + showAsResourcePack?: boolean; + + /** + * A table of custom substitution properties. + * + * This is used by `StringSubstitutor` to replace values, using `${file.*}`. + */ + properties?: Record; + + /** + * A URL for an issues tracker. + * + * This should never be a blank string, as that will cause an error. + */ + issueTrackerURL?: string; + + /** + * The mod properties, with a section for each mod. + */ + mods?: ForgeMod[]; + + /** + * Dependency configurations, with a section for each mod's dependencies. + */ + dependencies?: Record; + + /** + * Custom action payload. + */ + [ACTION_NAME]?: ForgeMetadataCustomPayload; + + /** + * Custom action payload (legacy). + * + * @deprecated + * + * Use [{@link ACTION_NAME}] instead. + */ + projects?: ForgeMetadataCustomPayload; + + /** + * Custom action payload (legacy). + * + * @deprecated + * + * Use [{@link ACTION_NAME}] instead. + */ + custom?: { + /** + * Custom action payload. + */ + [ACTION_NAME]?: ForgeMetadataCustomPayload; + + /** + * Custom action payload. + */ + projects?: ForgeMetadataCustomPayload; + }; +} + +/** + * Name of the `mods.toml` file, that contains raw Forge metadata. + */ +export const MODS_TOML = "META-INF/mods.toml";