Skip to content

[Bug] 修复在多人联机状态下,连接到服务器的玩家,在查询携带nbt的无尽之箱的tooltip会造成崩端问题#344

Merged
cnlimiter merged 1 commit into
Nova-Committee:forge/1.20.1from
mc-zhonghuang:forge/1.20.1
Jun 10, 2026
Merged

[Bug] 修复在多人联机状态下,连接到服务器的玩家,在查询携带nbt的无尽之箱的tooltip会造成崩端问题#344
cnlimiter merged 1 commit into
Nova-Committee:forge/1.20.1from
mc-zhonghuang:forge/1.20.1

Conversation

@mc-zhonghuang

Copy link
Copy Markdown
Contributor

Checks / 检查

  • I confirm that I have searched for existing issues / pull requests before requesting to avoid duplicate requesting.
    我确认在报告之前我已经搜索了现有的问题或者拉取请求,以避免重复报告。
  • I confirm that I noted that if I don't follow the instructions, the issue may be closed directly.
    我确认我已经检查,如果我不按照说明进行操作,该问题可能会被直接关闭。

Related Issues / 相关的 GitHub 问题

Fix #338

Description / 描述

修复了在多人联机状态下,连接到服务器的玩家,在查询携带nbt标签的 无尽之箱(Infinity Chest) 的tooltip时,客户端会崩端的问题。

Cause Of The Problem / 问题原因

在玩家查询 无尽之箱(Infinity Chest) 的tooltip时,当目标物品携带ownerchannelID标签时,客户端就会尝试获取箱子的内容,在多人联机状态下,连接到服务器的玩家的客户端,在使用ServerChestManager.getInstance().getChest(owner, channelID)获取箱子实例的时候,会调用ServerChestManagergetInstance,其中会使用instance = new ServerChestManager(ServerLifecycleHooks.getCurrentServer());创建实例,没有检测ServerLifecycleHooks.getCurrentServer()为空的情况,导致load使用server.getWorldPath(LevelResource.ROOT)时调用的server变量为空值,抛出NPE。

Solution / 解决方案

修复ServerLifecycleHooks.getCurrentServer()ServerChestManager.getInstance()的空值判断。

Other Problem / 其它问题

没有找到ServerLifecycleHooks.getCurrentServer()通过了空值判断,但实际使用时仍为空值的原因。

MinecraftServer server = ServerLifecycleHooks.getCurrentServer();   // 非空
if (server == null) {
    LOGGER.warn("[ServerChestManager] getInstance() called but no server is running (client-side?). Returning null.");
    return null;
}
synchronized (ServerChestManager.class) {
    if (instance == null) {
        instance = new ServerChestManager(ServerLifecycleHooks.getCurrentServer());   // 空
    }
}

@cnlimiter cnlimiter merged commit e6f10dd into Nova-Committee:forge/1.20.1 Jun 10, 2026
1 check passed
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.

Client crash: NullPointerException in ServerChestManager when hovering Infinity Chest in Creative mode

2 participants