1.13 Update Phase 1

Mojang has changed its manifest format for 1.13.
Forge is no longer a universal jar, it requires more hosted files, all of which are generated by the installer.
We can no longer extract the version manifest from forge's jar and have to include it in the distribution.
This commit adds support for launching forge only, mods are currently not supported from the distribution.
Handling of 1.13 launches are subject to change as we move forward.
This commit is contained in:
Daniel Scalzi 2019-02-18 06:31:01 -05:00
parent e8e7f85c64
commit 81367bc619
No known key found for this signature in database
GPG Key ID: D18EA3FB4B142A57
6 changed files with 614 additions and 103 deletions

View File

@ -15,7 +15,7 @@
"name": "WesterosCraft Production Server",
"description": "Main WesterosCraft server. Connect to enter the Realm.",
"icon": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/server-prod.png",
"version": "3.9.0",
"version": "3.9.4",
"address": "mc.westeroscraft.com",
"minecraftVersion": "1.11.2",
"discord": {
@ -219,22 +219,22 @@
]
},
{
"id": "com.westeroscraft:westerosblocks:3.1.0-alpha-2-138",
"id": "com.westeroscraft:westerosblocks:3.2.0-beta-1-190",
"name": "WesterosBlocks",
"type": "ForgeMod",
"artifact": {
"size": 17352677,
"MD5": "b5409aa925a47f67158c8141e71f723f",
"size": 17376788,
"MD5": "370f4f1804c93f498f31af8dac509605",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/prod-1.11.2/mods/WesterosBlocks.jar"
}
},
{
"id": "com.westeroscraft:westeroscraftrp:2018-07-21",
"id": "com.westeroscraft:westeroscraftrp:2019-01-21",
"name": "WesterosCraft Resource Pack",
"type": "File",
"artifact": {
"size": 46942221,
"MD5": "26e3e63a5778691eb3a9db11f449fdf1",
"size": 46999843,
"MD5": "309eb9e5296e9f55cfecb7d4058245a4",
"path": "resourcepacks/WesterosCraft.zip",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/prod-1.11.2/resourcepacks/WesterosCraft.zip"
}
@ -260,15 +260,15 @@
}
},
{
"id": "org.blockartistry:dynsurround:1.11.2-3.4.6.2",
"id": "org.blockartistry:dynsurround:1.11.2-3.4.9.3",
"name": "DynamicSurroundings",
"type": "ForgeMod",
"required": {
"value": false
},
"artifact": {
"size": 21853035,
"MD5": "82a6aac5420151960b8dd709deee5423",
"size": 22291385,
"MD5": "65403c66d8b3655b372f58047941d206",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/prod-1.11.2/mods/DynamicSurroundings.jar"
},
"subModules": [
@ -278,7 +278,6 @@
"type": "File",
"artifact": {
"size": 20258,
"MD5": "3df81248db151750b7d0a0193b327b47",
"path": "/config/dsurround/dsurround.cfg",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/prod-1.11.2/config/dsurround/dsurround.cfg"
}
@ -297,15 +296,15 @@
]
},
{
"id": "octarine-noise:betterfoliage:1.11.2-2.1.8",
"id": "octarine-noise:betterfoliage:1.11.2-2.1.10",
"name": "BetterFoliage",
"type": "ForgeMod",
"required": {
"value": false
},
"artifact": {
"size": 4676029,
"MD5": "b2dd47e42da56fb49a07a0d38df91bc4",
"size": 4675903,
"MD5": "522fdf73b6e4343cb6243872fb7b4b6c",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/prod-1.11.2/mods/BetterFoliage.jar"
},
"subModules": [
@ -430,7 +429,7 @@
"name": "WesterosCraft Test Server",
"description": "Main testing server. Experimental changes are live here.",
"icon": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/server-test.png",
"version": "3.8.3",
"version": "3.9.4",
"address": "mc.westeroscraft.com:4444",
"minecraftVersion": "1.11.2",
"discord": {
@ -634,22 +633,22 @@
]
},
{
"id": "com.westeroscraft:westerosblocks:3.1.0-alpha-2-138",
"id": "com.westeroscraft:westerosblocks:3.2.0-beta-1-190",
"name": "WesterosBlocks",
"type": "ForgeMod",
"artifact": {
"size": 17352677,
"MD5": "b5409aa925a47f67158c8141e71f723f",
"size": 17376788,
"MD5": "370f4f1804c93f498f31af8dac509605",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/test-1.11.2/mods/WesterosBlocks.jar"
}
},
{
"id": "com.westeroscraft:westeroscraftrp:2018-07-21",
"id": "com.westeroscraft:westeroscraftrp:2019-01-21",
"name": "WesterosCraft Resource Pack",
"type": "File",
"artifact": {
"size": 46942221,
"MD5": "26e3e63a5778691eb3a9db11f449fdf1",
"size": 46999843,
"MD5": "309eb9e5296e9f55cfecb7d4058245a4",
"path": "resourcepacks/WesterosCraft.zip",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/test-1.11.2/resourcepacks/WesterosCraft.zip"
}
@ -693,7 +692,6 @@
"type": "File",
"artifact": {
"size": 20849,
"MD5": "8d6c08c158aa846162e2a179d6228181",
"path": "/config/dsurround/dsurround.cfg",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/test-1.11.2/config/dsurround/dsurround.cfg"
}
@ -857,13 +855,13 @@
"autoconnect": true,
"modules": [
{
"id": "net.minecraftforge:forge:1.12.2-14.23.2.2651",
"id": "net.minecraftforge:forge:1.12.2-14.23.5.2797",
"name": "Minecraft Forge",
"type": "ForgeHosted",
"artifact": {
"size": 4823957,
"MD5": "42d3aec7cdd6e4e49b4ff77a1db7c3a9",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/forge-1.12.2-14.23.2.2651-universal.jar"
"size": 4937218,
"MD5": "5320593704af58b3906e7106d27e41c8",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/forge-1.12.2-14.23.5.2797-universal.jar"
},
"subModules": [
{
@ -1046,6 +1044,16 @@
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/jopt-simple-5.0.3.jar"
}
},
{
"id": "org.apache.maven:maven-artifact:3.5.3",
"name": "maven-artifact",
"type": "Library",
"artifact": {
"size": 54961,
"MD5": "7741ebf29690ee7d9dde9cf4376347fc",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/maven-artifact-3.5.3.jar"
}
},
{
"id": "net.minecraftforge:MercuriusUpdater:1.12.2",
"name": "MercuriusUpdater",
@ -1059,56 +1067,56 @@
]
},
{
"id": "com.westeroscraft:westerosblocks:3.1.0-alpha-2-10",
"id": "com.westeroscraft:westerosblocks:4.0.0-beta-1-66",
"name": "WesterosBlocks",
"type": "ForgeMod",
"artifact": {
"size": 17261877,
"MD5": "f23568619e6fc2bf0cdbdcc05b6a8af9",
"size": 17286330,
"MD5": "e5c38ef42e9cc4b957122207dcf95f4f",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/test-1.12.2/mods/WesterosBlocks.jar"
}
},
{
"id": "com.westeroscraft:westeroscraftrp:2018-07-21",
"id": "com.westeroscraft:westeroscraftrp:2019-01-21",
"name": "WesterosCraft Resource Pack",
"type": "File",
"artifact": {
"size": 46944689,
"MD5": "caa806fb84e56c6c230e56b17670f2bc",
"size": 47002312,
"MD5": "86b169611ca0e51fdc47384d8423c402",
"path": "resourcepacks/WesterosCraft.zip",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/test-1.12.2/resourcepacks/WesterosCraft.zip"
}
},
{
"id": "net.optifine:optifine:1.12.2_HD_U_D1",
"id": "net.optifine:optifine:1.12.2_HD_U_E3",
"name": "Optifine",
"type": "ForgeMod",
"artifact": {
"size": 2372821,
"MD5": "4bfc1c95dde8ec08568e01bfaa61e7c5",
"size": 2444057,
"MD5": "7ec95c57ac1a224d6eb93bd370e4ac37",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/test-1.12.2/mods/OptiFine.jar"
}
},
{
"id": "mezz:jei:1.12.2-4.8.5.151",
"id": "mezz:jei:1.12.2-4.14.3.242",
"name": "JustEnoughItems",
"type": "ForgeMod",
"artifact": {
"size": 545366,
"MD5": "7194b7b1f1ea6ad20013c596319db5b0",
"size": 620682,
"MD5": "ae6d0e6e873ef6c20f41097dc7fee8c6",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/test-1.12.2/mods/jei.jar"
}
},
{
"id": "org.blockartistry:dynsurround:1.12.2-3.4.9.3",
"id": "org.blockartistry:dynsurround:1.12.2-3.4.10.5",
"name": "DynamicSurroundings",
"type": "ForgeMod",
"required": {
"value": false
},
"artifact": {
"size": 22298474,
"MD5": "115baf8e5f4e7d9757a2a85fb3507789",
"size": 22507134,
"MD5": "3d75602c66b7ccfc23c342e8d5e07469",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/test-1.12.2/mods/DynamicSurroundings.jar"
},
"subModules": [
@ -1117,8 +1125,7 @@
"name": "DynamicSurroundings General Configuration File",
"type": "File",
"artifact": {
"size": 21195,
"MD5": "850f1103765f45698954b4e3b0b0369d",
"size": 22179,
"path": "/config/dsurround/dsurround.cfg",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/test-1.12.2/config/dsurround/dsurround.cfg"
}
@ -1137,15 +1144,15 @@
]
},
{
"id": "octarine-noise:betterfoliage:1.12-2.1.10",
"id": "octarine-noise:betterfoliage:1.12-2.2.0",
"name": "BetterFoliage",
"type": "ForgeMod",
"required": {
"value": false
},
"artifact": {
"size": 4671397,
"MD5": "06714eb2c13f59df5e3c92cec7370e11",
"size": 926081,
"MD5": "e05a720c5900b9bac4e01179abe8eef6",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/test-1.12.2/mods/BetterFoliage.jar"
},
"subModules": [
@ -1163,28 +1170,38 @@
]
},
{
"id": "techbrew:journeymap:1.12.2-5.5.2",
"id": "forgelin:forgelin:1.8.2",
"name": "Forgelin",
"type": "ForgeMod",
"artifact": {
"size": 5124663,
"MD5": "59035365f7af35f599d1c4baade64d8b",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/test-1.12.2/mods/Forgelin.jar"
}
},
{
"id": "techbrew:journeymap:1.12.2-5.5.3",
"name": "JourneyMap",
"type": "ForgeMod",
"required": {
"value": false
},
"artifact": {
"size": 1822850,
"MD5": "b743562dac1b5334c20ac87b54c0b518",
"size": 1831161,
"MD5": "d3b5a672d2393f9fe63903598d50c769",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/test-1.12.2/mods/journeymap.jar"
}
},
{
"id": "com.github.hexomod:worldeditcuife2:2.1.2-mf-1.12.2-14.23.0.2487",
"id": "com.github.hexomod:worldeditcuife2:2.2.0-mf-1.12.2-14.23.5.2768",
"name": "WorldEditCUI",
"type": "ForgeMod",
"required": {
"value": false
},
"artifact": {
"size": 461808,
"MD5": "44b1b1031c25f04955bfd7ed734bd467",
"size": 459294,
"MD5": "2b8c1c3bc48c2d80b71daa658f656edb",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/test-1.12.2/mods/worldeditcuife.jar"
}
},
@ -1219,14 +1236,14 @@
]
},
{
"id": "com.sonicether:seus:11.0",
"name": "Sonic Ether's Unbelievable Shaders",
"id": "com.sonicether:seus-renewed:1.0.0",
"name": "Sonic Ether's Unbelievable Shaders Renewed",
"type": "File",
"artifact": {
"size": 175159,
"MD5": "bfa8c31d1da8131b59917bb2460205b1",
"path": "shaderpacks/SEUS v11.0.zip",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/test-1.12.2/shaderpacks/SEUS.zip"
"size": 7062491,
"MD5": "e68cc9f8ffc8fad66583b9b2cc05356f",
"path": "shaderpacks/SEUS-Renewed.zip",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/test-1.12.2/shaderpacks/SEUS-Renewed.zip"
}
},
{
@ -1251,6 +1268,287 @@
}
}
]
},
{
"id": "WesterosCraftTest-1.13.2",
"name": "WesterosCraft 1.13.2 Test Server",
"description": "Tests for our version change to 1.13.2 are live here.",
"icon": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/server-test.png",
"version": "5.0.0",
"address": "mc.westeroscraft.com:4445",
"minecraftVersion": "1.13.2",
"discord": {
"shortId": "1.13.2 Test Server",
"largeImageText": "WesterosCraft 1.13.2 Test Server",
"largeImageKey": "server-test"
},
"mainServer": false,
"autoconnect": false,
"modules": [
{
"id": "net.minecraftforge:forge:1.13.2-25.0.26",
"name": "Minecraft Forge (base jar)",
"type": "ForgeHosted",
"artifact": {
"size": 4937218,
"MD5": "6efa97b23a1a0982fbdb61168f972045",
"url": ""
},
"subModules": [
{
"id": "net.minecraftforge:forge:1.13.2-25.0.26:universal",
"name": "Minecraft Forge (universal jar)",
"type": "Library",
"artifact": {
"size": 2234772 ,
"MD5": "d35aa9e0a2149682716244373a369ce3",
"url": ""
}
},
{
"id": "net.minecraftforge:forge:1.13.2-25.0.26:client",
"name": "Minecraft Forge (client jar)",
"type": "Library",
"artifact": {
"size": 2928187,
"MD5": "6454bbb04448b3a1a6adde4f827ce73d",
"url": ""
}
},
{
"id": "net.minecraft:client:1.13.2:data",
"name": "Minecraft Forge (client data)",
"type": "Library",
"artifact": {
"size": 9622361,
"MD5": "dc66e2219e3de6e7ca05847fd3c7746d",
"url": ""
}
},
{
"id": "net.minecraft:client:1.13.2:extra",
"name": "Minecraft Forge (client extra)",
"type": "Library",
"artifact": {
"size": 22,
"MD5": "76cdb2bad9582d23c1f6f4d868218d6c",
"url": ""
}
},
{
"id": "net.minecraft:client:1.13.2-20190213.203750:srg",
"name": "Minecraft Forge (client srg)",
"type": "Library",
"artifact": {
"size": 8198877,
"MD5": "9cb4b80fe6949e74b6f6c11d640747ae",
"url": ""
}
},
{
"id": "1.13.2-forge-25.0.26",
"name": "Minecraft Forge (version.jar)",
"type": "VersionJar",
"artifact": {
"size": 16089640,
"MD5": "0d20673fc03f9c6a60279146ee1b1a14",
"url": ""
}
},
{
"id": "1.13.2-forge-25.0.26",
"name": "Minecraft Forge (version.json)",
"type": "VersionManifest",
"artifact": {
"size": 10466,
"MD5": "bc27fba2e3551d77bfbb06614398cf33",
"url": ""
}
},
{
"id": "com.paulscode:soundsystem:201809301515",
"name": "Minecraft Forge (Paul's Code Soundsystem)",
"type": "Library",
"artifact": {
"size": 66607,
"MD5": "bf43e7b9f628534614b3fc5e4e69d209",
"url": ""
}
},
{
"id": "org.ow2.asm:asm:6.2",
"name": "Minecraft Forge (asm)",
"type": "Library",
"artifact": {
"size": 111214,
"MD5": "7abdce94068615d690495f45eb6eb980",
"url": ""
}
},
{
"id": "org.ow2.asm:asm-commons:6.2",
"name": "Minecraft Forge (asm-commons)",
"type": "Library",
"artifact": {
"size": 78919,
"MD5": "a031c9a32770c02c2f91d2bcbeceabcd",
"url": ""
}
},
{
"id": "org.ow2.asm:asm-tree:6.2",
"name": "Minecraft Forge (asm-tree)",
"type": "Library",
"artifact": {
"size": 50370,
"MD5": "e7279981c6764dcd73a99705acf5c9a6",
"url": ""
}
},
{
"id": "cpw.mods:modlauncher:0.9.5",
"name": "Minecraft Forge (modlauncher)",
"type": "Library",
"artifact": {
"size": 78880,
"MD5": "13e299c5af2eb3707108fda0e09307d4",
"url": ""
}
},
{
"id": "net.minecraftforge:accesstransformers:0.14.4-shadowed",
"name": "Minecraft Forge (Access Transformers)",
"type": "Library",
"artifact": {
"size": 441002,
"MD5": "b56c2d2faeef20dd870d47c442e73a35",
"url": ""
}
},
{
"id": "net.minecraftforge:eventbus:0.7.1-service",
"name": "Minecraft Forge (EventBus)",
"type": "Library",
"artifact": {
"size": 36617,
"MD5": "a23071862888fee2b36882546c53dc98",
"url": ""
}
},
{
"id": "net.minecraftforge:forgespi:0.6.0",
"name": "Minecraft Forge (Forge SPI)",
"type": "Library",
"artifact": {
"size": 15429,
"MD5": "3a9ac484bde11412cb8112f67ed91b97",
"url": ""
}
},
{
"id": "net.minecraftforge:coremods:0.3.0",
"name": "Minecraft Forge (coremods)",
"type": "Library",
"artifact": {
"size": 10598,
"MD5": "2f16029f918a74f9d550417cfc35a287",
"url": ""
}
},
{
"id": "com.electronwill.night-config:core:3.4.2",
"name": "Minecraft Forge (night-config core)",
"type": "Library",
"artifact": {
"size": 189896,
"MD5": "a96945eb67f63c9014b950c037d7a605",
"url": ""
}
},
{
"id": "com.electronwill.night-config:toml:3.4.2",
"name": "Minecraft Forge (night-config toml)",
"type": "Library",
"artifact": {
"size": 30619,
"MD5": "b0030fa6166179c0a971fd53e8fcfbfc",
"url": ""
}
},
{
"id": "org.jline:jline:3.9.0",
"name": "Minecraft Forge (jline)",
"type": "Library",
"artifact": {
"size": 707273,
"MD5": "2db9aae140f810a72fc4a5cb5aa5cf9b",
"url": ""
}
},
{
"id": "org.apache.maven:maven-artifact:3.6.0",
"name": "Minecraft Forge (maven-artifact)",
"type": "Library",
"artifact": {
"size": 55051,
"MD5": "89e95013b11f347e48c0525965600404",
"url": ""
}
},
{
"id": "net.jodah:typetools:0.6.0",
"name": "Minecraft Forge (typetools)",
"type": "Library",
"artifact": {
"size": 14734,
"MD5": "9f65b6e90eb986fe25afc39b8ed3f43b",
"url": ""
}
},
{
"id": "java3d:vecmath:1.5.2",
"name": "Minecraft Forge (vecmath)",
"type": "Library",
"artifact": {
"size": 318956,
"MD5": "e5d2b7f46c4800a32f62ce75676a5710",
"url": ""
}
},
{
"id": "org.apache.logging.log4j:log4j-api:2.11.1",
"name": "Minecraft Forge (log4j-api)",
"type": "Library",
"artifact": {
"size": 264060,
"MD5": "fc110208241ce5b48bd07464ecc7e137",
"url": ""
}
},
{
"id": "org.apache.logging.log4j:log4j-core:2.11.1",
"name": "Minecraft Forge (log4j-core)",
"type": "Library",
"artifact": {
"size": 1607947,
"MD5": "b2242de0677be6515d6cefbf48e7e5d5",
"url": ""
}
},
{
"id": "net.minecrell:terminalconsoleappender:1.1.1",
"name": "Minecraft Forge (terminalconsoleappender)",
"type": "Library",
"artifact": {
"size": 15240,
"MD5": "a190e88073a41dfa1b1d47854c41230b",
"url": ""
}
}
]
}
]
}
]
}

View File

@ -33,7 +33,7 @@ process.on('message', (msg) => {
res.then((v) => {
process.send({result: v, context: func})
}).catch((err) => {
process.send({result: err.message, context: func})
process.send({result: err.message || err, context: func})
})
} else {
process.send({result: res, context: func})

View File

@ -1401,14 +1401,30 @@ class AssetGuard extends EventEmitter {
for(let ob of modules){
const type = ob.getType()
if(type === DistroManager.Types.ForgeHosted || type === DistroManager.Types.Forge){
if(AssetGuard.mcVersionAtLeast('1.13', server.getMinecraftVersion())){
for(let sub of ob.getSubModules()){
if(sub.getType() === DistroManager.Types.VersionManifest){
const versionFile = path.join(self.commonPath, 'versions', sub.getIdentifier(), `${sub.getIdentifier()}.json`)
resolve(JSON.parse(fs.readFileSync(versionFile, 'utf-8')))
return
}
}
reject('No forge version manifest found!')
return
} else {
let obArtifact = ob.getArtifact()
let obPath = obArtifact.getPath()
let asset = new DistroModule(ob.getIdentifier(), obArtifact.getHash(), obArtifact.getSize(), obArtifact.getURL(), obPath, type)
try {
let forgeData = await AssetGuard._finalizeForgeAsset(asset, self.commonPath)
resolve(forgeData)
} catch (err){
reject(err)
}
return
}
}
}
reject('No forge module found!')
})
}
@ -1686,6 +1702,7 @@ class AssetGuard extends EventEmitter {
async validateEverything(serverid, dev = false){
try {
if(!ConfigManager.isLoaded()){
ConfigManager.load()
}
@ -1715,6 +1732,15 @@ class AssetGuard extends EventEmitter {
forgeData
}
} catch (err){
return {
versionData: null,
forgeData: null,
error: err
}
}
}
// #endregion

View File

@ -163,6 +163,7 @@ class Module {
const m1 = m0[0].split(':')
this.artifactClassifier = m1[3] || undefined
this.artifactVersion = m1[2] || '???'
this.artifactID = m1[1] || '???'
this.artifactGroup = m1[0] || '???'
@ -174,7 +175,7 @@ class Module {
}
_resolveArtifactPath(artifactPath, serverid){
const pth = artifactPath == null ? path.join(...this.getGroup().split('.'), this.getID(), this.getVersion(), `${this.getID()}-${this.getVersion()}.${this.getExtension()}`) : artifactPath
const pth = artifactPath == null ? path.join(...this.getGroup().split('.'), this.getID(), this.getVersion(), `${this.getID()}-${this.getVersion()}${this.artifactClassifier != undefined ? `-${this.artifactClassifier}` : ''}.${this.getExtension()}`) : artifactPath
switch (this.type){
case exports.Types.Library:
@ -186,6 +187,12 @@ class Module {
case exports.Types.LiteMod:
this.artifact.path = path.join(ConfigManager.getCommonDirectory(), 'modstore', pth)
break
case exports.Types.VersionManifest:
this.artifact.path = path.join(ConfigManager.getCommonDirectory(), 'versions', this.getIdentifier(), `${this.getIdentifier()}.json`)
break
case exports.Types.VersionJar:
this.artifact.path = path.join(ConfigManager.getCommonDirectory(), 'versions', this.getIdentifier(), `${this.getIdentifier()}.jar`)
break
case exports.Types.File:
default:
this.artifact.path = path.join(ConfigManager.getInstanceDirectory(), serverid, pth)
@ -267,6 +274,13 @@ class Module {
return this.artifactVersion
}
/**
* @returns {string} The classifier of this module's artifact
*/
getClassifier(){
return this.artifactClassifier
}
/**
* @returns {string} The extension of this module's artifact.
*/
@ -507,7 +521,9 @@ exports.Types = {
LiteLoader: 'LiteLoader',
ForgeMod: 'ForgeMod',
LiteMod: 'LiteMod',
File: 'File'
File: 'File',
VersionManifest: 'VersionManifest',
VersionJar: 'VersionJar'
}
let DEV_MODE = false

View File

@ -6,7 +6,7 @@ const os = require('os')
const path = require('path')
const { URL } = require('url')
const { Library } = require('./assetguard')
const { AssetGuard, Library } = require('./assetguard')
const ConfigManager = require('./configmanager')
const DistroManager = require('./distromanager')
const LoggerUtil = require('./loggerutil')
@ -15,13 +15,14 @@ const logger = LoggerUtil('%c[ProcessBuilder]', 'color: #003996; font-weight: bo
class ProcessBuilder {
constructor(distroServer, versionData, forgeData, authUser){
constructor(distroServer, versionData, forgeData, authUser, launcherVersion){
this.gameDir = path.join(ConfigManager.getInstanceDirectory(), distroServer.getID())
this.commonDir = ConfigManager.getCommonDirectory()
this.server = distroServer
this.versionData = versionData
this.forgeData = forgeData
this.authUser = authUser
this.launcherVersion = launcherVersion
this.fmlDir = path.join(this.gameDir, 'forgeModList.json')
this.llDir = path.join(this.gameDir, 'liteloaderModList.json')
this.libPath = path.join(this.commonDir, 'libraries')
@ -240,6 +241,22 @@ class ProcessBuilder {
* @returns {Array.<string>} An array containing the full JVM arguments for this process.
*/
constructJVMArguments(mods, tempNativePath){
if(AssetGuard.mcVersionAtLeast('1.13', this.server.getMinecraftVersion())){
return this._constructJVMArguments113(mods, tempNativePath)
} else {
return this._constructJVMArguments112(mods, tempNativePath)
}
}
/**
* Construct the argument array that will be passed to the JVM process.
* This function is for 1.12 and below.
*
* @param {Array.<Object>} mods An array of enabled mods which will be launched with this process.
* @param {string} tempNativePath The path to store the native libraries.
* @returns {Array.<string>} An array containing the full JVM arguments for this process.
*/
_constructJVMArguments112(mods, tempNativePath){
let args = []
@ -266,6 +283,154 @@ class ProcessBuilder {
return args
}
/**
* Construct the argument array that will be passed to the JVM process.
* This function is for 1.13+
*
* Note: Required Libs https://github.com/MinecraftForge/MinecraftForge/blob/af98088d04186452cb364280340124dfd4766a5c/src/fmllauncher/java/net/minecraftforge/fml/loading/LibraryFinder.java#L82
*
* @param {Array.<Object>} mods An array of enabled mods which will be launched with this process.
* @param {string} tempNativePath The path to store the native libraries.
* @returns {Array.<string>} An array containing the full JVM arguments for this process.
*/
_constructJVMArguments113(mods, tempNativePath){
const argDiscovery = /\${*(.*)}/
// JVM Arguments First
let args = this.versionData.arguments.jvm
// Java Arguments
if(process.platform === 'darwin'){
args.push('-Xdock:name=WesterosCraft')
args.push('-Xdock:icon=' + path.join(__dirname, '..', 'images', 'minecraft.icns'))
}
args.push('-Xmx' + ConfigManager.getMaxRAM())
args.push('-Xms' + ConfigManager.getMinRAM())
args = args.concat(ConfigManager.getJVMOptions())
// Main Java Class
args.push(this.forgeData.mainClass)
// Vanilla Arguments
args = args.concat(this.versionData.arguments.game)
for(let i=0; i<args.length; i++){
if(typeof args[i] === 'object' && args[i].rules != null){
let checksum = 0
for(let rule of args[i].rules){
if(rule.os != null){
if(rule.os.name === Library.mojangFriendlyOS()
&& (rule.os.version == null || new RegExp(rule.os.version).test(os.release))){
if(rule.action === 'allow'){
checksum++
}
} else {
if(rule.action === 'disallow'){
checksum++
}
}
} else if(rule.features != null){
// We don't have many 'features' in the index at the moment.
// This should be fine for a while.
if(rule.features.has_custom_resolution != null && rule.features.has_custom_resolution === true){
if(ConfigManager.getFullscreen()){
rule.values = [
'--fullscreen',
'true'
]
}
checksum++
}
}
}
// TODO splice not push
if(checksum === args[i].rules.length){
if(typeof args[i].value === 'string'){
args[i] = args[i].value
} else if(typeof args[i].value === 'object'){
//args = args.concat(args[i].value)
args.splice(i, 1, ...args[i].value)
}
// Decrement i to reprocess the resolved value
i--
} else {
args[i] = null
}
} else if(typeof args[i] === 'string'){
if(argDiscovery.test(args[i])){
const identifier = args[i].match(argDiscovery)[1]
let val = null
switch(identifier){
case 'auth_player_name':
val = this.authUser.displayName.trim()
break
case 'version_name':
//val = versionData.id
val = this.server.getID()
break
case 'game_directory':
val = this.gameDir
break
case 'assets_root':
val = path.join(this.commonDir, 'assets')
break
case 'assets_index_name':
val = this.versionData.assets
break
case 'auth_uuid':
val = this.authUser.uuid.trim()
break
case 'auth_access_token':
val = this.authUser.accessToken
break
case 'user_type':
val = 'mojang'
break
case 'version_type':
val = this.versionData.type
break
case 'resolution_width':
val = ConfigManager.getGameWidth()
break
case 'resolution_height':
val = ConfigManager.getGameHeight()
break
case 'natives_directory':
val = args[i].replace(argDiscovery, tempNativePath)
break
case 'launcher_name':
val = args[i].replace(argDiscovery, 'WesterosCraft-Launcher')
break
case 'launcher_version':
val = args[i].replace(argDiscovery, this.launcherVersion)
break
case 'classpath':
val = this.classpathArg(mods, tempNativePath).join(process.platform === 'win32' ? ';' : ':')
break
}
if(val != null){
args[i] = val
}
}
}
}
// Forge Specific Arguments
args = args.concat(this.forgeData.arguments.game)
// Filter null values
args = args.filter(arg => {
return arg != null
})
return args
}
/**
* Resolve the arguments required by forge.
*
@ -410,8 +575,7 @@ class ProcessBuilder {
libs.push(to)
} else {
// Extract the native library.
const extractInst = lib.extract
const exclusionArr = extractInst.exclude
const exclusionArr = lib.extract != null ? lib.extract.exclude : ['META-INF/']
const artifact = lib.downloads.classifiers[lib.natives[Library.mojangFriendlyOS()].replace('${arch}', process.arch.replace('x', ''))]
// Location of native zip.

View File

@ -621,18 +621,25 @@ function dlAsync(login = true){
}
} else if(m.context === 'validateEverything'){
let allGood = true
// If these properties are not defined it's likely an error.
if(m.result.forgeData == null || m.result.versionData == null){
loggerLaunchSuite.error('Error during validation:', m.result)
loggerLaunchSuite.error('Error during launch', m.result.error)
showLaunchFailure('Error During Launch', 'Please check the console (CTRL + Shift + i) for more details.')
allGood = false
}
forgeData = m.result.forgeData
versionData = m.result.versionData
if(login) {
if(login && allGood) {
const authUser = ConfigManager.getSelectedAccount()
loggerLaunchSuite.log(`Sending selected account (${authUser.displayName}) to ProcessBuilder.`)
let pb = new ProcessBuilder(serv, versionData, forgeData, authUser)
let pb = new ProcessBuilder(serv, versionData, forgeData, authUser, remote.app.getVersion())
setLaunchDetails('Launching game..')
// Attach a temporary listener to the client output.