Skip to content

fix(wrapper): 更换老旧的 RetroWrapper 到 LegacyFix#3155

Closed
zkitefly wants to merge 58 commits into
PCL-Community:devfrom
zkitefly:betacraftuk/legacyfix
Closed

fix(wrapper): 更换老旧的 RetroWrapper 到 LegacyFix#3155
zkitefly wants to merge 58 commits into
PCL-Community:devfrom
zkitefly:betacraftuk/legacyfix

Conversation

@zkitefly

@zkitefly zkitefly commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

RetroWrapper 太久没更新了,用 LegacyFix 更有保障

文件版本:https://github.com/betacraftuk/legacyfix/actions/runs/25253333468

Summary by Sourcery

将已过时的 RetroWrapper 集成替换为 LegacyFix,用于启动旧版本的 Minecraft。

增强内容:

  • 基于发布日期,简化判断何时需要旧版包装器支持的条件。
  • 将 JVM 和资源的配置从特定于 RetroWrapper 的参数和 jar 切换为 LegacyFix,并为更早期的测试版(beta)添加额外的 JVM 选项。
  • 更新日志消息和注释,使其引用 LegacyFix 而不是 RetroWrapper。
Original summary in English

Summary by Sourcery

Replace the outdated RetroWrapper integration with LegacyFix for launching legacy Minecraft versions.

Enhancements:

  • Simplify the condition for when legacy wrapper support is needed based on release date.
  • Switch JVM and resource setup from RetroWrapper-specific flags and jars to LegacyFix, including additional JVM options for very old beta versions.
  • Update logging messages and comments to reference LegacyFix instead of RetroWrapper.

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

sourcery-ai Bot commented Jun 16, 2026

Copy link
Copy Markdown

审阅者指南

使用 LegacyFix 替换基于 RetroWrapper 的旧版 Minecraft 处理逻辑,简化版本门控逻辑,并将 LegacyFix 接入 JVM 参数和资源解压流程,同时移除未使用的 RetroWrapper 特定代码路径。

Minecraft 启动中 LegacyFix 集成的时序图

sequenceDiagram
    participant Launcher as McLaunch
    participant ArgsJvm as McLaunchArgumentsJvmNew
    participant ArgsReplace as McLaunchArgumentsReplace
    participant NeedsLegacyFix as McLaunchNeedsLegacyFix
    participant ModBase
    participant JVM

    Launcher->>ArgsJvm: McLaunchArgumentsJvmNew(instance)
    ArgsJvm->>NeedsLegacyFix: McLaunchNeedsLegacyFix(instance)
    alt [LegacyFix needed]
        ArgsJvm->>ArgsReplace: McLaunchArgumentsReplace(instance)
        ArgsReplace->>NeedsLegacyFix: McLaunchNeedsLegacyFix(instance)
        alt [LegacyFix needed]
            ArgsReplace->>ModBase: WriteFile(legacyFixPath, GetResourceStream)
        end
        ArgsJvm->>ArgsJvm: dataList.Add(-javaagent:legacyfix.jar)
        alt [instance.releaseTime < 2011-05-25]
            ArgsJvm->>ArgsJvm: dataList.Add(-Djava.util.Arrays.useLegacyMergeSort=true)
        end
    end
    ArgsJvm-->>Launcher: jvmArgs
    Launcher->>JVM: Launch with jvmArgs
Loading

文件级变更

Change Details Files
将基于 RetroWrapper 的门控辅助方法替换为 LegacyFix 专用检查,并简化版本条件。
  • 在方法签名和 XML 文档注释中,将辅助方法从 RetroWrapper 相关命名重命名为 LegacyFix 相关命名。
  • 将启用包装器的条件,从基于 Drop/标志的检查改为简单的 releaseTime 截止(早于 2013-06-25)。
Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.cs
在 JVM 启动参数中接入 LegacyFix 以替代 RetroWrapper,并为非常老的版本加入额外标志。
  • 在现代 JVM 参数构造器中,当 LegacyFix 辅助方法返回 true 时,添加指向 legacyfix.jar 的 -javaagent 参数。
  • 对于早于 2011-05-25 的实例,在 JVM 参数中追加 Arrays.useLegacyMergeSort 系统属性。
  • 移除之前与 RetroWrapper 相关的 retrowrapper.doUpdateCheck 标志。
  • 从旧版游戏参数路径中移除 RetroWrapper tweakClass 参数注入。
Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.cs
更新库解压逻辑,以分发 legacyfix.jar 来替代 RetroWrapper,并调整日志记录。
  • 当需要 LegacyFix 时,将资源解压为 legacyfix.jar 并写入 legacyfix 库目录。
  • 移除之前将 RetroWrapper.jar 添加到 classpath 列表的逻辑,仅保留 LegacyFix jar 的解压。
  • 将失败日志消息文本从 RetroWrapper 相关描述更新为 LegacyFix 相关描述。
Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.cs

提示与命令

与 Sourcery 交互

  • 触发一次新的审阅: 在 pull request 上评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub issue: 在审阅评论下回复,要求 Sourcery 从该评论创建 issue。你也可以回复 @sourcery-ai issue 来从该评论创建 issue。
  • 生成 pull request 标题: 在 pull request 标题中任意位置写上 @sourcery-ai,即可随时生成标题。也可以在 pull request 中评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文任意位置写上 @sourcery-ai summary,即可在该位置生成 PR 摘要。也可以在 pull request 中评论 @sourcery-ai summary 来在任意时间(重新)生成摘要。
  • 生成审阅者指南: 在 pull request 中评论 @sourcery-ai guide,即可在任意时间(重新)生成审阅者指南。
  • 解决所有 Sourcery 评论: 在 pull request 中评论 @sourcery-ai resolve,以解决所有 Sourcery 评论。如果你已经处理完所有评论且不想再看到它们,这会非常有用。
  • 撤销所有 Sourcery 审阅: 在 pull request 中评论 @sourcery-ai dismiss,以撤销所有现有的 Sourcery 审阅。特别适合想要从头开始新的审阅时使用——不要忘记再评论 @sourcery-ai review 以触发新的审阅!

自定义你的体验

访问你的 控制面板 以:

  • 启用或禁用审阅功能,例如 Sourcery 生成的 pull request 摘要、审阅者指南等。
  • 更改审阅语言。
  • 添加、删除或编辑自定义审阅指令。
  • 调整其他审阅设置。

获取帮助

Original review guide in English

Reviewer's Guide

Replace RetroWrapper-based legacy Minecraft handling with LegacyFix, simplifying the version gating logic and wiring LegacyFix into JVM args and resource extraction while removing unused RetroWrapper-specific code paths.

Sequence diagram for LegacyFix integration in Minecraft launch

sequenceDiagram
    participant Launcher as McLaunch
    participant ArgsJvm as McLaunchArgumentsJvmNew
    participant ArgsReplace as McLaunchArgumentsReplace
    participant NeedsLegacyFix as McLaunchNeedsLegacyFix
    participant ModBase
    participant JVM

    Launcher->>ArgsJvm: McLaunchArgumentsJvmNew(instance)
    ArgsJvm->>NeedsLegacyFix: McLaunchNeedsLegacyFix(instance)
    alt [LegacyFix needed]
        ArgsJvm->>ArgsReplace: McLaunchArgumentsReplace(instance)
        ArgsReplace->>NeedsLegacyFix: McLaunchNeedsLegacyFix(instance)
        alt [LegacyFix needed]
            ArgsReplace->>ModBase: WriteFile(legacyFixPath, GetResourceStream)
        end
        ArgsJvm->>ArgsJvm: dataList.Add(-javaagent:legacyfix.jar)
        alt [instance.releaseTime < 2011-05-25]
            ArgsJvm->>ArgsJvm: dataList.Add(-Djava.util.Arrays.useLegacyMergeSort=true)
        end
    end
    ArgsJvm-->>Launcher: jvmArgs
    Launcher->>JVM: Launch with jvmArgs
Loading

File-Level Changes

Change Details Files
Replace the RetroWrapper gating helper with a LegacyFix-specific check and simplify the version condition.
  • Rename the helper from RetroWrapper-specific naming to LegacyFix naming in method signature and XML doc comment.
  • Change the condition to enable the wrapper from a Drop/flag-based check to a simple releaseTime cutoff before 2013-06-25.
Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.cs
Wire LegacyFix into the JVM launch arguments instead of RetroWrapper, including additional flags for very old versions.
  • In the modern JVM argument builder, add -javaagent pointing to legacyfix.jar when the LegacyFix helper returns true.
  • For instances older than 2011-05-25, append the Arrays.useLegacyMergeSort system property to JVM args.
  • Remove the previous RetroWrapper-specific retrowrapper.doUpdateCheck flag.
  • Remove the RetroWrapper tweakClass argument injection from the old game argument path.
Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.cs
Update library extraction logic to ship legacyfix.jar instead of RetroWrapper and adjust logging.
  • Change the resource extraction to write legacyfix.jar into the legacyfix library directory when LegacyFix is needed.
  • Remove the previous addition of RetroWrapper.jar to the classpath list, leaving only extraction of the LegacyFix jar.
  • Update failure logging message text from RetroWrapper-specific wording to LegacyFix-specific wording.
Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.cs

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

@sourcery-ai sourcery-ai 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.

Hey - 我在这里给出了一些总体反馈:

  • 针对 <1.6Beta 1.6 使用的硬编码日期阈值,如果能提取成具名常量(例如 LEGACY_FIX_INTRODUCTION_DATEBETA_16_RELEASE_DATE)并在需要的地方复用,会更加清晰且不易出错。
  • 在构建诸如 legacyFixPath 这样的文件系统路径时,建议使用 Path.Combine 而不是手动字符串拼接,以避免路径分隔符问题并提升可读性。
用于 AI 代理的提示
Please address the comments from this code review:

## Overall Comments
- The hard-coded date thresholds for `<1.6` and `Beta 1.6` would be clearer and less error-prone if extracted into named constants (e.g., `LEGACY_FIX_INTRODUCTION_DATE`, `BETA_16_RELEASE_DATE`) and reused wherever needed.
- When building file system paths such as `legacyFixPath`, consider using `Path.Combine` instead of manual string concatenation to avoid path separator issues and improve readability.

Sourcery 对开源项目是免费的——如果你觉得我们的代码审查有帮助,欢迎分享 ✨
帮我变得更有用!请对每条评论点 👍 或 👎,我会根据你的反馈改进后续的代码审查。
Original comment in English

Hey - I've left some high level feedback:

  • The hard-coded date thresholds for <1.6 and Beta 1.6 would be clearer and less error-prone if extracted into named constants (e.g., LEGACY_FIX_INTRODUCTION_DATE, BETA_16_RELEASE_DATE) and reused wherever needed.
  • When building file system paths such as legacyFixPath, consider using Path.Combine instead of manual string concatenation to avoid path separator issues and improve readability.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The hard-coded date thresholds for `<1.6` and `Beta 1.6` would be clearer and less error-prone if extracted into named constants (e.g., `LEGACY_FIX_INTRODUCTION_DATE`, `BETA_16_RELEASE_DATE`) and reused wherever needed.
- When building file system paths such as `legacyFixPath`, consider using `Path.Combine` instead of manual string concatenation to avoid path separator issues and improve readability.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@zkitefly zkitefly marked this pull request as draft June 16, 2026 07:21
@pcl-ce-automation pcl-ce-automation Bot added 🚧 正在处理 开发人员正在对该内容进行开发、测试或修复,进展中 and removed 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 labels Jun 16, 2026
@LinQingYuu

Copy link
Copy Markdown
Member

所以这个 LegacyFix 是?

@zkitefly

Copy link
Copy Markdown
Contributor Author

所以这个 LegacyFix 是?

https://github.com/betacraftuk/legacyfix

换他的原因是他一直在更新,而且他们就是专门做这个的,应该效果更好

This comment was marked as resolved.

LuLu-ling and others added 23 commits June 16, 2026 17:27
* chore(tool-test): remove `BtnCrash_Click`

* Visibility

* 1

* chore(test): update BtnCrash visibility for debugging
fix(open-website): 修复浏览器配置错误时未观测到的异步异常 [Composer]

将 OpenWebsite 中的 Process.Start 改为同步调用,使既有
try/catch 能捕获打开失败并显示降级提示,与 ShellOnly 一致。

Close PCL-Community#2993

Co-authored-by: Cursor <cursoragent@cursor.com>
…#3150)

* fix(mod-main): 修复提示右对齐时被右下角附加按钮遮挡 (PCL-Community#3147)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor(ui): 提示层级改用 XAML Panel.ZIndex 设置,始终高于其他控件 (PCL-Community#3147)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
* refactor: remove async suffix

[SKIP CI]

* refactor: remove async suffix

[SKIP CI]

* refactor: remove async suffix and token argument required

[SKIP CI]

* refactor: remove async suffix and improve xml doc string

[SKIP CI]

* refactor: remove token pass

* fix: remove async
@pcl-ce-automation pcl-ce-automation Bot added size: L PR 大小评估:大型 and removed size: M PR 大小评估:中型 labels Jun 16, 2026
@zkitefly

Copy link
Copy Markdown
Contributor Author

不小心把别人的 commit 也给签名了,换个分支把(

@zkitefly zkitefly closed this Jun 16, 2026
@pcl-ce-automation pcl-ce-automation Bot removed 🚧 正在处理 开发人员正在对该内容进行开发、测试或修复,进展中 size: L PR 大小评估:大型 labels Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants