Add support for 1.12.2 compiled with ForgeGradle 3. (#73)

The latest 1.12.2 builds have been upgraded to ForgeGradle 3. Handling is slighly different, as the version.json
format is different and no longer stored in the universal jar. You have to provide the version.json as a VersionManifest
module, the same as 1.13+. The rest of the launch handling hasn't changed.

Nebula supports the new 1.12.2 format.
This commit is contained in:
Daniel Scalzi
2020-06-02 19:30:12 -04:00
parent 1430d0faa2
commit 7f821f36d7
3 changed files with 233 additions and 89 deletions

View File

@@ -166,6 +166,31 @@ class Util {
return true
}
static isForgeGradle3(mcVersion, forgeVersion) {
if(Util.mcVersionAtLeast('1.13', mcVersion)) {
return true
}
let forgeVer = null
try {
forgeVer = forgeVersion.split('-')[1]
} catch(err) {
throw new Error('Forge version is complex (changed).. launcher requires a patch.')
}
const maxFG2 = [14, 23, 5, 2847]
const verSplit = forgeVer.split('.').map(v => Number(v))
for(let i=0; i<maxFG2.length; i++) {
if(verSplit[i] > maxFG2[i]) {
return true
}
}
return false
}
}
@@ -1446,7 +1471,7 @@ class AssetGuard extends EventEmitter {
for(let ob of modules){
const type = ob.getType()
if(type === DistroManager.Types.ForgeHosted || type === DistroManager.Types.Forge){
if(Util.mcVersionAtLeast('1.13', server.getMinecraftVersion())){
if(Util.isForgeGradle3(server.getMinecraftVersion(), ob.getVersion())){
// Read Manifest
for(let sub of ob.getSubModules()){
if(sub.getType() === DistroManager.Types.VersionManifest){