Skip to content

refactor(modpack): 重写整合包安装 - #3523

Open
qsc1918 wants to merge 15 commits into
PCL-Community:devfrom
qsc1918:refactor/modmodpack
Open

refactor(modpack): 重写整合包安装#3523
qsc1918 wants to merge 15 commits into
PCL-Community:devfrom
qsc1918:refactor/modmodpack

Conversation

@qsc1918

@qsc1918 qsc1918 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

修改内容

  • 拆分重构了modmodpack.cs
  • 重写了一部分整合包安装逻辑
  • 补充了使用整合包作者推荐的内存的功能
  • 修复了一些MMC整合包无法正常安装
  • 修复了某些整合包的地图会当光影包安装

测试情况

  • 已安装了一大堆整合包测试

其他说明

  • 使用了[DeepSeek-V4-pro],AI主要做了拆分重构代码,写en-US翻译,重写了一部分MMC整合包安装和CurseForge的整合包内存功能,写一部分注释,格式化代码

close #3403

Summary by Sourcery

将整合包安装重构为“按格式划分的模块”,在其之上建立共享的检测与分发层;新增对“嵌套整合包”和“文件夹整合包”的安装支持,并在安装流程、实例设置和启动流程中引入“整合包推荐内存”的统一处理。

New Features:

  • 通过通用的归档读取抽象,同时支持从 zip 文件和预解压文件夹安装整合包。
  • 新增对“自带启动器的整合包(launcher pack)”以及“嵌套整合包”的检测与处理,包括让用户选择是否使用内置启动器。
  • 支持“lazy-pack”(完整 .minecraft 实例归档)安装,实现带冲突感知的文件复制以及自动版本隔离。
  • 为每个实例引入“整合包推荐 RAM”的存储,并新增一种“内存模式”,可遵循整合包作者的推荐设置。

Bug Fixes:

  • 修复 MultiMC JSON 补丁应用和 Java 版本检测,使补丁参数和运行时需求能够正确合并进版本 JSON。
  • 通过改进从模块和游戏版本提示中推断资源类型,防止某些 MMC 和 Modrinth 整合包将地图误判为着色器包。
  • 避免在格式检测中把非整合包归档或深层的 mod 清单当作整合包处理,从而减少在不受支持的 zip 文件上的安装失败。

Enhancements:

  • 将单一的大型整合包安装器拆分为按格式划分的部分类(CurseForge、Modrinth、MultiMC、MCBBS、HMCL、launcher pack、lazy pack),并通过共享的辅助工具处理解压、覆盖、实例命名和收尾逻辑。
  • 将整合包格式检测集中到一个可复用的检测器中,产生结构化结果并附带测试,将格式识别从 zip 处理逻辑中解耦。
  • 改进归档打开和检测失败时的错误包装,为不同整合包来源产生更清晰、面向用户的错误提示。
  • 扩展消息框控件以支持第四个按钮,并在 lazy-pack 安装时的覆盖冲突对话框中接入该按钮。

Documentation:

  • 更新本地化条目和 UI 布局,在中英文界面中展示新的“使用整合包推荐内存”选项及相关警告。

Tests:

  • 为 CurseForge、Modrinth、MCBBS 和 MultiMC 清单解析添加单元测试,确保在可选字段和多种模式的 schema 下都能稳健处理。
  • 为整合包归档格式检测添加单元测试,包括根清单和嵌套清单、自带启动器整合包、lazy pack,以及诸如 mods 文件夹内 mod 清单等“否定案例”。
Original summary in English

Summary by Sourcery

Refactor modpack installation into format-specific modules with a shared detection and dispatch layer, add support for installing nested and folder-based modpacks, and introduce modpack-recommended memory handling across install, instance settings, and launch flows.

New Features:

  • Support installing modpacks from both zip files and pre-extracted folders via a common archive reader abstraction.
  • Add detection and handling for launcher packs with bundled launchers and nested modpacks, including user choice to use the bundled launcher.
  • Support lazy-pack (full .minecraft instance archive) installation with conflict-aware file copying and automatic version isolation.
  • Introduce per-instance storage of modpack-recommended RAM and a new memory mode that follows the pack author’s recommended settings.

Bug Fixes:

  • Fix MultiMC JSON patches application and Java version detection so patched arguments and runtime requirements are correctly merged into version JSON.
  • Prevent certain MMC and Modrinth modpacks from misclassifying maps as shaderpacks by improving resource type detection from modules and game version hints.
  • Avoid treating non-modpack archives or deep mod manifests as modpacks in format detection, reducing install failures on unsupported zip files.

Enhancements:

  • Split the monolithic modpack installer into partial classes per format (CurseForge, Modrinth, MultiMC, MCBBS, HMCL, launcher pack, lazy pack) with shared helpers for extraction, overrides, instance naming, and finalization.
  • Centralize modpack format detection into a reusable detector with structured results and tests, decoupling format recognition from zip handling.
  • Improve error wrapping for archive open and detection failures to produce clearer, user-facing messages across modpack sources.
  • Extend the message box control to support a fourth button and wire it into overwrite conflict dialogs during lazy-pack installation.

Documentation:

  • Update localization entries and UI layouts to expose the new “use modpack recommended memory” option and associated warnings in both Chinese and English.

Tests:

  • Add unit tests for CurseForge, Modrinth, MCBBS, and MultiMC manifest parsing, ensuring robust handling of optional fields and variant schemas.
  • Add unit tests for modpack archive format detection, including root and nested manifests, launcher packs, lazy packs, and negative cases like mod manifests in mods folders.

@pcl-ce-automation pcl-ce-automation Bot added 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 size: XXL PR 大小评估:巨型 labels Aug 10, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @qsc1918, your pull request is larger than the review limit of 150000 diff characters

@sourcery-ai

sourcery-ai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

将 ModModpack 重构为模块化、与格式无关的安装流水线,由新的 Modpack* 模型和归档读取器提供支持;新增对 CurseForge、Modrinth、MultiMC、HMCL、MCBBS、启动器整合包以及懒人包(包括文件夹形式整合包)的稳健检测与安装能力;并引入整合包推荐内存(RAM)支持,包括 UI、启动时安全检查和回归测试。

统一整合包安装流水线的序列图

sequenceDiagram
    participant User
    participant ModModpack as ModModpack.ModpackInstall
    participant ZipReader as ZipModpackArchiveReader
    participant Detector as ModpackArchiveDetector.Detect
    participant ModModpackSrc as ModModpack._InstallSource
    participant CurseForge as ModModpack._InstallCurseForge
    participant Modrinth as ModModpack._InstallModrinth
    participant MultiMc as ModModpack._InstallMultiMc

    User->>ModModpack: ModpackInstall(file, instanceName, logo, resourceId, isOnlineInstall)
    ModModpack->>ZipReader: new ZipModpackArchiveReader(archive)
    ModModpack->>Detector: Detect(source)
    Detector-->>ModModpack: ModpackDetection(Format, ArchiveBaseFolder)
    ModModpack->>ModModpackSrc: _InstallSource(source, file, instanceName, logo, resourceId, isOnlineInstall)
    ModModpackSrc->>ModModpackSrc: ModpackArchiveDetector.Detect(source)
    ModModpackSrc-->>ModModpackSrc: packType, archiveBaseFolder
    alt packType == ModpackFormat.CurseForge
        ModModpackSrc->>CurseForge: _InstallCurseForge(sourcePath, source, archiveBaseFolder, instanceName, logo, resourceId, isOnlineInstall)
    else packType == ModpackFormat.Modrinth
        ModModpackSrc->>Modrinth: _InstallModrinth(sourcePath, source, archiveBaseFolder, instanceName, logo, resourceId, isOnlineInstall)
    else packType == ModpackFormat.MultiMc
        ModModpackSrc->>MultiMc: _InstallMultiMc(sourcePath, source, archiveBaseFolder)
    else other formats
        ModModpackSrc->>ModModpackSrc: _InstallMcbbs / _InstallHmcl / _InstallLauncherPack / _InstallCompress
    end
Loading

启动时处理整合包推荐内存(RAM)的序列图

sequenceDiagram
    participant Launch as ModLaunch.McLaunchPrecheck
    participant Config as Config.Instance
    participant States as States.Instance
    participant Kernel as KernelInterop
    participant Msg as ModMain.MyMsgBox

    Launch->>Config: MemorySolution[ModInstanceList.McMcInstanceSelected.PathInstance]
    alt MemorySolution == 3
        Launch->>States: ModpackRam[ModInstanceList.McMcInstanceSelected.PathInstance]
        States-->>Launch: recommendedRamMb
        alt recommendedRamMb > 0
            Launch->>Kernel: GetAvailablePhysicalMemoryBytes()
            Kernel-->>Launch: availableBytes
            Launch->>Launch: [availableMb*0.8 < recommendedRamMb || availableMb - recommendedRamMb < 2GB]
            alt condition true
                Launch->>Msg: MyMsgBox(ModpackRecommendedRamUnfit..., SwitchAuto, KeepRecommended)
                Msg-->>Launch: result
                alt result == 1
                    Launch->>Config: MemorySolution[...] = 0 (via ModBase.RunInUiWait)
                end
            end
        end
    end
Loading

文件级改动

Change Details Files
将整合包安装重构为统一的、可自动检测格式的流水线,提供可复用的辅助方法和归档抽象。
  • 修改 ModModpack.ModpackInstall,使其只打开一次 zip、通过 _WrapSourceOpenError 包装错误,并使用 IModpackArchiveReader 委托到 _InstallSource。
  • 引入 ModpackArchiveDetector、ModpackFormat 枚举,以及 IModpackArchiveReader 加上 ZipModpackArchiveReader/FolderModpackArchiveReader,以同时支持 zip 和文件夹来源。
  • 添加共享辅助方法,用于实例命名、版本文件夹路径、override 解包、安装器启动、图标设置以及最终收尾(包括整合包版本/来源/id/推荐内存)。
Plain Craft Launcher 2/Modules/Minecraft/ModModpack.cs
PCL.Core/Minecraft/Modpack/ModpackArchiveDetector.cs
PCL.Core/Minecraft/Modpack/ModpackFormat.cs
PCL.Core/Minecraft/Modpack/IModpackArchiveReader.cs
Plain Craft Launcher 2/Modules/Minecraft/ZipModpackArchiveReader.cs
Plain Craft Launcher 2/Modules/Minecraft/FolderModpackArchiveReader.cs
PCL.Core/Utils/RegexPatterns.cs
Plain Craft Launcher 2/Modules/Base/ModBase.cs
PCL.Core/App/States.cs
将不同格式的安装器拆分为独立的 partial 类,修复 MultiMC 以及 CurseForge/Modrinth/MCBBS/HMCL 的边缘情况,并改进地图/光影包检测。
  • 将 CurseForge、Modrinth、MultiMC、MCBBS、HMCL、启动器整合包和懒人包安装逻辑移动到 ModModpack.* partial 中,并统一使用 _InstallSource 流水线。
  • 重写 CurseForge 安装器,引入 CurseForgeManifest 模型,实现 overrides 默认值、正确的模组列表处理、地图存档解压,以及推荐内存的推导与应用。
  • 重写 Modrinth 安装器,引入 ModrinthManifest 模型,更安全地处理 env,通过解压支持目录形式下载(如地图),并强化路径校验。
  • 围绕 MultiMcManifest 和 MMCPackInfo 重写 MultiMC 安装器,修复 JSON 补丁应用、Java 版本选择以及 instance.cfg 迁移;将 ModDownloadLib.MergeJson 调整为新的 MMCPackInfo 命名。
  • 使用 McbbsManifest 和共享辅助方法重写 MCBBS 与 HMCL 安装器,同时保留启动参数和附加组件语义。
  • 用 _InstallLauncherPack 和 _InstallCompress 替换旧的“带启动器的压缩包”和“普通压缩包”路径,新增嵌套整合包发现、启动器探测、懒人包 .minecraft 检测,以及具备内容级别相等性检查的冲突感知复制。
Plain Craft Launcher 2/Modules/Minecraft/ModModpack.CurseForge.cs
Plain Craft Launcher 2/Modules/Minecraft/ModModpack.Modrinth.cs
Plain Craft Launcher 2/Modules/Minecraft/ModModpack.MultiMc.cs
Plain Craft Launcher 2/Modules/Minecraft/ModModpack.Mcbbs.cs
Plain Craft Launcher 2/Modules/Minecraft/ModModpack.Hmcl.cs
Plain Craft Launcher 2/Modules/Minecraft/ModModpack.Container.cs
Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.cs
为 CurseForge/Modrinth/MultiMC/MCBBS 整合包和归档检测引入强类型的 manifest 模型及测试。
  • 添加 CurseForgeManifest、ModrinthManifest、MultiMcManifest、McbbsManifest 模型,使用基于 JsonCompat 的解析以及辅助方法(如 RecommendedRamEffective、GetDependency、ParseInstanceName)。
  • 新增单元测试,覆盖 manifest 解析以及 ModpackArchiveDetector/IModpackArchiveReader 行为,并使用 FakeModpackArchive 进行测试。
  • 确保 manifest 解析能容忍缺失字段和多种编码形式(数组 vs 字符串),同时将严格校验留给各安装器处理。
PCL.Core/Minecraft/Modpack/CurseForgeManifest.cs
PCL.Core/Minecraft/Modpack/ModrinthManifest.cs
PCL.Core/Minecraft/Modpack/MultiMcManifest.cs
PCL.Core/Minecraft/Modpack/McbbsManifest.cs
PCL.Core/Minecraft/Modpack/ModpackArchiveDetector.cs
PCL.Core.Test/Minecraft/Modpack/FakeModpackArchive.cs
PCL.Core.Test/Minecraft/Modpack/CurseForgeManifestTest.cs
PCL.Core.Test/Minecraft/Modpack/ModrinthManifestTest.cs
PCL.Core.Test/Minecraft/Modpack/MultiMcManifestTest.cs
PCL.Core.Test/Minecraft/Modpack/McbbsManifestTest.cs
PCL.Core.Test/Minecraft/Modpack/ModpackArchiveDetectorTest.cs
增加对整合包推荐内存(RAM)的支持,包括存储、UI 选择以及启动时安全检查。
  • 通过 States.Instance.ModpackRam 存储每个实例的推荐内存(MB),并在 CurseForge 整合包的 _FinalizeInstance 中使用 manifest 的 RecommendedRamEffective 填充该值。
  • 扩展内存模式枚举,新增模式 3 “使用整合包推荐内存”,在无推荐值时自动回退到自动模式。
  • 将 RadioRamType3 接入 PageInstanceSetup 的重载逻辑,当整合包内存缺失或超过物理内存时禁用该选项;在 GetRam 中计算内存时尊重推荐值,并对 32 位 Java 进行上限限制。
  • 新增启动前检查,将整合包推荐内存与可用内存进行比较,并在必要时弹出警告对话框,允许用户切换回自动模式。
PCL.Core/App/States.cs
Plain Craft Launcher 2/Modules/Minecraft/ModModpack.CurseForge.cs
Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.cs
Plain Craft Launcher 2/Pages/PageInstance/PageInstanceSetup.xaml.cs
Plain Craft Launcher 2/Pages/PageInstance/PageInstanceSetup.xaml
Plain Craft Launcher 2/Pages/PageInstance/PageInstanceSetup.xaml.cs
扩展消息框基础设施,为冲突解决流程新增第四个按钮支持。
  • 增强 MyMsgBoxConverter 和 MyMsgBox,使其支持 Button4 文本和 Button4Action,并在 MyMsgText 的 XAML 和后台代码中添加 Btn4 处理。
  • 在懒人包安装冲突对话框中使用第四个按钮,以支持“全部跳过”与“全部覆盖”,确保默认高亮按钮匹配更安全或更常见的选择。
  • 保持向后兼容,当未指定 Button4 时默认使用空字符串,并保留现有按钮行为不变。
Plain Craft Launcher 2/Modules/ModMain.cs
Plain Craft Launcher 2/Controls/MyMsg/MyMsgText.xaml.cs
Plain Craft Launcher 2/Controls/MyMsg/MyMsgText.xaml

Tips and commands

Interacting with Sourcery

  • 触发新的代码审查: 在拉取请求(PR)中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论即可继续对话。
  • 从审查评论生成 GitHub Issue: 通过回复某条审查评论,要求 Sourcery 基于该评论创建 Issue。也可以直接在审查评论中回复 @sourcery-ai issue 来从该评论创建 Issue。
  • 生成拉取请求标题: 在拉取请求标题中任意位置写上 @sourcery-ai,即可随时生成标题。也可以在拉取请求中评论 @sourcery-ai title 来(重新)生成标题。
  • 生成拉取请求摘要: 在拉取请求正文中任意位置写上 @sourcery-ai summary,即可在指定位置生成 PR 摘要。也可以在拉取请求中评论 @sourcery-ai summary,在任意时间(重新)生成摘要。
  • 生成审查者指南: 在拉取请求中评论 @sourcery-ai guide,即可在任意时间(重新)生成审查者指南。
  • 解决所有 Sourcery 评论: 在拉取请求中评论 @sourcery-ai resolve,即可将所有 Sourcery 评论标记为已解决。如果你已经处理完所有评论且不再希望看到它们,这会很有用。
  • 关闭所有 Sourcery 审查: 在拉取请求中评论 @sourcery-ai dismiss,即可关闭所有现有的 Sourcery 审查。特别适合在你希望从新的审查开始时使用——别忘了之后再评论 @sourcery-ai review 来触发新的审查!

Customizing Your Experience

访问你的 dashboard 来:

  • 启用或禁用审查功能,例如 Sourcery 自动生成的拉取请求摘要、审查者指南等。
  • 更改审查语言。
  • 添加、删除或编辑自定义审查指令。
  • 调整其他审查相关设置。

Getting Help

Original review guide in English

Reviewer's Guide

Refactors ModModpack into a modular, format-agnostic installer pipeline backed by new Modpack* models and archive readers, adds robust detection/installation for CurseForge, Modrinth, MultiMC, HMCL, MCBBS, launcher packs and lazy packs (including folder-based packs), and introduces modpack-recommended RAM support with UI, launch-time safeguards, and regression tests.

Sequence diagram for unified modpack installation pipeline

sequenceDiagram
    participant User
    participant ModModpack as ModModpack.ModpackInstall
    participant ZipReader as ZipModpackArchiveReader
    participant Detector as ModpackArchiveDetector.Detect
    participant ModModpackSrc as ModModpack._InstallSource
    participant CurseForge as ModModpack._InstallCurseForge
    participant Modrinth as ModModpack._InstallModrinth
    participant MultiMc as ModModpack._InstallMultiMc

    User->>ModModpack: ModpackInstall(file, instanceName, logo, resourceId, isOnlineInstall)
    ModModpack->>ZipReader: new ZipModpackArchiveReader(archive)
    ModModpack->>Detector: Detect(source)
    Detector-->>ModModpack: ModpackDetection(Format, ArchiveBaseFolder)
    ModModpack->>ModModpackSrc: _InstallSource(source, file, instanceName, logo, resourceId, isOnlineInstall)
    ModModpackSrc->>ModModpackSrc: ModpackArchiveDetector.Detect(source)
    ModModpackSrc-->>ModModpackSrc: packType, archiveBaseFolder
    alt packType == ModpackFormat.CurseForge
        ModModpackSrc->>CurseForge: _InstallCurseForge(sourcePath, source, archiveBaseFolder, instanceName, logo, resourceId, isOnlineInstall)
    else packType == ModpackFormat.Modrinth
        ModModpackSrc->>Modrinth: _InstallModrinth(sourcePath, source, archiveBaseFolder, instanceName, logo, resourceId, isOnlineInstall)
    else packType == ModpackFormat.MultiMc
        ModModpackSrc->>MultiMc: _InstallMultiMc(sourcePath, source, archiveBaseFolder)
    else other formats
        ModModpackSrc->>ModModpackSrc: _InstallMcbbs / _InstallHmcl / _InstallLauncherPack / _InstallCompress
    end
Loading

Sequence diagram for modpack-recommended RAM handling on launch

sequenceDiagram
    participant Launch as ModLaunch.McLaunchPrecheck
    participant Config as Config.Instance
    participant States as States.Instance
    participant Kernel as KernelInterop
    participant Msg as ModMain.MyMsgBox

    Launch->>Config: MemorySolution[ModInstanceList.McMcInstanceSelected.PathInstance]
    alt MemorySolution == 3
        Launch->>States: ModpackRam[ModInstanceList.McMcInstanceSelected.PathInstance]
        States-->>Launch: recommendedRamMb
        alt recommendedRamMb > 0
            Launch->>Kernel: GetAvailablePhysicalMemoryBytes()
            Kernel-->>Launch: availableBytes
            Launch->>Launch: [availableMb*0.8 < recommendedRamMb || availableMb - recommendedRamMb < 2GB]
            alt condition true
                Launch->>Msg: MyMsgBox(ModpackRecommendedRamUnfit..., SwitchAuto, KeepRecommended)
                Msg-->>Launch: result
                alt result == 1
                    Launch->>Config: MemorySolution[...] = 0 (via ModBase.RunInUiWait)
                end
            end
        end
    end
Loading

File-Level Changes

Change Details Files
Refactor modpack installation into a unified, format-detecting pipeline with reusable helpers and archive abstractions.
  • Change ModModpack.ModpackInstall to open the zip once, wrap errors via _WrapSourceOpenError, and delegate to _InstallSource using IModpackArchiveReader.
  • Introduce ModpackArchiveDetector, ModpackFormat enum, and IModpackArchiveReader plus ZipModpackArchiveReader/FolderModpackArchiveReader to support both zip and folder sources.
  • Add shared helpers for instance naming, version folder paths, override extraction, installer startup, icon setting, and finalization (including modpack version/source/id/ram).
Plain Craft Launcher 2/Modules/Minecraft/ModModpack.cs
PCL.Core/Minecraft/Modpack/ModpackArchiveDetector.cs
PCL.Core/Minecraft/Modpack/ModpackFormat.cs
PCL.Core/Minecraft/Modpack/IModpackArchiveReader.cs
Plain Craft Launcher 2/Modules/Minecraft/ZipModpackArchiveReader.cs
Plain Craft Launcher 2/Modules/Minecraft/FolderModpackArchiveReader.cs
PCL.Core/Utils/RegexPatterns.cs
Plain Craft Launcher 2/Modules/Base/ModBase.cs
PCL.Core/App/States.cs
Split format-specific installers into dedicated partial classes, fixing MultiMC and CurseForge/Modrinth/MCBBS/HMCL edge cases and improving map/shader detection.
  • Move CurseForge, Modrinth, MultiMC, MCBBS, HMCL, launcher-pack, and lazy-pack installers into ModModpack.* partials that all use _InstallSource pipeline.
  • Reimplement CurseForge installer with CurseForgeManifest model, overrides defaulting, proper mod list handling, world archives extraction, and recommended RAM derivation and application.
  • Reimplement Modrinth installer with ModrinthManifest model, safer env handling, directory-style downloads (maps etc.) via extraction, and stricter path validation.
  • Rewrite MultiMC installer around MultiMcManifest and MMCPackInfo, fixing JSON patches application, Java version selection, and instance.cfg migration; align ModDownloadLib.MergeJson to new MMCPackInfo naming.
  • Reimplement MCBBS and HMCL installers using McbbsManifest and shared helpers, preserving launch arguments and addons semantics.
  • Replace old "带启动器的压缩包" and "普通压缩包" paths with _InstallLauncherPack and _InstallCompress, adding nested-modpack discovery, launcher probing, lazy-pack .minecraft detection, and conflict-aware copying with content-based equality checks.
Plain Craft Launcher 2/Modules/Minecraft/ModModpack.CurseForge.cs
Plain Craft Launcher 2/Modules/Minecraft/ModModpack.Modrinth.cs
Plain Craft Launcher 2/Modules/Minecraft/ModModpack.MultiMc.cs
Plain Craft Launcher 2/Modules/Minecraft/ModModpack.Mcbbs.cs
Plain Craft Launcher 2/Modules/Minecraft/ModModpack.Hmcl.cs
Plain Craft Launcher 2/Modules/Minecraft/ModModpack.Container.cs
Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.cs
Introduce strongly-typed manifest models and tests for CurseForge/Modrinth/MultiMC/MCBBS modpacks and archive detection.
  • Add CurseForgeManifest, ModrinthManifest, MultiMcManifest, McbbsManifest models with JsonCompat-based parsing and helper methods (e.g., RecommendedRamEffective, GetDependency, ParseInstanceName).
  • Add unit tests for manifest parsing and ModpackArchiveDetector/IModpackArchiveReader behavior using a FakeModpackArchive.
  • Ensure manifest parsing tolerates missing fields and variant encodings (arrays vs strings) while leaving validation to installers.
PCL.Core/Minecraft/Modpack/CurseForgeManifest.cs
PCL.Core/Minecraft/Modpack/ModrinthManifest.cs
PCL.Core/Minecraft/Modpack/MultiMcManifest.cs
PCL.Core/Minecraft/Modpack/McbbsManifest.cs
PCL.Core/Minecraft/Modpack/ModpackArchiveDetector.cs
PCL.Core.Test/Minecraft/Modpack/FakeModpackArchive.cs
PCL.Core.Test/Minecraft/Modpack/CurseForgeManifestTest.cs
PCL.Core.Test/Minecraft/Modpack/ModrinthManifestTest.cs
PCL.Core.Test/Minecraft/Modpack/MultiMcManifestTest.cs
PCL.Core.Test/Minecraft/Modpack/McbbsManifestTest.cs
PCL.Core.Test/Minecraft/Modpack/ModpackArchiveDetectorTest.cs
Add support for modpack-recommended RAM, including storage, UI selection, and launch-time safeguards.
  • Store per-instance recommended RAM (MB) via States.Instance.ModpackRam and populate it in _FinalizeInstance for CurseForge packs using manifest RecommendedRamEffective.
  • Extend memory mode enumeration to add mode 3 'use modpack recommended RAM', defaulting back to auto when no recommended value is present.
  • Wire RadioRamType3 into PageInstanceSetup reload logic and disable it when the modpack RAM is missing or exceeds physical memory; compute RAM in GetRam by honoring recommended RAM and clamping for 32-bit Java.
  • Add launch precheck that compares recommended RAM against available memory and optionally switches back to auto mode with a warning dialog.
PCL.Core/App/States.cs
Plain Craft Launcher 2/Modules/Minecraft/ModModpack.CurseForge.cs
Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.cs
Plain Craft Launcher 2/Pages/PageInstance/PageInstanceSetup.xaml.cs
Plain Craft Launcher 2/Pages/PageInstance/PageInstanceSetup.xaml
Plain Craft Launcher 2/Pages/PageInstance/PageInstanceSetup.xaml.cs
Extend message box infrastructure to support a fourth button for conflict resolution workflows.
  • Enhance MyMsgBoxConverter and MyMsgBox to support Button4 text and Button4Action, and add Btn4 handling in MyMsgText XAML and code-behind.
  • Use the fourth button in lazy-pack install conflict dialogs to support 'Skip All' alongside 'Overwrite All', ensuring the default highlighted button matches the safer or more common choice.
  • Keep backwards compatibility by defaulting unspecified Button4 to empty string and preserving existing button behaviors.
Plain Craft Launcher 2/Modules/ModMain.cs
Plain Craft Launcher 2/Controls/MyMsg/MyMsgText.xaml.cs
Plain Craft Launcher 2/Controls/MyMsg/MyMsgText.xaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@qsc1918

qsc1918 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Close #3403

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f08b192436

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Plain Craft Launcher 2/Modules/Minecraft/ModModpack.Container.cs
Comment thread Plain Craft Launcher 2/Modules/Minecraft/ModModpack.CurseForge.cs Outdated
@qiMengStars

Copy link
Copy Markdown
Member

请善用编辑功能,热知识,标题/介绍及评论都是可以再更改的

@qsc1918

qsc1918 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

请善用编辑功能,热知识,标题/介绍及评论都是可以再更改的

@qsc1918

qsc1918 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

请善用编辑功能,热知识,标题/介绍及评论都是可以再更改的

哦,我懂了,是你要指我把那个close写到介绍里面是吧,好的,我知道了,谢谢你,其实我之前还真不知道,我还以为除了标题能改之外,其他不能

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 921205b28d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Plain Craft Launcher 2/Modules/Minecraft/ModModpack.Container.cs Outdated
Comment thread PCL.Core/Minecraft/Modpack/ModpackArchiveDetector.cs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ef0a93511

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Plain Craft Launcher 2/Modules/Minecraft/ModModpack.Container.cs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6209d9209d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +108 to +109
var node = JsonNode.Parse(jsonText);
return node?["addons"] is not null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use tolerant manifest parsing when detecting addons

For MCBBS packs whose root manifest.json contains addons but also uses syntax that PCL's normal parser accepts, such as comments or trailing commas, this strict JsonNode.Parse now throws and _HasAddons returns false. Those packs were previously detected through ModBase.GetJson/JsonCompat, but after this refactor they get routed to the CurseForge installer and fail with missing Minecraft version instead of installing; use JsonCompat.ParseNode here to keep detection consistent with the manifest parsers.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: XXL PR 大小评估:巨型 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C#]:整合包下载支持一并下载内置地图

2 participants