Upload via GUI (45 Dateien)
This commit is contained in:
@@ -464,6 +464,37 @@ async function prepareAndLaunch(opts, onProgress) {
|
||||
classpath.unshift(path.join(libDir, rel.replace(/\//g, path.sep)));
|
||||
}
|
||||
effectiveVj = mergeLoader(vj, fvj);
|
||||
|
||||
} else if (opts.loader === 'optifine') {
|
||||
/*
|
||||
* OptiFine hat keine öffentliche Installations-API (Downloads laufen bewusst
|
||||
* über eine Werbeseite). AeroMC lädt hier nichts selbst herunter – der Nutzer
|
||||
* hat den offiziellen Installer bereits einmal sichtbar laufen lassen (siehe
|
||||
* optifine:setup/optifine:confirm in main.js), der dabei ein normales
|
||||
* Versions-Profil unter <sharedDir>/versions/<loaderVersion>/ abgelegt hat,
|
||||
* genau wie Fabric/Forge es tun. Wir lesen es nur noch ein und mergen es.
|
||||
*/
|
||||
const ofId = opts.loaderVersion;
|
||||
if (!ofId) {
|
||||
return { ok: false, message: 'Für diese Instanz ist keine OptiFine-Version hinterlegt. Bitte im Bearbeiten-Dialog einrichten.' };
|
||||
}
|
||||
const ofJsonPath = path.join(opts.sharedDir, 'versions', ofId, ofId + '.json');
|
||||
if (!fs.existsSync(ofJsonPath)) {
|
||||
return { ok: false, message: `OptiFine-Profil "${ofId}" wurde nicht gefunden. Bitte die Einrichtung im Bearbeiten-Dialog wiederholen.` };
|
||||
}
|
||||
let ofvj;
|
||||
try { ofvj = JSON.parse(fs.readFileSync(ofJsonPath, 'utf8')); }
|
||||
catch (err) { return { ok: false, message: 'OptiFine-Profil ist beschädigt: ' + err.message }; }
|
||||
for (const lib of ofvj.libraries || []) {
|
||||
const art = lib.downloads && lib.downloads.artifact;
|
||||
const rel = (art && art.path) || forge.mavenPath(lib.name);
|
||||
const dest = path.join(libDir, rel.replace(/\//g, path.sep));
|
||||
if (!fs.existsSync(dest) && art && art.url) {
|
||||
await downloadIfNeeded(art.url, dest, art.sha1 || null);
|
||||
}
|
||||
classpath.unshift(dest);
|
||||
}
|
||||
effectiveVj = mergeLoader(vj, ofvj);
|
||||
}
|
||||
|
||||
const finalClasspath = dedupeClasspath(classpath, opts.sharedDir);
|
||||
|
||||
Reference in New Issue
Block a user