添加对 25w45a_unobfuscated 的支持 (#4767)

This commit is contained in:
Glavo
2025-11-08 21:50:16 +08:00
committed by GitHub
parent f0a16b0cd9
commit d93f4d6bbb
9 changed files with 28 additions and 5 deletions

View File

@@ -250,7 +250,7 @@ public final class VersionsPage extends Control implements WizardPage, Refreshab
twoLineListItem.addTag(i18n("version.game.release"));
imageView.setImage(VersionIconType.GRASS.getIcon());
}
case PENDING, SNAPSHOT -> {
case SNAPSHOT, PENDING, UNOBFUSCATED -> {
if (versionType == RemoteVersion.Type.SNAPSHOT
&& GameVersionNumber.asGameVersion(remoteVersion.getGameVersion()).isAprilFools()) {
twoLineListItem.addTag(i18n("version.game.april_fools"));
@@ -455,7 +455,8 @@ public final class VersionsPage extends Control implements WizardPage, Refreshab
return switch (filter) {
case RELEASE -> versionType == RemoteVersion.Type.RELEASE;
case SNAPSHOTS -> versionType == RemoteVersion.Type.SNAPSHOT
|| versionType == RemoteVersion.Type.PENDING;
|| versionType == RemoteVersion.Type.PENDING
|| versionType == RemoteVersion.Type.UNOBFUSCATED;
case APRIL_FOOLS -> versionType == RemoteVersion.Type.SNAPSHOT
&& GameVersionNumber.asGameVersion(it.getGameVersion()).isAprilFools();
case OLD -> versionType == RemoteVersion.Type.OLD;

View File

@@ -18,6 +18,7 @@
package org.jackhuang.hmcl.util.i18n;
import org.jackhuang.hmcl.download.game.GameRemoteVersion;
import org.jackhuang.hmcl.util.StringUtils;
import org.jackhuang.hmcl.util.i18n.translator.Translator_lzh;
import org.jackhuang.hmcl.util.versioning.GameVersionNumber;
@@ -79,6 +80,8 @@ public final class MinecraftWiki {
if (SNAPSHOT_PATTERN.matcher(wikiVersion).matches()) {
if (wikiVersion.equals("22w13oneblockatatime"))
wikiVersion = "22w13oneBlockAtATime";
else
wikiVersion = StringUtils.removeSuffix(wikiVersion, "_unobfuscated");
return locale.i18n("wiki.version.game.snapshot", wikiVersion) + variantSuffix;
}
}

View File

@@ -128,6 +128,7 @@ public class RemoteVersion implements Comparable<RemoteVersion> {
RELEASE,
SNAPSHOT,
OLD,
PENDING
PENDING,
UNOBFUSCATED,
}
}

View File

@@ -73,6 +73,7 @@ public final class GameRemoteVersion extends RemoteVersion {
case SNAPSHOT -> Type.SNAPSHOT;
case UNKNOWN -> Type.UNCATEGORIZED;
case PENDING -> Type.PENDING;
case UNOBFUSCATED -> Type.UNOBFUSCATED;
default -> Type.OLD;
};
}

View File

@@ -28,6 +28,7 @@ public enum ReleaseType {
OLD_BETA("old-beta"),
OLD_ALPHA("old-alpha"),
PENDING("pending"),
UNOBFUSCATED("unobfuscated"),
UNKNOWN("unknown");
private final String id;

View File

@@ -100,7 +100,7 @@ public abstract sealed class GameVersionNumber implements Comparable<GameVersion
}
public boolean isAprilFools() {
if (this instanceof Special)
if (this instanceof Special && !value.endsWith("_unobfuscated"))
return true;
if (this instanceof Snapshot snapshot) {

View File

@@ -1,5 +1,12 @@
{
"versions": [
{
"id": "25w45a_unobfuscated",
"type" : "unobfuscated",
"url": "https://piston-meta.mojang.com/v1/packages/7a3c149f148b6aa5ac3af48c4f701adea7e5b615/25w45a_unobfuscated.json",
"time" : "2025-11-04T14:07:08+00:00",
"releaseTime" : "2025-11-04T14:07:08+00:00"
},
{
"id": "1.19_deep_dark_experimental_snapshot-1",
"type": "pending",

View File

@@ -848,4 +848,10 @@
1.21.9-rc1
1.21.9
1.21.10-rc1
1.21.10
1.21.10
25w41a
25w42a
25w43a
25w44a
25w45a
25w45a_unobfuscated

View File

@@ -121,6 +121,7 @@ public final class GameVersionNumberTest {
assertFalse(isAprilFools("25w21a"));
assertFalse(isAprilFools("13w12~"));
assertFalse(isAprilFools("15w14b"));
assertFalse(isAprilFools("25w45a_unobfuscated"));
}
@Test
@@ -272,6 +273,8 @@ public final class GameVersionNumberTest {
"24w13a",
"24w14potato",
"24w14a",
"25w45a",
"25w45a_unobfuscated",
"Unknown",
"100.0"
);