添加对 25w45a_unobfuscated 的支持 (#4767)
This commit is contained in:
@@ -250,7 +250,7 @@ public final class VersionsPage extends Control implements WizardPage, Refreshab
|
|||||||
twoLineListItem.addTag(i18n("version.game.release"));
|
twoLineListItem.addTag(i18n("version.game.release"));
|
||||||
imageView.setImage(VersionIconType.GRASS.getIcon());
|
imageView.setImage(VersionIconType.GRASS.getIcon());
|
||||||
}
|
}
|
||||||
case PENDING, SNAPSHOT -> {
|
case SNAPSHOT, PENDING, UNOBFUSCATED -> {
|
||||||
if (versionType == RemoteVersion.Type.SNAPSHOT
|
if (versionType == RemoteVersion.Type.SNAPSHOT
|
||||||
&& GameVersionNumber.asGameVersion(remoteVersion.getGameVersion()).isAprilFools()) {
|
&& GameVersionNumber.asGameVersion(remoteVersion.getGameVersion()).isAprilFools()) {
|
||||||
twoLineListItem.addTag(i18n("version.game.april_fools"));
|
twoLineListItem.addTag(i18n("version.game.april_fools"));
|
||||||
@@ -455,7 +455,8 @@ public final class VersionsPage extends Control implements WizardPage, Refreshab
|
|||||||
return switch (filter) {
|
return switch (filter) {
|
||||||
case RELEASE -> versionType == RemoteVersion.Type.RELEASE;
|
case RELEASE -> versionType == RemoteVersion.Type.RELEASE;
|
||||||
case SNAPSHOTS -> versionType == RemoteVersion.Type.SNAPSHOT
|
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
|
case APRIL_FOOLS -> versionType == RemoteVersion.Type.SNAPSHOT
|
||||||
&& GameVersionNumber.asGameVersion(it.getGameVersion()).isAprilFools();
|
&& GameVersionNumber.asGameVersion(it.getGameVersion()).isAprilFools();
|
||||||
case OLD -> versionType == RemoteVersion.Type.OLD;
|
case OLD -> versionType == RemoteVersion.Type.OLD;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
package org.jackhuang.hmcl.util.i18n;
|
package org.jackhuang.hmcl.util.i18n;
|
||||||
|
|
||||||
import org.jackhuang.hmcl.download.game.GameRemoteVersion;
|
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.i18n.translator.Translator_lzh;
|
||||||
import org.jackhuang.hmcl.util.versioning.GameVersionNumber;
|
import org.jackhuang.hmcl.util.versioning.GameVersionNumber;
|
||||||
|
|
||||||
@@ -79,6 +80,8 @@ public final class MinecraftWiki {
|
|||||||
if (SNAPSHOT_PATTERN.matcher(wikiVersion).matches()) {
|
if (SNAPSHOT_PATTERN.matcher(wikiVersion).matches()) {
|
||||||
if (wikiVersion.equals("22w13oneblockatatime"))
|
if (wikiVersion.equals("22w13oneblockatatime"))
|
||||||
wikiVersion = "22w13oneBlockAtATime";
|
wikiVersion = "22w13oneBlockAtATime";
|
||||||
|
else
|
||||||
|
wikiVersion = StringUtils.removeSuffix(wikiVersion, "_unobfuscated");
|
||||||
return locale.i18n("wiki.version.game.snapshot", wikiVersion) + variantSuffix;
|
return locale.i18n("wiki.version.game.snapshot", wikiVersion) + variantSuffix;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ public class RemoteVersion implements Comparable<RemoteVersion> {
|
|||||||
RELEASE,
|
RELEASE,
|
||||||
SNAPSHOT,
|
SNAPSHOT,
|
||||||
OLD,
|
OLD,
|
||||||
PENDING
|
PENDING,
|
||||||
|
UNOBFUSCATED,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ public final class GameRemoteVersion extends RemoteVersion {
|
|||||||
case SNAPSHOT -> Type.SNAPSHOT;
|
case SNAPSHOT -> Type.SNAPSHOT;
|
||||||
case UNKNOWN -> Type.UNCATEGORIZED;
|
case UNKNOWN -> Type.UNCATEGORIZED;
|
||||||
case PENDING -> Type.PENDING;
|
case PENDING -> Type.PENDING;
|
||||||
|
case UNOBFUSCATED -> Type.UNOBFUSCATED;
|
||||||
default -> Type.OLD;
|
default -> Type.OLD;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public enum ReleaseType {
|
|||||||
OLD_BETA("old-beta"),
|
OLD_BETA("old-beta"),
|
||||||
OLD_ALPHA("old-alpha"),
|
OLD_ALPHA("old-alpha"),
|
||||||
PENDING("pending"),
|
PENDING("pending"),
|
||||||
|
UNOBFUSCATED("unobfuscated"),
|
||||||
UNKNOWN("unknown");
|
UNKNOWN("unknown");
|
||||||
|
|
||||||
private final String id;
|
private final String id;
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public abstract sealed class GameVersionNumber implements Comparable<GameVersion
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAprilFools() {
|
public boolean isAprilFools() {
|
||||||
if (this instanceof Special)
|
if (this instanceof Special && !value.endsWith("_unobfuscated"))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (this instanceof Snapshot snapshot) {
|
if (this instanceof Snapshot snapshot) {
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
{
|
{
|
||||||
"versions": [
|
"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",
|
"id": "1.19_deep_dark_experimental_snapshot-1",
|
||||||
"type": "pending",
|
"type": "pending",
|
||||||
|
|||||||
@@ -849,3 +849,9 @@
|
|||||||
1.21.9
|
1.21.9
|
||||||
1.21.10-rc1
|
1.21.10-rc1
|
||||||
1.21.10
|
1.21.10
|
||||||
|
25w41a
|
||||||
|
25w42a
|
||||||
|
25w43a
|
||||||
|
25w44a
|
||||||
|
25w45a
|
||||||
|
25w45a_unobfuscated
|
||||||
@@ -121,6 +121,7 @@ public final class GameVersionNumberTest {
|
|||||||
assertFalse(isAprilFools("25w21a"));
|
assertFalse(isAprilFools("25w21a"));
|
||||||
assertFalse(isAprilFools("13w12~"));
|
assertFalse(isAprilFools("13w12~"));
|
||||||
assertFalse(isAprilFools("15w14b"));
|
assertFalse(isAprilFools("15w14b"));
|
||||||
|
assertFalse(isAprilFools("25w45a_unobfuscated"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -272,6 +273,8 @@ public final class GameVersionNumberTest {
|
|||||||
"24w13a",
|
"24w13a",
|
||||||
"24w14potato",
|
"24w14potato",
|
||||||
"24w14a",
|
"24w14a",
|
||||||
|
"25w45a",
|
||||||
|
"25w45a_unobfuscated",
|
||||||
"Unknown",
|
"Unknown",
|
||||||
"100.0"
|
"100.0"
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user