Skip to content

refactor: 用版本列表替代原版版本号字符串猜测 - #3641

Draft
LuLu-ling wants to merge 3 commits into
devfrom
refactor/versionlist
Draft

LuLu-ling wants to merge 3 commits into
devfrom
refactor/versionlist

Conversation

@LuLu-ling

@LuLu-ling LuLu-ling commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Partially generated by Grok-4.7

Sourcery 摘要

使用权威版本索引替代猜测的 Minecraft 版本号,以实现可靠的版本识别、比较、分类和兼容性处理。

新功能:

  • 添加可随时刷新的内置 Minecraft 版本索引,用于规范版本解析、排序、比较、分类和发布系列分组。
  • 将未知的 Minecraft 版本显示为明确的类别,并支持通过索引处理下载、实例、模组和启动兼容性检查中的版本元数据。

错误修复:

  • 使用权威版本列表匹配替代基于启发式的版本字符串和发布日期猜测,从而改善对快照版、预发布版、旧版、愚人节版本和非标准标识符的处理。
  • 防止实例版本检测接受任意正则表达式匹配结果,要求候选版本必须解析为已知的索引 Minecraft 版本。

增强功能:

  • 在实例管理、模组兼容性、筛选、排序和 Java 要求中,使用版本列表行号和发布系列标识符替代基于 Drop 编号的版本逻辑和缓存数据。
  • 更新版本分类和界面排序,使其使用版本列表顺序,同时保留对索引中不存在的版本的回退行为。
  • 添加后台版本列表刷新功能,并提供内置回退数据以及对旧版缓存系列数据的兼容处理。

杂项:

  • 移除已废弃的 Drop 配置、版本解析辅助工具和 Minecraft JSON 版本正则表达式模式。
Original summary in English

Sourcery 摘要

用权威、可刷新的版本索引替代启发式的 Minecraft 版本号处理,以实现可靠的版本识别、排序、分类和兼容性判断。

新功能:

  • 添加可刷新的权威 Minecraft 版本索引,并内置缓存回退数据。
  • 将索引中缺失的版本分类并显示为 Unknown,同时支持在实例、下载、模组和启动元数据之间进行规范化解析。

Bug 修复:

  • 使用精确的索引匹配替代启发式版本解析和基于日期的猜测,以处理快照版、预发布版、旧版、愚人节版本和非标准标识符。
  • 要求检测到的实例版本必须解析为索引中已知的 Minecraft 版本,而不是接受任意符合正则表达式的匹配结果。

改进:

  • 使用索引中的版本排序和发布系列标识符进行版本比较、分类、实例管理、模组兼容性判断、筛选、排序和 Java 要求判定。
  • 在逐步迁移离开基于 Drop 的版本逻辑和已弃用解析辅助函数的同时,保留与旧版缓存系列数据的兼容性。

维护:

  • 移除过时的 Drop 配置、Drop 转换辅助函数以及 Minecraft JSON 版本正则表达式模式。
Original summary in English

Sourcery 摘要

用可刷新的权威版本索引替代启发式的 Minecraft 版本处理,以实现可靠的版本识别、排序、分类和兼容性判断。

新功能:

  • 添加可刷新的权威 Minecraft 版本索引,并提供内置数据和缓存回退数据。
  • 当无法从索引中解析 Minecraft 版本时,将其分类并显示为 Unknown。

错误修复:

  • 用精确的索引匹配替代启发式版本检测和基于日期的分类,以处理正式发布版、快照版、预发布版、旧版、愚人节版本和非标准标识符。
  • 要求检测到的实例版本必须解析为索引中已知的 Minecraft 版本,才能将其视为可靠版本。

增强功能:

  • 使用版本索引排序和发布系列标识符进行版本比较、实例组织、模组兼容性判断、筛选、排序以及 Java 版本要求判断。
  • 在将版本元数据从基于 Drop 的逻辑迁移出去的同时,保留与旧版缓存系列数据的兼容性。

杂项:

  • 移除过时的 Drop 配置、转换辅助函数以及 Minecraft JSON 版本正则表达式模式。
Original summary in English

Summary by Sourcery

Replace heuristic Minecraft version handling with a refreshable authoritative version index for reliable identification, ordering, classification, and compatibility decisions.

New Features:

  • Add a refreshable authoritative Minecraft version index with embedded and cached fallback data.
  • Classify and display Minecraft versions as Unknown when they cannot be resolved from the index.

Bug Fixes:

  • Replace heuristic version detection and date-based classification with exact index matching for releases, snapshots, prereleases, legacy versions, April Fools versions, and nonstandard identifiers.
  • Require detected instance versions to resolve to known indexed Minecraft versions before treating them as reliable.

Enhancements:

  • Use version index ordering and release-family identifiers for version comparison, instance organization, mod compatibility, filtering, sorting, and Java requirements.
  • Preserve compatibility with legacy cached family data while migrating version metadata away from Drop-based logic.

Chores:

  • Remove obsolete Drop configuration, conversion helpers, and Minecraft JSON version regex patterns.

@pcl-ce-automation pcl-ce-automation Bot added 🚧 正在处理 开发人员正在对该内容进行开发、测试或修复,进展中 size: XXL PR 大小评估:巨型 labels Sep 30, 2026
@sourcery-ai

sourcery-ai Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

审查者指南

该 PR 以按发布时间排列的原版版本列表和原子快照索引取代旧的 Drop 数值及版本字符串猜测:启动时使用内嵌列表并后台刷新,实例识别要求精确命中并规范化版本 id,随后将分类、比较、家族聚合、模组兼容性、Java 选择及下载/安装 UI 全面迁移到索引语义,同时兼容旧的 Drops 缓存格式。

基于索引的 Minecraft 版本识别时序图

sequenceDiagram
    participant Instance as McInstance
    participant Index as VanillaVersionIndex
    participant Sources as Instance metadata sources
    participant Info as McInstanceInfo
    Sources->>Instance: Read clientVersion or patches or arguments
    Instance->>Index: TryResolve(candidate)
    alt candidate is listed
        Index-->>Instance: canonical id
        Instance->>Info: Set VanillaName and Reliable
    else candidate is not listed
        Index-->>Instance: false
        Instance->>Info: Set Unknown and unreliable
    end
Loading

替换基于 Drop 的兼容性决策流程图

flowchart TD
    Input[Vanilla version id] --> Listed{VanillaVersionIndex.TryGetLine}
    Listed -->|yes| Boundary[Compare against named thresholds]
    Listed -->|no| Fallback[Use fallback behavior where supported]
    Boundary --> Java[Select Java constraints]
    Boundary --> Loader[Check Forge Fabric OptiFine compatibility]
    Boundary --> Group[Group versions into release families]
    Fallback --> Unknown[Mark unknown or unreliable]
Loading

文件级变更

变更 详细信息 文件
引入基于完整原版版本列表的快照索引,统一提供版本规范化、行号比较、正式版家族归类和版本范围判断。
  • 新增内嵌 versions.txt 索引,并支持从版本清单异步下载、合并、重试和原子发布刷新。
  • 以索引行号替代旧的 Drop/版本号字符串猜测,覆盖版本分类、比较、家族筛选及多个兼容性阈值判断。
  • 增加 Unknown 分类,并重构愚人节版本、快照、远古版和未知版本处理。
PCL.Core/Minecraft/VanillaVersionIndex.cs
PCL.Core/Minecraft/VanillaVersionService.cs
PCL.Core/Minecraft/McVersionClassifier.cs
Plain Craft Launcher 2/Modules/Minecraft/VanillaVersionList.cs
Plain Craft Launcher 2/Resources/versions.txt
Plain Craft Launcher 2/Modules/Minecraft/McVersionComparer.cs
改造实例版本识别和缓存模型,使版本号必须精确命中原版索引并保存规范化结果。
  • 按多个元数据来源依次解析版本 id,并通过索引规范化;无法命中时标记为 Unknown/不可靠,不再从任意文本猜测。
  • 将 InstanceCacheRow 的 DropNumber 重命名为 LineNumber,并移除旧的 Drops 配置缓存。
  • 将 McInstanceInfo.Valid、vanilla 占位值及实例状态分类改为索引驱动。
Plain Craft Launcher 2/Modules/Minecraft/McInstance.cs
Plain Craft Launcher 2/Modules/Minecraft/McInstanceInfo.cs
PCL.Core/IO/Storage/Cache/Model/InstanceCacheRow.cs
PCL.Core/IO/Storage/Cache/SqliteCacheStorage.cs
PCL.Core/App/States.cs
将模组兼容性、实例整理和 Java 运行时选择迁移到索引及版本家族语义。
  • 用行号阈值替代 Drop 数值,更新 Forge、Fabric、Legacy Fabric、OptiFine、继承实例和用户名长度等兼容性判断。
  • 按版本家族聚合 Modrinth/CurseForge/本地组件支持版本,并兼容读取旧 Drops 缓存、写入新 Families 缓存。
  • 按索引顺序选择最新实例、排序实例列表并调整旧版 Forge 目录扫描。
Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.cs
Plain Craft Launcher 2/Modules/Minecraft/ModLibrary.cs
Plain Craft Launcher 2/Modules/Minecraft/ModComp.cs
Plain Craft Launcher 2/Modules/Minecraft/ModInstanceList.cs
Plain Craft Launcher 2/Modules/Minecraft/ModLocalComp.cs
Plain Craft Launcher 2/Modules/Minecraft/ProfileUi.cs
Plain Craft Launcher 2/Modules/Minecraft/CrashAnalysis/Export/CrashReportExporter.cs
更新下载、安装和版本列表 UI,使分类、排序和筛选使用索引结果。
  • 移除 AllDrops 和旧版本格式正则,改用 AllFamilies 与家族 id 展示和分组。
  • 版本列表按索引行号排序,增加未知分类,并在无可用最新版本时跳过最新版本卡片。
  • 将 Fabric/OptiFabric 等安装选项的版本范围判断切换为索引阈值 API。
Plain Craft Launcher 2/Modules/Minecraft/ModDownload.cs
Plain Craft Launcher 2/Pages/PageDownload/Comp/PageComp.xaml.cs
Plain Craft Launcher 2/Pages/PageDownload/Comp/PageDownloadCompDetail.xaml.cs
Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.cs
Plain Craft Launcher 2/Pages/PageDownload/PageDownloadClient.xaml.cs
Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.cs
Plain Craft Launcher 2/Pages/PageInstance/PageInstanceInstall.xaml.cs
Plain Craft Launcher 2/Pages/PageInstance/PageInstanceOverall.xaml.cs
PCL.Core/Utils/RegexPatterns.cs
补充版本分类相关本地化文本。
  • 为 Unknown 版本类别增加四种语言的显示文本。
PCL.Core/App/Localization/Languages/en-GB.xaml
PCL.Core/App/Localization/Languages/en-US.xaml
PCL.Core/App/Localization/Languages/zh-CN.xaml
PCL.Core/App/Localization/Languages/zh-TW.xaml

提示和命令

与 Sourcery 交互

  • 触发新的审查: 在拉取请求中评论 @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 来触发新的审查!

自定义使用体验

访问你的控制面板以:

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

获取帮助

Original review guide in English

Reviewer's Guide

该 PR 以按发布时间排列的原版版本列表和原子快照索引取代旧的 Drop 数值及版本字符串猜测:启动时使用内嵌列表并后台刷新,实例识别要求精确命中并规范化版本 id,随后将分类、比较、家族聚合、模组兼容性、Java 选择及下载/安装 UI 全面迁移到索引语义,同时兼容旧的 Drops 缓存格式。

Sequence diagram for indexed Minecraft version recognition

sequenceDiagram
    participant Instance as McInstance
    participant Index as VanillaVersionIndex
    participant Sources as Instance metadata sources
    participant Info as McInstanceInfo
    Sources->>Instance: Read clientVersion or patches or arguments
    Instance->>Index: TryResolve(candidate)
    alt candidate is listed
        Index-->>Instance: canonical id
        Instance->>Info: Set VanillaName and Reliable
    else candidate is not listed
        Index-->>Instance: false
        Instance->>Info: Set Unknown and unreliable
    end
Loading

Flow diagram for replacing Drop-based compatibility decisions

flowchart TD
    Input[Vanilla version id] --> Listed{VanillaVersionIndex.TryGetLine}
    Listed -->|yes| Boundary[Compare against named thresholds]
    Listed -->|no| Fallback[Use fallback behavior where supported]
    Boundary --> Java[Select Java constraints]
    Boundary --> Loader[Check Forge Fabric OptiFine compatibility]
    Boundary --> Group[Group versions into release families]
    Fallback --> Unknown[Mark unknown or unreliable]
Loading

File-Level Changes

Change Details Files
引入基于完整原版版本列表的快照索引,统一提供版本规范化、行号比较、正式版家族归类和版本范围判断。
  • 新增内嵌 versions.txt 索引,并支持从版本清单异步下载、合并、重试和原子发布刷新。
  • 以索引行号替代旧的 Drop/版本号字符串猜测,覆盖版本分类、比较、家族筛选及多个兼容性阈值判断。
  • 增加 Unknown 分类,并重构愚人节版本、快照、远古版和未知版本处理。
PCL.Core/Minecraft/VanillaVersionIndex.cs
PCL.Core/Minecraft/VanillaVersionService.cs
PCL.Core/Minecraft/McVersionClassifier.cs
Plain Craft Launcher 2/Modules/Minecraft/VanillaVersionList.cs
Plain Craft Launcher 2/Resources/versions.txt
Plain Craft Launcher 2/Modules/Minecraft/McVersionComparer.cs
改造实例版本识别和缓存模型,使版本号必须精确命中原版索引并保存规范化结果。
  • 按多个元数据来源依次解析版本 id,并通过索引规范化;无法命中时标记为 Unknown/不可靠,不再从任意文本猜测。
  • 将 InstanceCacheRow 的 DropNumber 重命名为 LineNumber,并移除旧的 Drops 配置缓存。
  • 将 McInstanceInfo.Valid、vanilla 占位值及实例状态分类改为索引驱动。
Plain Craft Launcher 2/Modules/Minecraft/McInstance.cs
Plain Craft Launcher 2/Modules/Minecraft/McInstanceInfo.cs
PCL.Core/IO/Storage/Cache/Model/InstanceCacheRow.cs
PCL.Core/IO/Storage/Cache/SqliteCacheStorage.cs
PCL.Core/App/States.cs
将模组兼容性、实例整理和 Java 运行时选择迁移到索引及版本家族语义。
  • 用行号阈值替代 Drop 数值,更新 Forge、Fabric、Legacy Fabric、OptiFine、继承实例和用户名长度等兼容性判断。
  • 按版本家族聚合 Modrinth/CurseForge/本地组件支持版本,并兼容读取旧 Drops 缓存、写入新 Families 缓存。
  • 按索引顺序选择最新实例、排序实例列表并调整旧版 Forge 目录扫描。
Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.cs
Plain Craft Launcher 2/Modules/Minecraft/ModLibrary.cs
Plain Craft Launcher 2/Modules/Minecraft/ModComp.cs
Plain Craft Launcher 2/Modules/Minecraft/ModInstanceList.cs
Plain Craft Launcher 2/Modules/Minecraft/ModLocalComp.cs
Plain Craft Launcher 2/Modules/Minecraft/ProfileUi.cs
Plain Craft Launcher 2/Modules/Minecraft/CrashAnalysis/Export/CrashReportExporter.cs
更新下载、安装和版本列表 UI,使分类、排序和筛选使用索引结果。
  • 移除 AllDrops 和旧版本格式正则,改用 AllFamilies 与家族 id 展示和分组。
  • 版本列表按索引行号排序,增加未知分类,并在无可用最新版本时跳过最新版本卡片。
  • 将 Fabric/OptiFabric 等安装选项的版本范围判断切换为索引阈值 API。
Plain Craft Launcher 2/Modules/Minecraft/ModDownload.cs
Plain Craft Launcher 2/Pages/PageDownload/Comp/PageComp.xaml.cs
Plain Craft Launcher 2/Pages/PageDownload/Comp/PageDownloadCompDetail.xaml.cs
Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.cs
Plain Craft Launcher 2/Pages/PageDownload/PageDownloadClient.xaml.cs
Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.cs
Plain Craft Launcher 2/Pages/PageInstance/PageInstanceInstall.xaml.cs
Plain Craft Launcher 2/Pages/PageInstance/PageInstanceOverall.xaml.cs
PCL.Core/Utils/RegexPatterns.cs
补充版本分类相关本地化文本。
  • 为 Unknown 版本类别增加四种语言的显示文本。
PCL.Core/App/Localization/Languages/en-GB.xaml
PCL.Core/App/Localization/Languages/en-US.xaml
PCL.Core/App/Localization/Languages/zh-CN.xaml
PCL.Core/App/Localization/Languages/zh-TW.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

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

Labels

size: XXL PR 大小评估:巨型 🚧 正在处理 开发人员正在对该内容进行开发、测试或修复,进展中

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant