Path: blob/1.21.x/patches/minecraft/net/minecraft/client/multiplayer/chat/ChatListener.java.patch
7412 views
--- a/net/minecraft/client/multiplayer/chat/ChatListener.java1+++ b/net/minecraft/client/multiplayer/chat/ChatListener.java2@@ -133,7 +_,9 @@3Instant instant = Instant.now();4this.handleMessage(null, () -> {5Component component = p_251256_.decorate(p_250375_);6- this.minecraft.gui.getChat().addMessage(component);7+ Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientChat(p_251256_, component, Util.NIL_UUID);8+ if (forgeComponent == null) return false;9+ this.minecraft.gui.getChat().addMessage(forgeComponent);10this.narrateChatMessage(p_251256_, p_250375_);11this.logSystemMessage(component, instant);12this.previousMessageTime = Util.getMillis();13@@ -152,12 +_,16 @@14MessageSignature messagesignature = p_249430_.signature();15FilterMask filtermask = p_249430_.filterMask();16if (filtermask.isEmpty()) {17- this.minecraft.gui.getChat().addMessage(p_249231_, messagesignature, guimessagetag);18+ Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientPlayerChat(p_251766_, p_249231_, p_249430_, p_249430_.sender());19+ if (forgeComponent == null) return false;20+ this.minecraft.gui.getChat().addMessage(forgeComponent, messagesignature, guimessagetag);21this.narrateChatMessage(p_251766_, p_249430_.decoratedContent());22} else {23Component component = filtermask.applyWithFormatting(p_249430_.signedContent());24if (component != null) {25- this.minecraft.gui.getChat().addMessage(p_251766_.decorate(component), messagesignature, guimessagetag);26+ Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientPlayerChat(p_251766_, p_251766_.decorate(component), p_249430_, p_249430_.sender());27+ if (forgeComponent == null) return false;28+ this.minecraft.gui.getChat().addMessage(forgeComponent, messagesignature, guimessagetag);29this.narrateChatMessage(p_251766_, component);30}31}32@@ -190,6 +_,8 @@3334public void handleSystemMessage(Component p_240522_, boolean p_240642_) {35if (!this.minecraft.options.hideMatchedNames().get() || !this.minecraft.isBlocked(this.guessChatUUID(p_240522_))) {36+ p_240522_ = net.minecraftforge.client.ForgeHooksClient.onClientSystemMessage(p_240522_, p_240642_);37+ if (p_240522_ == null) return;38if (p_240642_) {39this.minecraft.gui.setOverlayMessage(p_240522_, false);40this.minecraft.getNarrator().saySystemQueued(p_240522_);414243