From e52b994b8a7c32badab7017dc0040d6bfb1cbedb Mon Sep 17 00:00:00 2001 From: Wyvest <45589059+Wyvest@users.noreply.github.com> Date: Sat, 14 Jan 2023 14:51:55 -0500 Subject: split GuiNewChatMixin into different mixins --- .../cc/woverflow/chatting/hook/GuiNewChatHook.java | 4 - .../cc/woverflow/chatting/mixin/GuiChatMixin.java | 2 +- .../woverflow/chatting/mixin/GuiNewChatMixin.java | 101 +-------------------- .../chatting/mixin/GuiNewChatMixin_ChatHeight.java | 21 +++++ .../mixin/GuiNewChatMixin_ChatSearching.java | 31 +++++++ .../chatting/mixin/GuiNewChatMixin_ChatTabs.java | 62 +++++++++++++ .../mixin/GuiNewChatMixin_RemoveScrollBar.java | 25 +++++ .../mixin/GuiNewChatMixin_TextRendering.java | 29 ++++++ .../chatting/chat/ChatSearchingManager.kt | 9 +- src/main/resources/mixins.chatting.json | 13 ++- 10 files changed, 181 insertions(+), 116 deletions(-) create mode 100644 src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatHeight.java create mode 100644 src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatSearching.java create mode 100644 src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatTabs.java create mode 100644 src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_RemoveScrollBar.java create mode 100644 src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_TextRendering.java (limited to 'src') diff --git a/src/main/java/cc/woverflow/chatting/hook/GuiNewChatHook.java b/src/main/java/cc/woverflow/chatting/hook/GuiNewChatHook.java index d2ca6c1..19da778 100644 --- a/src/main/java/cc/woverflow/chatting/hook/GuiNewChatHook.java +++ b/src/main/java/cc/woverflow/chatting/hook/GuiNewChatHook.java @@ -17,9 +17,5 @@ public interface GuiNewChatHook { throw new AssertionError("getFullMessage not overridden on GuiNewChat"); } - String getPrevText(); - - void setPrevText(String prevText); - int getTextOpacity(); } diff --git a/src/main/java/cc/woverflow/chatting/mixin/GuiChatMixin.java b/src/main/java/cc/woverflow/chatting/mixin/GuiChatMixin.java index a633a3d..5eced71 100644 --- a/src/main/java/cc/woverflow/chatting/mixin/GuiChatMixin.java +++ b/src/main/java/cc/woverflow/chatting/mixin/GuiChatMixin.java @@ -78,7 +78,7 @@ public abstract class GuiChatMixin extends GuiScreen { return; } searchButton.getInputField().textboxKeyTyped(typedChar, keyCode); - ChatSearchingManager.setPrevText(searchButton.getInputField().getText()); + ChatSearchingManager.INSTANCE.setLastSearch(searchButton.getInputField().getText()); } } diff --git a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java index 17106bc..6d4a60d 100644 --- a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java +++ b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java @@ -4,8 +4,6 @@ import cc.polyfrost.oneconfig.config.core.OneColor; import cc.polyfrost.oneconfig.libs.universal.UMouse; import cc.polyfrost.oneconfig.utils.Notifications; import cc.woverflow.chatting.Chatting; -import cc.woverflow.chatting.chat.ChatSearchingManager; -import cc.woverflow.chatting.chat.ChatTabs; import cc.woverflow.chatting.config.ChattingConfig; import cc.woverflow.chatting.gui.components.CleanButton; import cc.woverflow.chatting.hook.GuiNewChatHook; @@ -15,25 +13,20 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.*; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IChatComponent; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; -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.Unique; import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import org.spongepowered.asm.mixin.injection.invoke.arg.Args; import java.awt.datatransfer.StringSelection; import java.awt.datatransfer.Transferable; import java.awt.image.BufferedImage; import java.util.List; -import java.util.Locale; @Mixin(value = GuiNewChat.class, priority = Integer.MIN_VALUE) public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { @@ -51,10 +44,6 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { @Shadow @Final private List drawnChatLines; - @SuppressWarnings({"FieldCanBeLocal", "unused"}) - private float percentComplete; - private String chatting$previousText = ""; - @Shadow public abstract boolean getChatOpen(); @@ -66,12 +55,6 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { @Shadow private int scrollPos; - @Shadow - @Final - private List chatLines; - - @Shadow - public abstract void deleteChatLine(int id); @Shadow public abstract int getChatWidth(); @@ -80,20 +63,6 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { @Unique private static final ResourceLocation DELETE = new ResourceLocation("chatting:delete.png"); - @Inject(method = "printChatMessageWithOptionalDeletion", at = @At("HEAD"), cancellable = true) - private void handlePrintChatMessage(IChatComponent chatComponent, int chatLineId, CallbackInfo ci) { - handleChatTabMessage(chatComponent, chatLineId, mc.ingameGUI.getUpdateCounter(), false, ci); - if (!EnumChatFormatting.getTextWithoutFormattingCodes(chatComponent.getUnformattedText()).toLowerCase(Locale.ENGLISH).contains(chatting$previousText.toLowerCase(Locale.ENGLISH))) { - percentComplete = 1.0F; - } - } - - @Inject(method = "setChatLine", at = @At("HEAD"), cancellable = true) - private void handleSetChatLine(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { - ChatSearchingManager.getCache().invalidateAll(); - handleChatTabMessage(chatComponent, chatLineId, updateCounter, displayOnly, ci); - } - /*? @Unique private final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); @@ -107,14 +76,6 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { */ - @Unique - private ChatLine chatting$drawingLine = null; - - @Inject(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/ChatLine;getChatComponent()Lnet/minecraft/util/IChatComponent;"), locals = LocalCapture.CAPTURE_FAILSOFT) - private void captureChatLine(int updateCounter, CallbackInfo ci, int i, boolean bl, int j, int k, float f, float g, int l, int m, ChatLine chatLine, int n, double d, int o, int p, int q) { - chatting$drawingLine = chatLine; - } - @Inject(method = "drawChat", at = @At("HEAD")) private void checkScreenshotKeybind(int j2, CallbackInfo ci) { if (Chatting.INSTANCE.getKeybind().isPressed()) { @@ -184,11 +145,6 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { ((color.getBlue() & 0xFF)); } - @Redirect(method = "drawChat", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/GuiNewChat;drawnChatLines:Ljava/util/List;", opcode = Opcodes.GETFIELD)) - private List injected(GuiNewChat instance) { - return ChatSearchingManager.filterMessages(chatting$previousText, drawnChatLines); - } - @ModifyVariable(method = "drawChat", at = @At("STORE"), ordinal = 7) private int modifyYeah(int value) { return chatting$textOpacity = (int) (((float) (getChatOpen() ? 255 : value)) * (mc.gameSettings.chatOpacity * 0.9F + 0.1F)); @@ -206,25 +162,6 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { */ - @Redirect(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;drawStringWithShadow(Ljava/lang/String;FFI)I")) - private int redirectDrawString(FontRenderer instance, String text, float x, float y, int color) { - return ModCompatHooks.redirectDrawString(text, x, y, color, chatting$drawingLine, false); - } - - @Redirect(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiNewChat;drawRect(IIIII)V", ordinal = 1)) - private void redirectScrollBar(int left, int top, int right, int bottom, int color) { - if (!ChattingConfig.INSTANCE.getRemoveScrollBar()) { - drawRect(left, top, right, bottom, color); - } - } - - @Redirect(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiNewChat;drawRect(IIIII)V", ordinal = 2)) - private void redirectScrollBar2(int left, int top, int right, int bottom, int color) { - if (!ChattingConfig.INSTANCE.getRemoveScrollBar()) { - drawRect(left, top, right, bottom, color); - } - } - @Inject(method = "drawChat", at = @At("RETURN")) private void checkStuff(int j2, CallbackInfo ci) { if (!chatting$chatCheck && chatting$isHovering) { @@ -232,12 +169,6 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { } } - @Inject(method = "getChatHeight", at = @At("HEAD"), cancellable = true) - private void customHeight_getChatHeight(CallbackInfoReturnable cir) { - if (ChattingConfig.INSTANCE.getCustomChatHeight()) - cir.setReturnValue(Chatting.INSTANCE.getChatHeight(this.getChatOpen())); - } - @Override public int getRight() { return chatting$right; @@ -248,24 +179,6 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { return chatting$isHovering; } - private void handleChatTabMessage(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { - if (ChattingConfig.INSTANCE.getChatTabs()) { - if (!ChatTabs.INSTANCE.shouldRender(chatComponent)) { - percentComplete = 1.0F; - if (chatLineId != 0) { - deleteChatLine(chatLineId); - } - if (!displayOnly) { - chatLines.add(0, new ChatLine(updateCounter, chatComponent, chatLineId)); - while (this.chatLines.size() > (100 + ModCompatHooks.getExtendedChatLength())) { - this.chatLines.remove(this.chatLines.size() - 1); - } - } - ci.cancel(); - } - } - } - private void drawCopyChatBox(int right, int top) { chatting$chatCheck = true; GlStateManager.enableRescaleNormal(); @@ -281,7 +194,7 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { GlStateManager.blendFunc(770, 771); GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); chatting$right = right; - Gui.drawModalRectWithCustomSizedTexture(right + 1, top, 0f, 0f, 9, 9, 9, 9); + drawModalRectWithCustomSizedTexture(right + 1, top, 0f, 0f, 9, 9, 9, 9); drawRect(right + 1, top, right + 10, top + 9, (((right + ModCompatHooks.getXOffset() + 3) <= (UMouse.getScaledX() / mc.ingameGUI.getChatGUI().getChatScale()) && (right + ModCompatHooks.getXOffset()) + 13 > (UMouse.getScaledX() / mc.ingameGUI.getChatGUI().getChatScale())) ? CleanButton.Companion.getHoveredColor() : CleanButton.Companion.getColor())); GlStateManager.disableAlpha(); GlStateManager.disableRescaleNormal(); @@ -292,7 +205,7 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { GlStateManager.enableBlend(); GlStateManager.blendFunc(770, 771); GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); - Gui.drawModalRectWithCustomSizedTexture(right + 11, top, 0f, 0f, 9, 9, 9, 9); + drawModalRectWithCustomSizedTexture(right + 11, top, 0f, 0f, 9, 9, 9, 9); drawRect(right + 11, top, right + 20, top + 9, (((right + ModCompatHooks.getXOffset() + 13) <= (UMouse.getScaledX() / mc.ingameGUI.getChatGUI().getChatScale()) && (right + ModCompatHooks.getXOffset()) + 23 > (UMouse.getScaledX() / mc.ingameGUI.getChatGUI().getChatScale())) ? CleanButton.Companion.getHoveredColor() : CleanButton.Companion.getColor())); GlStateManager.disableLighting(); GlStateManager.popMatrix(); @@ -344,16 +257,6 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { return null; } - @Override - public String getPrevText() { - return chatting$previousText; - } - - @Override - public void setPrevText(String prevText) { - chatting$previousText = prevText; - } - @Override public int getTextOpacity() { return chatting$textOpacity; diff --git a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatHeight.java b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatHeight.java new file mode 100644 index 0000000..d0b4db1 --- /dev/null +++ b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatHeight.java @@ -0,0 +1,21 @@ +package cc.woverflow.chatting.mixin; + +import cc.woverflow.chatting.Chatting; +import cc.woverflow.chatting.config.ChattingConfig; +import net.minecraft.client.gui.GuiNewChat; +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.callback.CallbackInfoReturnable; + +@Mixin(GuiNewChat.class) +public abstract class GuiNewChatMixin_ChatHeight { + @Shadow public abstract boolean getChatOpen(); + + @Inject(method = "getChatHeight", at = @At("HEAD"), cancellable = true) + private void customHeight_getChatHeight(CallbackInfoReturnable cir) { + if (ChattingConfig.INSTANCE.getCustomChatHeight()) + cir.setReturnValue(Chatting.INSTANCE.getChatHeight(getChatOpen())); + } +} 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 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 injected(GuiNewChat instance) { + return ChatSearchingManager.filterMessages(ChatSearchingManager.INSTANCE.getLastSearch(), drawnChatLines); + } +} diff --git a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatTabs.java b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatTabs.java new file mode 100644 index 0000000..1d29941 --- /dev/null +++ b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatTabs.java @@ -0,0 +1,62 @@ +package cc.woverflow.chatting.mixin; + +import cc.woverflow.chatting.chat.ChatSearchingManager; +import cc.woverflow.chatting.chat.ChatTabs; +import cc.woverflow.chatting.config.ChattingConfig; +import cc.woverflow.chatting.utils.ModCompatHooks; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ChatLine; +import net.minecraft.client.gui.GuiNewChat; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +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.callback.CallbackInfo; + +import java.util.List; +import java.util.Locale; + +@Mixin(GuiNewChat.class) +public abstract class GuiNewChatMixin_ChatTabs { + @Shadow @Final private Minecraft mc; + + @Shadow public abstract void deleteChatLine(int id); + + @Shadow @Final private List chatLines; + @SuppressWarnings({"FieldCanBeLocal", "unused"}) + private float percentComplete; //betterchat support + + @Inject(method = "printChatMessageWithOptionalDeletion", at = @At("HEAD"), cancellable = true) + private void handlePrintChatMessage(IChatComponent chatComponent, int chatLineId, CallbackInfo ci) { + handleChatTabMessage(chatComponent, chatLineId, mc.ingameGUI.getUpdateCounter(), false, ci); + if (!EnumChatFormatting.getTextWithoutFormattingCodes(chatComponent.getUnformattedText()).toLowerCase(Locale.ENGLISH).contains(ChatSearchingManager.INSTANCE.getLastSearch().toLowerCase(Locale.ENGLISH))) { + percentComplete = 1.0F; + } + } + + @Inject(method = "setChatLine", at = @At("HEAD"), cancellable = true) + private void handleSetChatLine(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { + handleChatTabMessage(chatComponent, chatLineId, updateCounter, displayOnly, ci); + } + + private void handleChatTabMessage(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { + if (ChattingConfig.INSTANCE.getChatTabs()) { + if (!ChatTabs.INSTANCE.shouldRender(chatComponent)) { + percentComplete = 1.0F; + if (chatLineId != 0) { + deleteChatLine(chatLineId); + } + if (!displayOnly) { + chatLines.add(0, new ChatLine(updateCounter, chatComponent, chatLineId)); + while (this.chatLines.size() > (100 + ModCompatHooks.getExtendedChatLength())) { + this.chatLines.remove(this.chatLines.size() - 1); + } + } + ci.cancel(); + } + } + } +} diff --git a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_RemoveScrollBar.java b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_RemoveScrollBar.java new file mode 100644 index 0000000..347ea57 --- /dev/null +++ b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_RemoveScrollBar.java @@ -0,0 +1,25 @@ +package cc.woverflow.chatting.mixin; + +import cc.woverflow.chatting.config.ChattingConfig; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiNewChat; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(GuiNewChat.class) +public class GuiNewChatMixin_RemoveScrollBar extends Gui { + @Redirect(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiNewChat;drawRect(IIIII)V", ordinal = 1)) + private void redirectScrollBar(int left, int top, int right, int bottom, int color) { + if (!ChattingConfig.INSTANCE.getRemoveScrollBar()) { + drawRect(left, top, right, bottom, color); + } + } + + @Redirect(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiNewChat;drawRect(IIIII)V", ordinal = 2)) + private void redirectScrollBar2(int left, int top, int right, int bottom, int color) { + if (!ChattingConfig.INSTANCE.getRemoveScrollBar()) { + drawRect(left, top, right, bottom, color); + } + } +} diff --git a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_TextRendering.java b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_TextRendering.java new file mode 100644 index 0000000..84c184e --- /dev/null +++ b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_TextRendering.java @@ -0,0 +1,29 @@ +package cc.woverflow.chatting.mixin; + +import cc.woverflow.chatting.utils.ModCompatHooks; +import net.minecraft.client.gui.ChatLine; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiNewChat; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +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 org.spongepowered.asm.mixin.injection.callback.LocalCapture; + +@Mixin(value = GuiNewChat.class, priority = Integer.MIN_VALUE) +public class GuiNewChatMixin_TextRendering { + @Unique + private ChatLine chatting$drawingLine = null; + + @Inject(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/ChatLine;getChatComponent()Lnet/minecraft/util/IChatComponent;"), locals = LocalCapture.CAPTURE_FAILSOFT) + private void captureChatLine(int updateCounter, CallbackInfo ci, int i, boolean bl, int j, int k, float f, float g, int l, int m, ChatLine chatLine, int n, double d, int o, int p, int q) { + chatting$drawingLine = chatLine; + } + + @Redirect(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;drawStringWithShadow(Ljava/lang/String;FFI)I")) + private int redirectDrawString(FontRenderer instance, String text, float x, float y, int color) { + return ModCompatHooks.redirectDrawString(text, x, y, color, chatting$drawingLine, false); + } +} diff --git a/src/main/kotlin/cc/woverflow/chatting/chat/ChatSearchingManager.kt b/src/main/kotlin/cc/woverflow/chatting/chat/ChatSearchingManager.kt index 25d479a..33a2642 100644 --- a/src/main/kotlin/cc/woverflow/chatting/chat/ChatSearchingManager.kt +++ b/src/main/kotlin/cc/woverflow/chatting/chat/ChatSearchingManager.kt @@ -3,8 +3,6 @@ package cc.woverflow.chatting.chat import cc.polyfrost.oneconfig.libs.caffeine.cache.Cache import cc.polyfrost.oneconfig.libs.caffeine.cache.Caffeine import cc.polyfrost.oneconfig.libs.universal.wrappers.message.UTextComponent -import cc.woverflow.chatting.hook.GuiNewChatHook -import net.minecraft.client.Minecraft import net.minecraft.client.gui.ChatLine import java.util.concurrent.LinkedBlockingQueue import java.util.concurrent.ThreadPoolExecutor @@ -27,6 +25,8 @@ object ChatSearchingManager { @JvmStatic val cache: Cache> = Caffeine.newBuilder().executor(POOL).maximumSize(5000).build() + var lastSearch = "" + @JvmStatic fun filterMessages(text: String, list: List): List? { if (text.isBlank()) return list @@ -39,9 +39,4 @@ object ChatSearchingManager { cache.getIfPresent(text) } } - - @JvmStatic - fun setPrevText(text: String) { - (Minecraft.getMinecraft().ingameGUI.chatGUI as GuiNewChatHook).prevText = text - } } \ No newline at end of file diff --git a/src/main/resources/mixins.chatting.json b/src/main/resources/mixins.chatting.json index 78b43c5..4c59e73 100644 --- a/src/main/resources/mixins.chatting.json +++ b/src/main/resources/mixins.chatting.json @@ -3,17 +3,20 @@ "minVersion": "0.7", "package": "cc.woverflow.chatting.mixin", "refmap": "mixins.${id}.refmap.json", - "mixins": [ + "verbose": true, + "client": [ + "ChatLineMixin", "ClientCommandHandlerMixin", "EntityPlayerSPMixin", "GuiChatMixin", "GuiNewChatAccessor", "GuiNewChatMapMixin", "GuiNewChatMixin", + "GuiNewChatMixin_ChatHeight", + "GuiNewChatMixin_ChatSearching", + "GuiNewChatMixin_ChatTabs", + "GuiNewChatMixin_RemoveScrollBar", + "GuiNewChatMixin_TextRendering", "GuiUtilsMixin" - ], - "verbose": true, - "client": [ - "ChatLineMixin" ] } \ No newline at end of file -- cgit