Skip to content

更新 Cleanroom Java 版本选择逻辑#5782

Merged
Glavo merged 5 commits intoHMCL-dev:mainfrom
CiiLu:cleanroommcmcmcmcmc
Mar 17, 2026
Merged

更新 Cleanroom Java 版本选择逻辑#5782
Glavo merged 5 commits intoHMCL-dev:mainfrom
CiiLu:cleanroommcmcmcmcmc

Conversation

@CiiLu
Copy link
Contributor

@CiiLu CiiLu commented Mar 13, 2026

resoloves #5780

launch.advice.java.auto=当前选择的 Java 版本不满足游戏要求。\n点击“是”即可由 HMCL 来自动选取合适的 Java 版本。\n或者你可以在“(全局/实例特定) 游戏设置 → 游戏 Java”中选择一个合适的 Java 版本。
launch.advice.java.modded_java_7=Minecraft 1.7.2 及更低版本需要 Java 7 及更低版本。
launch.advice.cleanroom=Cleanroom 只能在 Java 21 或更高版本上运行。请使用 Java 21 或最新版本。
launch.advice.cleanroom.newer=Cleanroom 只能在 Java 25 或更高版本上运行。请使用 Java 25 或最新版本。
Copy link
Member

Choose a reason for hiding this comment

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

这几句描述就是错的,这里不应该复制上面的描述,因为 Cleanroom 可以在 Java 21 或更高版本上运行。

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Cleanroom mod's Java version selection logic to dynamically determine the required Java version based on the Cleanroom version, fixing a bug where Cleanroom 0.5.0-alpha wasn't automatically selecting Java 25.

Changes:

  • Renamed CLEANROOM_JAVA_21 constraint to CLEANROOM with dynamic Java version range based on Cleanroom version (≥0.5.0 requires Java 25, older requires Java 21)
  • Added GameJavaVersion.getCleanroomJavaVersion() to map Cleanroom versions to required Java versions
  • Updated i18n strings to include dynamic Java version and Cleanroom version in advice messages

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
GameJavaVersion.java Added getCleanroomJavaVersion() mapping Cleanroom version to Java version
JavaVersionConstraint.java Renamed CLEANROOM_JAVA_21 to CLEANROOM, added dynamic getJavaVersionRange override, updated method signatures to pass LibraryAnalyzer
LauncherHelper.java Updated all references from CLEANROOM_JAVA_21 to CLEANROOM, added Cleanroom-specific Java version resolution in launch checks
JavaManager.java Updated checkJava call to pass analyzer
I18N*.properties Updated cleanroom advice strings to include version parameters

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

public static GameJavaVersion getCleanroomJavaVersion(String cleanroomVersion) {
VersionNumber versionNumber = VersionNumber.asVersion(StringUtils.removeSuffix(cleanroomVersion, "-alpha"));
@Glavo Glavo merged commit c7b316e into HMCL-dev:main Mar 17, 2026
6 checks passed
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.

3 participants