Skip to content

Commit d6a72f9

Browse files
committed
Support new numbering system pre-releases
1 parent 95a2985 commit d6a72f9

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/main/java/net/minecraftforge/srgutils/MinecraftVersion.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,14 @@ else if (lower.startsWith("rd-")) {
152152
String nearest = version;
153153
// The new versioning system https://www.minecraft.net/en-us/article/minecraft-new-version-numbering-system
154154
// They did not specify pre-release or release candidate naming system.
155-
// The only one we've seen so far is snapshot. So i'll add that and add the others when they show up
155+
// The only one we've seen so far is snapshot and pre-release. So i'll add that and add the others when they show up
156156
if (version.contains("-snapshot-")) {
157157
String[] pts = version.split("-snapshot-");
158158
return new MinecraftVersion(Type.SNAPSHOT, version, Integer.parseInt(pts[1]), -1, 0, null, splitDots(pts[0]));
159+
} else if (version.contains("-pre-")) { // New Numbering system pre-releases have {version}-pre-{number}
160+
String[] pts = version.split("-pre-");
161+
pre = Integer.parseInt(pts[1]);
162+
nearest = pts[0];
159163
} else if (version.contains("-pre")) {
160164
String[] pts = version.split("-pre");
161165
pre = Integer.parseInt(pts[1]);

src/test/java/net/minecraftforge/srgutils/test/VersionList.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public class VersionList {
1919
//Just copy pasted with a little resorting from Mojang's version manifest, https://launchermeta.mojang.com/mc/game/version_manifest.json
2020
//We can't read this file directly, because its in strict release date order, not target version order
2121
private final String[] versions = new String[] {
22+
"26.1-pre-1",
2223
"26.1-snapshot-11",
2324
"26.1-snapshot-10",
2425
"26.1-snapshot-9",

0 commit comments

Comments
 (0)