Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -268,18 +268,26 @@ public boolean equals(Object o) {
}

public static final class Release extends GameVersionNumber {
private static final int MINIMUM_YEAR_MAJOR_VERSION = 25;
private static final int MINIMUM_YEAR_MAJOR_VERSION = 26;

public enum ReleaseType {
UNKNOWN(""),
SNAPSHOT("-snapshot-"),
PRE_RELEASE("-pre"),
RELEASE_CANDIDATE("-rc"),
PRE_RELEASE("-pre", "-pre-"),
RELEASE_CANDIDATE("-rc", "-rc-"),
GA("");
private final String infix;

private final String legacyInfix;
private final String newInfix;

ReleaseType(String infix) {
this.infix = infix;
this.legacyInfix = infix;
this.newInfix = infix;
}

ReleaseType(String legacyInfix, String newInfix) {
this.legacyInfix = legacyInfix;
this.newInfix = newInfix;
}
}

Expand Down Expand Up @@ -317,6 +325,8 @@ static Release parse(String value) {

String suffix = matcher.group("suffix");

boolean isLegacyRelease = major == 1;

ReleaseType releaseType;
VersionNumber eaVersion;
Additional additional = Additional.NONE;
Expand All @@ -342,10 +352,15 @@ static Release parse(String value) {
releaseType = ReleaseType.SNAPSHOT;
eaVersion = VersionNumber.asVersion(suffix.substring(" Snapshot ".length()));
} else if (suffix.startsWith("-pre-")) {
needNormalize = true;
if (isLegacyRelease) {
needNormalize = true;
}
releaseType = ReleaseType.PRE_RELEASE;
eaVersion = VersionNumber.asVersion(suffix.substring("-pre-".length()));
} else if (suffix.startsWith("-pre")) {
if (!isLegacyRelease) {
needNormalize = true;
}
releaseType = ReleaseType.PRE_RELEASE;
eaVersion = VersionNumber.asVersion(suffix.substring("-pre".length()));
} else if (suffix.startsWith(" Pre-Release ")) {
Expand All @@ -358,10 +373,15 @@ static Release parse(String value) {
releaseType = ReleaseType.PRE_RELEASE;
eaVersion = VersionNumber.asVersion(suffix.substring(" Pre-release ".length()));
} else if (suffix.startsWith("-rc-")) {
needNormalize = true;
if (isLegacyRelease) {
needNormalize = true;
}
releaseType = ReleaseType.RELEASE_CANDIDATE;
eaVersion = VersionNumber.asVersion(suffix.substring("-rc-".length()));
} else if (suffix.startsWith("-rc")) {
if (!isLegacyRelease) {
needNormalize = true;
}
releaseType = ReleaseType.RELEASE_CANDIDATE;
eaVersion = VersionNumber.asVersion(suffix.substring("-rc".length()));
} else if (suffix.startsWith(" Release Candidate ")) {
Expand All @@ -377,7 +397,7 @@ static Release parse(String value) {
StringBuilder builder = new StringBuilder(value.length());
builder.append(matcher.group("prefix"));
if (releaseType != ReleaseType.GA) {
builder.append(releaseType.infix);
builder.append(isLegacyRelease ? releaseType.legacyInfix : releaseType.newInfix);
builder.append(eaVersion);
}
builder.append(additional.suffix);
Expand Down
17 changes: 17 additions & 0 deletions HMCLCore/src/main/resources/assets/game/versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -895,3 +895,20 @@
1.21.11-rc3_unobfuscated
1.21.11
1.21.11_unobfuscated
26.1-snapshot-1
26.1-snapshot-2
26.1-snapshot-3
26.1-snapshot-4
26.1-snapshot-5
26.1-snapshot-6
26.1-snapshot-7
26.1-snapshot-8
26.1-snapshot-9
26.1-snapshot-10
26.1-snapshot-11
26.1-pre-1
26.1-pre-2
26.1-pre-3
26.1-rc-1
26.1-rc-2
Comment on lines +909 to +913
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

The pre-release and release-candidate entries use a -pre-<n> / -rc-<n> format (e.g., 26.1-pre-1). Everywhere else in this file uses the canonical Minecraft id format without the extra hyphen (e.g., 1.21.11-pre1, 1.21.11-rc1). Even though the parser normalizes these, keeping the canonical ids here avoids inconsistent display/lookup and reduces the risk of mismatching upstream version identifiers.

Suggested change
26.1-pre-1
26.1-pre-2
26.1-pre-3
26.1-rc-1
26.1-rc-2
26.1-pre1
26.1-pre2
26.1-pre3
26.1-rc1
26.1-rc2

Copilot uses AI. Check for mistakes.
26.1
Original file line number Diff line number Diff line change
Expand Up @@ -432,14 +432,13 @@ public void testToNormalizedString() {
assertNormalized(version, version);
}

assertNormalized("26.1-snapshot-1", "26.1 Snapshot 1");
assertNormalized("1.21.11-pre3", "1.21.11-pre-3");
assertNormalized("1.21.11-pre3", "1.21.11 Pre-Release 3");
assertNormalized("1.21.11-pre3_unobfuscated", "1.21.11 Pre-Release 3 Unobfuscated");
assertNormalized("1.21.11-pre3_unobfuscated", "1.21.11-pre3 Unobfuscated");
assertNormalized("26.1-pre1", "26.1-pre-1");
assertNormalized("1.21.11-rc1", "1.21.11-rc-1");
assertNormalized("1.21.11-rc1", "1.21.11 Release Candidate 1");
assertNormalized("1.21.11-rc1_unobfuscated", "1.21.11 Release Candidate 1 Unobfuscated");
assertNormalized("26.1-rc1", "26.1-rc-1");
assertNormalized("1.14_combat-212796", "1.14.3 - Combat Test");
assertNormalized("1.14_combat-0", "Combat Test 2");
assertNormalized("1.14_combat-3", "Combat Test 3");
Expand All @@ -463,6 +462,9 @@ public void testToNormalizedString() {
assertNormalized("1.19_deep_dark_experimental_snapshot-1", "Deep Dark Experimental Snapshot 1");
assertNormalized("20w14infinite", "20w14~");
assertNormalized("22w13oneBlockAtATime", "22w13oneblockatatime");
assertNormalized("26.1-snapshot-1", "26.1 Snapshot 1");
assertNormalized("26.1-rc-1", "26.1-rc1");
assertNormalized("26.1-pre-1", "26.1-pre1");
}

@Test
Expand Down
Loading