aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatSearching.java
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2023-01-14 14:51:55 -0500
committerWyvest <45589059+Wyvest@users.noreply.github.com>2023-01-14 14:51:55 -0500
commite52b994b8a7c32badab7017dc0040d6bfb1cbedb (patch)
treeb7f1005a994524ee4f55b4eb0cf70e5038aef07a /src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatSearching.java
parente574e54a53b87ef4bbb33404b6fdb6b97c72dd81 (diff)
downloadChatting-e52b994b8a7c32badab7017dc0040d6bfb1cbedb.tar.gz
Chatting-e52b994b8a7c32badab7017dc0040d6bfb1cbedb.tar.bz2
Chatting-e52b994b8a7c32badab7017dc0040d6bfb1cbedb.zip
split GuiNewChatMixin into different mixins
Diffstat (limited to 'src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatSearching.java')
-rw-r--r--src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatSearching.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatSearching.java b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatSearching.java
new file mode 100644
index 0000000..b40ba52
--- /dev/null
+++ b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatSearching.java
@@ -0,0 +1,31 @@
+package cc.woverflow.chatting.mixin;
+
+import cc.woverflow.chatting.chat.ChatSearchingManager;
+import net.minecraft.client.gui.ChatLine;
+import net.minecraft.client.gui.GuiNewChat;
+import net.minecraft.util.IChatComponent;
+import org.objectweb.asm.Opcodes;
+import org.spongepowered.asm.mixin.Final;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.Redirect;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+import java.util.List;
+
+@Mixin(GuiNewChat.class)
+public class GuiNewChatMixin_ChatSearching {
+ @Shadow @Final private List<ChatLine> drawnChatLines;
+
+ @Inject(method = "setChatLine", at = @At("HEAD"))
+ private void handleSetChatLine(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) {
+ ChatSearchingManager.getCache().invalidateAll();
+ }
+
+ @Redirect(method = "drawChat", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/GuiNewChat;drawnChatLines:Ljava/util/List;", opcode = Opcodes.GETFIELD))
+ private List<ChatLine> injected(GuiNewChat instance) {
+ return ChatSearchingManager.filterMessages(ChatSearchingManager.INSTANCE.getLastSearch(), drawnChatLines);
+ }
+}