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
6 changed files with 614 additions and 103 deletions

View File

@@ -1401,12 +1401,28 @@ class AssetGuard extends EventEmitter {
for(let ob of modules){
const type = ob.getType()
if(type === DistroManager.Types.ForgeHosted || type === DistroManager.Types.Forge){
let obArtifact = ob.getArtifact()
let obPath = obArtifact.getPath()
let asset = new DistroModule(ob.getIdentifier(), obArtifact.getHash(), obArtifact.getSize(), obArtifact.getURL(), obPath, type)
let forgeData = await AssetGuard._finalizeForgeAsset(asset, self.commonPath)
resolve(forgeData)
return
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,34 +1702,44 @@ class AssetGuard extends EventEmitter {
async validateEverything(serverid, dev = false){
if(!ConfigManager.isLoaded()){
ConfigManager.load()
}
DistroManager.setDevMode(dev)
const dI = await DistroManager.pullLocal()
const server = dI.getServer(serverid)
// Validate Everything
await this.validateDistribution(server)
this.emit('validate', 'distribution')
const versionData = await this.loadVersionData(server.getMinecraftVersion())
this.emit('validate', 'version')
await this.validateAssets(versionData)
this.emit('validate', 'assets')
await this.validateLibraries(versionData)
this.emit('validate', 'libraries')
await this.validateMiscellaneous(versionData)
this.emit('validate', 'files')
await this.processDlQueues()
//this.emit('complete', 'download')
const forgeData = await this.loadForgeData(server)
try {
if(!ConfigManager.isLoaded()){
ConfigManager.load()
}
DistroManager.setDevMode(dev)
const dI = await DistroManager.pullLocal()
return {
versionData,
forgeData
const server = dI.getServer(serverid)
// Validate Everything
await this.validateDistribution(server)
this.emit('validate', 'distribution')
const versionData = await this.loadVersionData(server.getMinecraftVersion())
this.emit('validate', 'version')
await this.validateAssets(versionData)
this.emit('validate', 'assets')
await this.validateLibraries(versionData)
this.emit('validate', 'libraries')
await this.validateMiscellaneous(versionData)
this.emit('validate', 'files')
await this.processDlQueues()
//this.emit('complete', 'download')
const forgeData = await this.loadForgeData(server)
return {
versionData,
forgeData
}
} catch (err){
return {
versionData: null,
forgeData: null,
error: err
}
}
}