介绍
Fixes Minecraft client lag from receiving chat messages
YOU DO NOT NEED THIS MOD ANYMORE ON 1.18
Mojang has fixed the bug in their API that was causing it to return an error instead of an empty list. Minecraft will fetch the block-list once when joining the world. This mod may still improve world loading times by the time it takes to make that HTTP request; especially if you have a slow internet connection.
This comment by a Mojang employee confirms that the bug was fixed: https://bugs.mojang.com/browse/WEB-5587?focusedCommentId=1134973&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-1134973
This bug still affects 1.17 and 1.16 but only on the first chat message received: https://bugs.mojang.com/browse/MC-218167
Technical Details: When receiving a chat message, Minecraft sends a HTTP request in the render thread to check your player block list. The current frame does not finish rendering until this request has finished, causing a lag spike. This mod lets chat messages through until a block-list can be fetched.
Why is this happening now and not before?: something happened to Mojang’s API. When joining a world, the blocklist would usually load fine, but Mojang’s API has started returning errors for users who have migrated to Microsoft accounts, causing the block list to be fetched in 2 minute intervals when receiving a message.
A commented walkthrough of why the bug occurs
// A simplified view of the code.
private static final long BLOCKLIST_REQUEST_COOLDOWN = 120;
private Instant nextRequest;
private final blockList Set;// This method is called when receiving a chat message
public boolean isBlockedPlayer(UUID playerID) {
// If we don't have the blocklist yet, fetch it
// Note that when there's an error, fetchBlockList returns null
//
if (this.blockList == null) {
this.blockList = fetchBlockList();
// If we still don't have it, assume the player is not blocked
if (this.blockList == null) {
return false;
}
}
return this.blockList.contains(playerID);
}public Set fetchBlockList() {
// Only check at least every 2 minutes.
// This is why the lagspike only occurs every 2 minutes or later
if (this.nextRequest == null || Instant.now().isAfter(this.nextRequest)) {
return null;
}
// Reset the 2 minute timer
this.nextRequest = Instant.now().plusSeconds(BLOCKLIST_REQUEST_COOLDOWN);
try {
// Make the HTTP request
BlockListResponse response = minecraftClient.get(routeBlocklist, BlockListResponse.class);
return response.getBlockedProfiles();
} catch (/* exception */) {
// If there's an error return null
return null;
}
}
If you’d like to see the unmodified for yourself, check out com.mojang.authlib.yggdrasil.YggdrasilUserApiService, remember that these methods get called on the render thread, thus blocking the frame from finishing.
GIF demonstration of the bug

常见问题
Chat Lag Fix 支持哪些 Minecraft 版本?
Chat Lag Fix 支持 Minecraft Java 版 1.16.4–1.18.1,共 6 个版本,可用的加载器:Fabric。下载时注意选择和你游戏版本一致的文件。
Chat Lag Fix 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:仅客户端。
adryd 的其他作品
查看全部 →
Sneaky Server
Anonymise your server from scanners like Copenheimer and ServerSeeker. With options to disable logging spam logins and rate limit new connections.
Squake: Ari’s fork
A fork of squake for modern versions of Minecraft with modern movement code. Introduces Quake style movement to Minecraft
Parachute
A kitchen sink mod with various QoL features and tweaks.
Ari’s Accessibility Tweaks
Tweaks to flickers, flashes, and scaling
评论
登录后评论和评分