Skip to content

feat #3763: add April Fool's Day version category #3905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

PerssonBrown
Copy link

@PerssonBrown PerssonBrown commented May 10, 2025

feat #3763
add April Fool's Day version category
image

@zkitefly
Copy link
Member

zkitefly commented May 10, 2025

缺失了 2.0 愚人节版本,因为 client json 所标注的时间是错误的(这些 client json 来自 Minecraft Wiki),或许应该单独做判断?

而且版本 id 后缀包含类型,然后跳转到了错误的地址(https://zh.minecraft.wiki/w/2.0_blue?variant=zh-cn),或许这个也应该单独做判断?

Copy link
Contributor

@3gf8jv4dv 3gf8jv4dv left a comment

Choose a reason for hiding this comment

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

Firstly, I'm concerned about the UI overflow that might result from too many options above. Check the image.

Image

Image

Secondly, the time displayed on this page changes depending on the user's current time zone, which in some different time zones may result in this category not presenting results at all. I think you should use other methods to achieve the same effect and make sure that the results are displayed as they should be even in various time zones.

add special judgement for 'Minecraft 2.0' when classifying minecraft versions
@PerssonBrown
Copy link
Author

Firstly, I'm concerned about the UI overflow that might result from too many options above. Check the image.

Adding a separate panel for the search box would solve it.

Image

image

Is that acceptable?

Secondly, the time displayed on this page changes depending on the user's current time zone, which in some different time zones may result in this category not presenting results at all. I think you should use other methods to achieve the same effect and make sure that the results are displayed as they should be even in various time zones.

Most April Fools' versions were released on 1 April UTC. However, there exists an April Fools' Day version released on 31 March UTC, which is Java_Edition_1.RV-Pre1

Maybe use UTC time for judgement and special judgement for Java_Edition_1.RV-Pre1?

@PerssonBrown PerssonBrown marked this pull request as draft May 11, 2025 05:37
@PerssonBrown PerssonBrown marked this pull request as ready for review May 11, 2025 05:50
@zkitefly
Copy link
Member

我觉得可以直接硬编这些已有的愚人节版本,然后再判断 4 月 1 日的版本(将这个判断视作硬编前的特殊判断)

@PerssonBrown
Copy link
Author

我觉得可以直接硬编这些已有的愚人节版本,然后再判断 4 月 1 日的版本(将这个判断视作硬编前的特殊判断)

Hardcoding would result in the need to modify the source code for each release of April Fool's Day version.
Since 2013, there has only been one April Fool's Day version released on 31 March instead of 1 April.
Perhaps hardcoding only those releases that were not released on 1 April would reduce the workload.

@3gf8jv4dv
Copy link
Contributor

Adding a separate panel for the search box would solve it.

Is that acceptable?

Personally, I think that for the search and refresh icons, you can just keep the icons themselves.
The acceptability of this depends on the opinion of the maintainers.

Most April Fools' versions were released on 1 April UTC. However, there exists an April Fools' Day version released on 31 March UTC, which is Java_Edition_1.RV-Pre1

Maybe use UTC time for judgement and special judgement for Java_Edition_1.RV-Pre1?

I feel good.

@PerssonBrown
Copy link
Author

Personally, I think that for the search and refresh icons, you can just keep the icons themselves.

image

image

Indeed, it looks better the way you said. I have implemented it in the latest commit. (e4b98f5).

@PerssonBrown PerssonBrown requested a review from 3gf8jv4dv May 23, 2025 06:36
Copy link
Contributor

@3gf8jv4dv 3gf8jv4dv left a comment

Choose a reason for hiding this comment

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

Looks good to me.

CC @Glavo and @zkitefly

@@ -1351,6 +1351,7 @@ version.empty=No Instances
version.empty.add=Add new instance
version.empty.launch=No available instances. Clicking "OK" will take you to the "Download" page.\n\nYou can also download the game or switch game directories via the "Download" or "All Instances" buttons on the HMCL homepage.
version.empty.hint=There are no Minecraft instances here.\nYou can try switching to another game directory or clicking here to download one.
version.game.aprilfools=AprilFools
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
version.game.aprilfools=AprilFools
version.game.aprilfools=April Fools

@zkitefly zkitefly requested review from Glavo and burningtnt May 26, 2025 23:52
@Glavo Glavo requested a review from Copilot May 29, 2025 04:01
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Add support for an April Fool’s Day version category across backend classification, UI filters, and localization.

  • Introduces a new ReleaseType.APRILFOOLS and maps specific version patterns or release dates to Type.APRILFOOLS
  • Updates the version list UI to include an April Fool’s filter checkbox and display tag
  • Adds localization entries for Chinese (simplified & traditional) and English

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
HMCLCore/src/main/java/org/jackhuang/hmcl/game/ReleaseType.java Add new APRILFOOLS enum constant
HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameRemoteVersion.java Enhance getReleaseType() to detect April Fool’s versions
HMCLCore/src/main/java/org/jackhuang/hmcl/download/RemoteVersion.java Extend Type enum with APRILFOOLS
HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties Add version.game.aprilfools translation
HMCL/src/main/resources/assets/lang/I18N_zh.properties Add version.game.aprilfools translation
HMCL/src/main/resources/assets/lang/I18N.properties Add version.game.aprilfools translation (English)
HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPage.java Add April Fool’s filter checkbox and display logic in the UI
Comments suppressed due to low confidence (1)

HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameRemoteVersion.java:65

  • The new APRILFOOLS detection logic isn’t covered by existing tests; consider adding unit tests for versions on April 1st and matching version-prefix scenarios.
private static Type getReleaseType(ReleaseType type, Instant releaseDate, String gameVersion) {

if (type == null) return Type.UNCATEGORIZED;
private static Type getReleaseType(ReleaseType type, Instant releaseDate, String gameVersion) {
if (type == null || releaseDate == null || gameVersion == null) return Type.UNCATEGORIZED;
if (gameVersion.startsWith("2.0")) return Type.APRILFOOLS;
Copy link
Preview

Copilot AI May 29, 2025

Choose a reason for hiding this comment

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

The hardcoded prefix "2.0" is a magic string; consider extracting it into a descriptive constant (e.g., APRIL_FOOLS_VERSION_PREFIX) to improve readability.

Suggested change
if (gameVersion.startsWith("2.0")) return Type.APRILFOOLS;
if (gameVersion.startsWith(APRIL_FOOLS_VERSION_PREFIX)) return Type.APRILFOOLS;

Copilot uses AI. Check for mistakes.

Comment on lines +69 to +72
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
cal.setTime(Date.from(releaseDate));
int month = cal.get(Calendar.MONTH);
int day = cal.get(Calendar.DAY_OF_MONTH);
Copy link
Preview

Copilot AI May 29, 2025

Choose a reason for hiding this comment

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

This uses the legacy Calendar/Date API; consider using java.time (e.g., releaseDate.atZone(ZoneOffset.UTC)) for clearer and more modern date handling.

Suggested change
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
cal.setTime(Date.from(releaseDate));
int month = cal.get(Calendar.MONTH);
int day = cal.get(Calendar.DAY_OF_MONTH);
int month = releaseDate.atZone(ZoneOffset.UTC).getMonthValue() - 1; // Adjust to match Calendar.MONTH
int day = releaseDate.atZone(ZoneOffset.UTC).getDayOfMonth();

Copilot uses AI. Check for mistakes.

@@ -1351,6 +1351,7 @@ version.empty=No Instances
version.empty.add=Add new instance
version.empty.launch=No available instances. Clicking "OK" will take you to the "Download" page.\n\nYou can also download the game or switch game directories via the "Download" or "All Instances" buttons on the HMCL homepage.
version.empty.hint=There are no Minecraft instances here.\nYou can try switching to another game directory or clicking here to download one.
version.game.aprilfools=AprilFools
Copy link
Preview

Copilot AI May 29, 2025

Choose a reason for hiding this comment

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

[nitpick] The English label "AprilFools" lacks spacing; consider changing it to "April Fools" or "April Fool's" for better readability.

Suggested change
version.game.aprilfools=AprilFools
version.game.aprilfools=April Fools

Copilot uses AI. Check for mistakes.

content.getTags().setAll(i18n("version.game.aprilfools"));
content.setImage(VersionIconType.COMMAND.getIcon());
if (remoteVersion.getGameVersion().startsWith("2.0")) {
content.setExternalLink(i18n("wiki.version.game.snapshot", "2.0"));
Copy link
Preview

Copilot AI May 29, 2025

Choose a reason for hiding this comment

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

The APRILFOOLS case reuses the snapshot wiki link; consider defining a dedicated translation key or URL (e.g., wiki.version.game.aprilfools) to avoid confusion for end users.

Copilot uses AI. Check for mistakes.

@Glavo
Copy link
Member

Glavo commented May 29, 2025

这样修改应该会破坏 Version 的序列化,我有空再看看。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants