Mod

Chat Lag Fix

Quick rating

Chat Lag Fix

No reviews yet

Fixes Minecraft client lag from receiving chat messages (for 1.17 and 1.16)

Mod Loaders
Fabric
Minecraft

Community voices

Reviews

Versions
Loading versions…
Match includes

Click once to include, again to exclude, again to clear

Rating Any
Any 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
Min
Max
Play Status
Reviews
Time Played
hrs+
Verified developers only
Has developer response
List view
Grid view
Compact view
Sort by
Date
Rating
Helpful
Unhelpful
Edited
Sort ascending
Delete this review?

This removes your review from the project. You can write a new review after.

Review submitted for moderation

Your review has been sent to moderators, who will check that it meets our guidelines before it appears publicly.

No reviews yet. Be the first to review this project!

Get it on

Available Platforms

Compatibility

Supported Environments

Dev Environment
Client Required
Server Unsupported

About

Project Details

Type
Mod
License
MIT License
Latest Version
mc1.17-2.1.0
Authors

For authors

Embed Badge

If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.

Custom banner text
ModDex rating badge preview

Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.

Identifiers

Platform IDs

Modrinth ID

Resources

External Links

Source Issues Wiki Discord

About

Description

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<UUID> 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.gif

Screenshots

Gallery

This project has no gallery images yet.

Versions

Files

Relations

Project Relations

More like this

Similar Mods

Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.

On ModDex

Community snapshot

0
Ratings
0
Followers
0
In stacks

By the numbers

Statistics

~9,000
Downloads
Last Updated
CurseForge
Created
Last synced
When ModDex last fetched and imported data for this project from CurseForge or Modrinth. High-traffic and active projects are checked more often.
Next pipeline sync