Fix: use vanilla classpath for modloaders (fabric/forge/neoforge), add JS debug logging

This commit is contained in:
SashegDev
2026-05-08 17:50:33 +00:00
parent d4dc35aac3
commit e32a057684
2 changed files with 29 additions and 5 deletions
@@ -36,15 +36,37 @@ public class LaunchCommandBuilder {
}
command.add("-Djava.library.path=" + nativesDir.toAbsolutePath());
String loaderType = instance.getLoaderType().toLowerCase();
boolean isModloader = "fabric".equals(loaderType) || "forge".equals(loaderType) || "neoforge".equals(loaderType);
VersionManifest manifest = resolveVersionManifest();
if (manifest != null) {
// For modloaders, always use vanilla classpath with all libraries
if (isModloader) {
System.out.println(ZAnsi.cyan(" Modloader detected (" + loaderType + "), using vanilla classpath"));
command.add("-cp");
command.add(buildClasspathFromManifest(manifest));
command.add(buildVanillaClasspath());
command.add(getVanillaMainClass());
command.addAll(getVanillaGameArguments(options));
} else if (manifest != null) {
String classpath = buildClasspathFromManifest(manifest);
String mainClass = resolveMainClass(manifest);
command.add(mainClass);
// Fallback if classpath is empty
if (classpath.isEmpty() || classpath.equals(instance.getPath().resolve("versions").resolve(getVersionId()).resolve(getVersionId() + ".jar").toAbsolutePath().toString())) {
System.out.println(ZAnsi.yellow(" manifest classpath пустой, использую vanilla classpath"));
command.add("-cp");
command.add(buildVanillaClasspath());
command.add(getVanillaMainClass());
command.addAll(getVanillaGameArguments(options));
} else {
command.add("-cp");
command.add(classpath);
command.addAll(resolveGameArguments(manifest, options));
String mainClass = resolveMainClass(manifest);
command.add(mainClass);
command.addAll(resolveGameArguments(manifest, options));
}
} else {
command.add("-cp");
command.add(buildVanillaClasspath());
@@ -268,8 +268,10 @@ function startLogPolling() {
// Game logs
const gameResult = await apiCall('/game-logs');
console.log('[DEBUG] Game logs request:', gameResult.success, 'length:', gameResult.data ? gameResult.data.length : 0);
if (gameResult.success && gameResult.data && gameResult.data.length > lastGameLogLength) {
const newLogs = gameResult.data.substring(lastGameLogLength);
console.log('[DEBUG] New game logs:', newLogs.substring(0, 200));
const lines = newLogs.split('\n').filter(l => l.trim());
lines.forEach(line => {
log('[GAME] ' + line, 'info');