Skip to content

Commit

Permalink
Add support for long release version names.
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinSVK12 committed Apr 26, 2024
1 parent de95fb0 commit 41b0105
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,14 @@ public final class McVersionLookup {
+ "\\d+w\\d+[a-z]|" // modern snapshot: 12w34a
+ "[a-c]\\d\\.\\d+(\\.\\d+)?[a-z]?(_\\d+)?[a-z]?|" // alpha/beta a1.2.3_45
+ "(Alpha|Beta) v?\\d+\\.\\d+(\\.\\d+)?[a-z]?(_\\d+)?[a-z]?|" // long alpha/beta names: Alpha v1.2.3_45
+ "v?\\d+\\.\\d+(\\.\\d+)?[a-z]?(_\\d+)?[a-z]?|" // long release names: 1.2.3_45
+ "Inf?dev (0\\.31 )?\\d+(-\\d+)?|" // long indev/infdev names: Infdev 12345678-9
+ "(rd|inf)-\\d+|" // early rd-123, inf-123
+ "1\\.RV-Pre1|3D Shareware v1\\.34|23w13a_or_b|" // odd exceptions
+ "(.*[Ee]xperimental [Ss]napshot )(\\d+)" // Experimental versions.
);
private static final Pattern RELEASE_PATTERN = Pattern.compile("\\d+\\.\\d+(\\.\\d+)?");
private static final Pattern LONG_RELEASE_PATTERN = Pattern.compile("v?\\d+\\.\\d+(\\.\\d+)?[a-z]?(_\\d+)?[a-z]?|");
private static final Pattern PRE_RELEASE_PATTERN = Pattern.compile(".+(?:-pre| Pre-?[Rr]elease )(\\d.?+)");
private static final Pattern RELEASE_CANDIDATE_PATTERN = Pattern.compile(".+(?:-rc| [Rr]elease Candidate )(\\d+)");
private static final Pattern SNAPSHOT_PATTERN = Pattern.compile("(?:Snapshot )?(\\d+)w0?(0|[1-9]\\d*)([a-z])");
Expand Down Expand Up @@ -274,6 +276,7 @@ private static <T extends ClassVisitor & Analyzer> String analyze(InputStream is

protected static String getRelease(String version) {
if (RELEASE_PATTERN.matcher(version).matches()) return version;
if (LONG_RELEASE_PATTERN.matcher(version).matches()) return version;

assert isProbableVersion(version);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public final class FabricLoaderImpl extends net.fabricmc.loader.FabricLoader {

public static final int ASM_VERSION = Opcodes.ASM9;

public static final String VERSION = "0.15.6-babric.4-bta";
public static final String VERSION = "0.15.6-babric.5-bta";
public static final String MOD_ID = "fabricloader";

public static final String CACHE_DIR_NAME = ".fabric"; // relative to game dir
Expand Down

0 comments on commit 41b0105

Please sign in to comment.