From adddc3c7259cf14b26d6851a2f250177fff080c6 Mon Sep 17 00:00:00 2001 From: yunyun <1159428885@qq.com> Date: Tue, 2 Jun 2026 15:55:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0README=E5=92=8C=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=90=AF=E5=8A=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++--- main.js | 98 +------------------------------------------------------ 2 files changed, 5 insertions(+), 101 deletions(-) diff --git a/README.md b/README.md index 7e3f911..36ae23a 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,12 @@ ### 从源码构建 ```bash -git clone https://git.caellab.com/yunyun/GoodPlanCraftLauncher.git +git clone https://github.com/yunyun-3782/GoodPlanCraftLaunCher.git ``` ### 预编译版本 -前往 [Releases](https://git.caellab.com/yunyun/GoodPlanCraftLauncher/releases) 下载对可执行文件。 +前往 [Releases](https://github.com/yunyun-3782/GoodPlanCraftLaunCher/releases/) 下载可执行文件。 ## 使用 @@ -42,13 +42,13 @@ npm run build ## 贡献 -欢迎提交 [不同意见](https://f.caellab.com/t/problem) 或 [Issue](https://git.caellab.com/yunyun/GoodPlanCraftLauncher/issues) ,同时欢迎开发 衍生 版本。 +欢迎提交 [不同意见](https://f.caellab.com/t/problem) ,同时欢迎开发 衍生 版本。 ## 许可证 本项目采用 [CaelLab BY-SA Code License](https://www.caellab.com/license/bysa-code) 授权。 -具体可查看 [LICENSE](https://git.caellab.com/yunyun/GoodPlanCraftLauncher/src/branch/main/LICENSE) 。 +具体可查看 [LICENSE](https://github.com/yunyun-3782/GoodPlanCraftLaunCher/blob/main/LICENSE) 。 --- 很高兴能帮助到你!祝你在MC中玩的愉快! diff --git a/main.js b/main.js index 7670056..046269e 100644 --- a/main.js +++ b/main.js @@ -2546,41 +2546,6 @@ async function detectGameWindow(pid) { writeLog(`[启动] 开始检测游戏窗口,PID: ${pid}`); return new Promise((resolve) => { -<<<<<<< Updated upstream - // 设置超时(最多等待5秒,比原来快3秒) - const timeout = setTimeout(() => { - writeLog(`[启动] 游戏窗口检测超时,继续启动流程`); - if (mainWindow) { - mainWindow.webContents.send('game-window-created', { pid: pid, timeout: true }); - } - resolve(); - }, 5000); - - // 使用更快速的检测方式 - let checkCount = 0; - const maxChecks = 50; // 最多检查50次(5秒) - let detected = false; - - // 首先立即发送一次,不等待检测完成 - writeLog(`[启动] 快速发送创建事件(立即检测)`); - setTimeout(() => { - if (!detected) { - detected = true; - if (mainWindow) { - mainWindow.webContents.send('game-window-created', { pid: pid, fast: true }); - } - } - }, 1500); // 1.5秒后直接认为启动成功 - - const checkInterval = setInterval(() => { - checkCount++; - - if (detected) { - clearInterval(checkInterval); - clearTimeout(timeout); - resolve(); - return; -======= let resolved = false; const done = () => { if (resolved) return; @@ -2603,7 +2568,6 @@ async function detectGameWindow(pid) { try { detector.kill(); } catch {} if (mainWindow && !launchCancelFlag) { mainWindow.webContents.send('game-window-created', { pid, timeout: true }); ->>>>>>> Stashed changes } done(); }, 8000); @@ -3345,64 +3309,4 @@ function generateLaunchDisplayName(versionId) { return parts.join(' '); } -// 安装 Forge -async function installForge(mcVersion, forgeVersionId) { - writeLog(`[Forge] 安装: ${forgeVersionId}`); - - const versionDir = path.join(GAME_DIR, 'versions', mcVersion); - if (!fs.existsSync(versionDir)) { - throw new Error(`原版版本 ${mcVersion} 不存在`); - } - - // 创建 gpcl 目录 - const gpclDir = path.join(versionDir, 'gpcl'); - if (!fs.existsSync(gpclDir)) fs.mkdirSync(gpclDir, { recursive: true }); - - // 读取或创建 config.ini - const configPath = path.join(gpclDir, 'config.ini'); - let config = readVersionConfig(mcVersion) || { - Minecraft: mcVersion, - Forge: '', - Fabric: '', - OptiFine: '' - }; - config.Minecraft = mcVersion; - config.Forge = forgeVersionId; - - // 写入 config.ini - const configContent = `[Version] -Minecraft=${config.Minecraft} -Forge=${config.Forge} -Fabric=${config.Fabric || ''} -OptiFine=${config.OptiFine || ''} -`; - fs.writeFileSync(configPath, configContent, 'utf8'); - - // 更新 version.json - const jsonPath = path.join(versionDir, `${mcVersion}.json`); - const versionData = JSON.parse(fs.readFileSync(jsonPath, 'utf8')); - versionData.mainClass = 'net.minecraftforge.userdev.LaunchTesting'; - - versionData.libraries = versionData.libraries || []; - const hasForgeLib = versionData.libraries.some(lib => - lib.name && lib.name.startsWith('net.minecraftforge:forge:') - ); - if (!hasForgeLib) { - versionData.libraries.push({ - name: `net.minecraftforge:forge:${forgeVersionId}`, - downloads: { - artifact: { - url: `https://maven.minecraftforge.net/net/minecraftforge/forge/${forgeVersionId}/forge-${forgeVersionId}.jar`, - path: `net/minecraftforge/forge/${forgeVersionId}/forge-${forgeVersionId}.jar`, - sha1: '', - size: 0 - } - } - }); - } - - fs.writeFileSync(jsonPath, JSON.stringify(versionData, null, 2)); - - writeLog(`[Forge] 安装完成: ${mcVersion} + Forge ${forgeVersionId}`); - return mcVersion; -} +