Skip to content

Commit

Permalink
Use our own executor service
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahvdAa committed Jan 7, 2022
1 parent b9472bf commit c2a93f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.ClientChatListener;
import net.minecraft.client.util.NetworkUtils;
import net.minecraft.network.MessageType;
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Final;
Expand All @@ -12,14 +11,17 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

@Mixin(net.minecraft.client.gui.hud.InGameHud.class)
public abstract class GuiMixin {

private final ExecutorService service = Executors.newFixedThreadPool(1);

@Final
@Shadow
private MinecraftClient client;
Expand All @@ -37,7 +39,7 @@ public abstract class GuiMixin {
cancellable = true
)
public void handleChat(MessageType chatType, Text chatComponent, UUID senderUUID, CallbackInfo ci) {
NetworkUtils.EXECUTOR.submit(() -> {
service.submit(() -> {
if (this.client.shouldBlockMessages(senderUUID) || (this.client.options.hideMatchedNames && this.client.shouldBlockMessages(this.extractSender(chatComponent)))) {
return;
}
Expand Down
7 changes: 4 additions & 3 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
"NoahvdAa"
],
"contact": {
"website": "https://github.com/NoahvdAa/NoChatLag",
"repo": "https://github.com/NoahvdAa/NoChatLag"
"homepage": "https://github.com/NoahvdAa/NoChatLag",
"issues": "https://github.com/NoahvdAa/NoChatLag/issues",
"sources": "https://github.com/NoahvdAa/NoChatLag"
},
"license": "MIT",
"icon": "assets/nochatlag/icon.png",
Expand All @@ -22,6 +23,6 @@
"depends": {
"fabricloader": ">=0.12.12",
"fabric": "*",
"minecraft": "1.18.1"
"minecraft": ">=1.18"
}
}

0 comments on commit c2a93f6

Please sign in to comment.