1.12.2 Forge hotfix

This commit is contained in:
Pierce 2021-01-08 21:07:08 -05:00
parent 5e5cf5158e
commit 8812596cd4
3 changed files with 14 additions and 8 deletions

View file

@ -2,7 +2,7 @@
##### This project is complete for now. ##### This project is complete for now.
[![Build Status](https://travis-ci.com/Pierce01/MinecraftLauncher-core.svg?branch=master)](https://travis-ci.com/Pierce01/MinecraftLauncher-core) [![Build Status](https://travis-ci.com/Pierce01/MinecraftLauncher-core.svg?branch=master)](https://travis-ci.com/Pierce01/MinecraftLauncher-core)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![version](https://img.shields.io/badge/stable_version-3.16.0-blue) ![version](https://img.shields.io/badge/stable_version-3.16.1-blue)
![badge](https://img.shields.io/badge/ncurses-not_supported-purple) ![badge](https://img.shields.io/badge/ncurses-not_supported-purple)
MCLC (Minecraft Launcher Core) is a NodeJS solution for launching modded and vanilla Minecraft without having to download and format everything yourself. MCLC (Minecraft Launcher Core) is a NodeJS solution for launching modded and vanilla Minecraft without having to download and format everything yourself.

View file

@ -307,6 +307,10 @@ class Handler {
: this.options.customArgs = forgeWrapperAgrs : this.options.customArgs = forgeWrapperAgrs
} }
isModernForge (json) {
return json.inheritsFrom && json.inheritsFrom.split('.')[1] >= 12 && !(json.inheritsFrom === '1.12.2' && (json.id.split('.')[json.id.split('.').length - 1]) === '2847')
}
async getForgedWrapped () { async getForgedWrapped () {
let json = null let json = null
let installerJson = null let installerJson = null
@ -319,9 +323,11 @@ class Handler {
if (!json.forgeWrapperVersion || !(json.forgeWrapperVersion === this.options.fw.version)) { if (!json.forgeWrapperVersion || !(json.forgeWrapperVersion === this.options.fw.version)) {
this.client.emit('debug', '[MCLC]: Old ForgeWrapper has generated this version JSON, re-generating') this.client.emit('debug', '[MCLC]: Old ForgeWrapper has generated this version JSON, re-generating')
} else { } else {
// If forge is modern, add ForgeWrappers launch arguments and set forge to null so MCLC treats it as a custom json.
if (this.isModernForge(json)) {
this.fwAddArgs() this.fwAddArgs()
// Make MCLC treat modern forge as a custom version json rather then legacy forge.
this.options.forge = null this.options.forge = null
}
return json return json
} }
} catch (e) { } catch (e) {
@ -352,8 +358,8 @@ class Handler {
// Holder for the specifc jar ending which depends on the specifc forge version. // Holder for the specifc jar ending which depends on the specifc forge version.
let jarEnding = 'universal' let jarEnding = 'universal'
// We need to handle modern forge differently than legacy. // We need to handle modern forge differently than legacy.
if (json.inheritsFrom && json.inheritsFrom.split('.')[1] >= 12) { if (this.isModernForge(json)) {
// If forge is modern and above 1.12, we add ForgeWrapper to the libraries so MCLC includes it in the classpaths. // If forge is modern and above 1.12.2, we add ForgeWrapper to the libraries so MCLC includes it in the classpaths.
if (json.inheritsFrom !== '1.12.2') { if (json.inheritsFrom !== '1.12.2') {
this.fwAddArgs() this.fwAddArgs()
const fwName = `ForgeWrapper-${this.options.fw.version}.jar` const fwName = `ForgeWrapper-${this.options.fw.version}.jar`
@ -440,7 +446,7 @@ class Handler {
fs.writeFileSync(versionPath, JSON.stringify(json, null, 4)) fs.writeFileSync(versionPath, JSON.stringify(json, null, 4))
// Make MCLC treat modern forge as a custom version json rather then legacy forge. // Make MCLC treat modern forge as a custom version json rather then legacy forge.
this.options.forge = null if (this.isModernForge(json)) this.options.forge = null
return json return json
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "minecraft-launcher-core", "name": "minecraft-launcher-core",
"version": "3.16.0", "version": "3.16.1",
"description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS", "description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {