You've already forked AstralRinth
fix: babric mods incorrectly detected as fabric (#6407)
* fix: babric mods incorrectly detected as fabric * remove: standard version, just check for fabric normalized beta version number * add comment
This commit is contained in:
@@ -132,23 +132,39 @@ export function createLoaderParsers(
|
|||||||
),
|
),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Fabric
|
// Fabric (or Babric for mc version beta 1.7.3)
|
||||||
'fabric.mod.json': (file: string): InferredVersionInfo => {
|
'fabric.mod.json': (file: string): InferredVersionInfo => {
|
||||||
const metadata = JSON.parse(file) as any
|
const metadata = JSON.parse(file) as any
|
||||||
|
|
||||||
const detectedGameVersions = metadata.depends
|
const mcDependency = metadata.depends?.minecraft
|
||||||
|
const mcDependencies = Array.isArray(mcDependency) ? mcDependency : [mcDependency]
|
||||||
|
|
||||||
|
let detectedGameVersions = metadata.depends
|
||||||
? getGameVersionsMatchingSemverRange(metadata.depends.minecraft, simplifiedGameVersions)
|
? getGameVersionsMatchingSemverRange(metadata.depends.minecraft, simplifiedGameVersions)
|
||||||
: []
|
: []
|
||||||
const loaders: string[] = []
|
const loaders: string[] = []
|
||||||
|
|
||||||
|
// Detect Beta 1.7.3 -> Babric
|
||||||
|
const hasBabricVersion = mcDependencies.some(
|
||||||
|
(version: string | undefined) => version?.includes('1.0.0-beta.7.3'), // this is fabric's normalized mc version format
|
||||||
|
)
|
||||||
|
|
||||||
// Detect 1.3-1.13 -> legacy-fabric
|
// Detect 1.3-1.13 -> legacy-fabric
|
||||||
const hasLegacyVersions = detectedGameVersions.some((version) => {
|
const hasLegacyVersions = detectedGameVersions.some((version) => {
|
||||||
const match = version.match(/^1\.(\d+)/)
|
const match = version.match(/^1\.(\d+)/)
|
||||||
return match && parseInt(match[1]) >= 3 && parseInt(match[1]) <= 13
|
return match && parseInt(match[1]) >= 3 && parseInt(match[1]) <= 13
|
||||||
})
|
})
|
||||||
|
|
||||||
if (hasLegacyVersions) loaders.push('legacy-fabric')
|
if (hasBabricVersion) {
|
||||||
else loaders.push('fabric')
|
loaders.push('babric')
|
||||||
|
detectedGameVersions = gameVersions
|
||||||
|
.filter((version) => version.version === 'b1.7.3')
|
||||||
|
.map((version) => version.version)
|
||||||
|
} else if (hasLegacyVersions) {
|
||||||
|
loaders.push('legacy-fabric')
|
||||||
|
} else {
|
||||||
|
loaders.push('fabric')
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: `${project.title} ${metadata.version}`,
|
name: `${project.title} ${metadata.version}`,
|
||||||
|
|||||||
Reference in New Issue
Block a user