From ff91303b189ecdd44abb6ffd62a6004bd1efded0 Mon Sep 17 00:00:00 2001 From: DIKER0K Date: Mon, 7 Jul 2025 01:13:13 +0500 Subject: [PATCH] add: second attemp to first run minecraft --- src/renderer/pages/LaunchPage.tsx | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/renderer/pages/LaunchPage.tsx b/src/renderer/pages/LaunchPage.tsx index 4865313..23e1cb2 100644 --- a/src/renderer/pages/LaunchPage.tsx +++ b/src/renderer/pages/LaunchPage.tsx @@ -95,11 +95,14 @@ const LaunchPage = () => { ); if (downloadResult?.success) { + let needsSecondAttempt = false; + if (downloadResult.updated) { showNotification( `Сборка успешно обновлена до версии ${downloadResult.version}`, 'success', ); + needsSecondAttempt = true; } else { showNotification( `Установлена актуальная версия сборки ${downloadResult.version}`, @@ -117,7 +120,26 @@ const LaunchPage = () => { }, ); - if (launchResult?.success) { + if (needsSecondAttempt) { + showNotification( + 'Завершаем настройку компонентов, повторный запуск...', + 'info', + ); + + await new Promise((resolve) => setTimeout(resolve, 2000)); + + const secondAttempt = await window.electron.ipcRenderer.invoke( + 'launch-minecraft', + { + accessToken: savedConfig.accessToken, + uuid: savedConfig.uuid, + username: savedConfig.username, + memory: savedConfig.memory || 4096, + }, + ); + + showNotification('Minecraft успешно запущен!', 'success'); + } else if (launchResult?.success) { showNotification('Minecraft успешно запущен!', 'success'); } }