diff --git a/src/model/struct/model/module/forgemod.struct.ts b/src/model/struct/model/module/forgemod.struct.ts index aa0d214..b5e3a05 100644 --- a/src/model/struct/model/module/forgemod.struct.ts +++ b/src/model/struct/model/module/forgemod.struct.ts @@ -1,5 +1,5 @@ import { Stats } from 'fs-extra' -import { Type } from 'helios-distribution-types' +import { Type, Module } from 'helios-distribution-types' import { join } from 'path' import { resolve } from 'url' import { VersionSegmented } from '../../../../util/VersionSegmented' @@ -21,6 +21,15 @@ export abstract class BaseForgeModStructure extends ToggleableModuleStructure im super(absoluteRoot, relativeRoot, 'forgemods', baseUrl, minecraftVersion, Type.ForgeMod) } + public async getSpecModel(): Promise { + // Sort by file name to allow control of load order. + return (await super.getSpecModel()).sort((a, b) => { + const aFileName = a.artifact.url.substring(a.artifact.url.lastIndexOf('/')+1) + const bFileName = b.artifact.url.substring(b.artifact.url.lastIndexOf('/')+1) + return aFileName.localeCompare(bFileName) + }) + } + public abstract isForVersion(version: MinecraftVersion, libraryVersion: string): boolean // eslint-disable-next-line @typescript-eslint/no-unused-vars