This commit is contained in:
2026-01-01 22:43:07 +05:00
parent c77d173fce
commit 1348b39a4c
2 changed files with 38 additions and 6 deletions

View File

@ -592,13 +592,25 @@ export function initMinecraftHandlers() {
} else {
// Определяем ID версии в зависимости от типа загрузчика
if (loaderType === 'neoforge' && neoForgeVersion) {
// NeoForge создает версию с ID "neoforge-{version}"
const neoForgeId = `neoforge-${neoForgeVersion}`;
// Проверяем, существует ли такая версия
if (versionsContents.includes(neoForgeId)) {
versionToLaunch = neoForgeId;
} else {
versionToLaunch = neoForgeId;
// Если не существует, пробуем комбинированный ID для совместимости
const combinedId = `${effectiveBaseVersion}-neoforge${neoForgeVersion}`;
versionToLaunch = combinedId;
// Логируем для отладки
console.log(
'NeoForge версия не найдена, используем комбинированный ID:',
combinedId,
);
}
} else if (fabricVersion) {
// Fabric создает версию с ID "{minecraftVersion}-fabric{fabricVersion}"
const fabricId = `${effectiveBaseVersion}-fabric${fabricVersion}`;
if (versionsContents.includes(fabricId)) {
versionToLaunch = fabricId;
@ -727,7 +739,7 @@ export function initMinecraftHandlers() {
event.sender.send(
'overall-progress',
getGlobalProgress('fabric-install', 0), // Используем фазу fabric-install
getGlobalProgress('fabric-install', 0),
);
console.log('installNeoForged:', {
@ -744,12 +756,18 @@ export function initMinecraftHandlers() {
side: 'client',
});
console.log('NeoForge установлен успешно!');
event.sender.send(
'overall-progress',
getGlobalProgress('fabric-install', 1),
);
} catch (error) {
console.log('Ошибка при установке NeoForge, продолжаем:', error);
console.error('Ошибка при установке NeoForge:', error);
event.sender.send('installation-status', {
step: 'neoforge-error',
message: `Ошибка установки NeoForge: ${error.message}`,
});
}
} else if (fabricVersion) {
// Существующий код для Fabric
@ -1040,7 +1058,7 @@ export function initMinecraftHandlers() {
if (!fs.statSync(versionPath).isDirectory()) continue;
// ❗ Прячем технические версии загрузчиков
if (item.includes('-fabric') || item.includes('-neoforge')) {
if (item.includes('-fabric') || item.includes('neoforge')) {
continue;
}