Skip to content

Conversation

@Mine-diamond
Copy link
Contributor

@Mine-diamond Mine-diamond commented Jan 13, 2026

继续 #4823 对世界信息界面进行的优化


世界管理:

  1. 添加WorldRefreshable 接口,当页面再次导航进入时刷新子页面
  2. 对于获取只读属性,现在使用isReadOnlyProperty而不是只能返回布尔值
  3. 实现Refreshable.refresh()方法和Refreshable.refreshableProperty()方法
  4. "生成启动脚本"按钮移至管理菜单
  5. 优化WorldManagePage的代码,将构建皮肤的代码拆分到皮肤类中
  6. 字段id修改为versionId以更好匹配它的含义

版本特性解析:

  1. 将WorldManagePage/WorldListItemSkin/DefaultLauncher中的部分硬编码的版本判断移动到World和ChunkBaseApp类中
  2. 在World类中添加supportsDatapacks()/supportsQuickPlay()/supportsQuickPlay(GameVersionNumber) 方法
  3. 在ChunkBaseApp类中添加supportEndCity(World) 方法

世界信息页面:

bug 修复:

  1. 修复了在部分版本无法正确获取维度信息的bug
  2. 修复了种子现实按钮在切换图标时位置发生变化的bug
  3. 修复了部分信息项总是尝试保存而不会检查输入有效性的bug

修改:

  1. 将第一块信息的标题“基本信息”修改为“世界信息”
  2. “游戏内时长”修改为“游戏时长”以更好的匹配它的作用,游戏时长现在显示为%d 天 %d 小时 %d 分钟而不是%s 天
  3. 添加世界出生点信息项
  4. 添加饱和度信息项

优化:

  1. 简化了床/重生锚位置信息项的实现
  2. 简化了游戏模式信息项的实现
  3. 修改各个辅助方法的名称使其更能表达自己的功能
  4. 修改各个字段的名称使之更能表达自己的作用
  5. 减少了setRightTextLabel需要的参数因为发现并不需要
  6. 提取更多样板代码到setRightTextField方法中以减少重复样板代码的带来的长度

世界列表页面:

  1. 将进入世界按钮暴露于世界列表
  2. 恢复缩进

数据包页面

  1. 现在当世界运行时禁用 禁用/启用/删除按钮,并在添加数据包时提示reload

World类:

  1. 现在getWorlds方法返回List<World>而不是Stream<World>
  2. 现在isLocked()方法每次返回时计算而不缓存

@Mine-diamond Mine-diamond marked this pull request as draft January 13, 2026 02:43
@Mine-diamond Mine-diamond changed the title feat: 优化世界信息页面 feat: 优化世界管理与世界信息页面 Jan 13, 2026
@3gf8jv4dv
Copy link
Contributor

3gf8jv4dv commented Jan 15, 2026

和 Issue #4868 类似,右上角的刷新图标也糊……

不过我发现,此时点击启动器右上角的最小化按钮,再从任务栏还原,就不糊了。

注:这两张一对比,最左侧的返回按钮也糊 :(

糊 🤔 不糊 😃
Image Image

CC @Glavo

@Mine-diamond Mine-diamond marked this pull request as ready for review January 16, 2026 04:55
Copy link
Contributor

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

This PR optimizes world management and world information pages, refactoring code structure, fixing bugs, and adding new features to improve maintainability and user experience.

Changes:

  • Refactored WorldManagePage to use the Skin pattern, moving UI construction from the page class to a separate Skin class
  • Fixed critical bug in dimension ID mapping (Nether and End dimension IDs were incorrect)
  • Added new information fields (world spawn point, saturation level) and improved time display format
  • Introduced WorldRefreshable interface and updated refresh mechanism for sub-pages

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
HMCLCore/src/main/java/org/jackhuang/hmcl/util/Lang.java Added toFloatOrNull utility method
HMCLCore/src/main/java/org/jackhuang/hmcl/game/World.java Added version support methods (supportDatapacks, supportQuickPlay), changed getWorlds return type from Stream to List, made isLocked() compute on each call
HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java Refactored hardcoded version checks to use World.supportQuickPlay()
HMCL/src/main/java/org/jackhuang/hmcl/util/ChunkBaseApp.java Added supportEndCity() method to centralize version checking
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/WorldManagePage.java Major refactoring: extracted UI construction to Skin class, added refresh mechanism, renamed id to versionId, introduced WorldRefreshable interface
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/WorldListPage.java Added launch button to world list items, simplified code, improved formatting
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/WorldInfoPage.java Fixed dimension ID mapping bug, added world spawn and saturation fields, improved time format, simplified field binding code
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/WorldBackupsPage.java Changed from using boolean isReadOnly to BooleanProperty for reactive UI updates
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DatapackListPage.java Added toast notification for datapack reload, disabled buttons when world is running
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DatapackListPageSkin.java Bound button disable states to isReadOnlyProperty
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/WorldManageUIUtils.java Updated exception handling to catch WorldLockedException instead of IOException
I18N*.properties files Updated translations for new features (world spawn point, saturation, improved time format)
Comments suppressed due to low confidence (2)

HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DatapackListPage.java:80

    public void refresh() {

HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/WorldBackupsPage.java:82

    public void refresh() {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants