diff options
author | Wyvest <wyvestbusiness@gmail.com> | 2023-11-23 16:04:46 +0900 |
---|---|---|
committer | Wyvest <wyvestbusiness@gmail.com> | 2023-11-23 16:04:46 +0900 |
commit | 97a700fe1af0360b6deed3c6b0b0a3839d5a690d (patch) | |
tree | fcced3e6f5be183c519e8245796e3b9377c80a61 /src/main | |
parent | 8b373f577d9c6dde26357ef3fc86691f1efef9b4 (diff) | |
download | Chatting-97a700fe1af0360b6deed3c6b0b0a3839d5a690d.tar.gz Chatting-97a700fe1af0360b6deed3c6b0b0a3839d5a690d.tar.bz2 Chatting-97a700fe1af0360b6deed3c6b0b0a3839d5a690d.zip |
fix mixin 0.7.11 compat
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java | 4 | ||||
-rw-r--r-- | src/main/kotlin/org/polyfrost/chatting/utils/ModCompatHooks.kt | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java b/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java index 303326f..167bbd4 100644 --- a/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java +++ b/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java @@ -119,8 +119,8 @@ public abstract class GuiChatMixin extends GuiScreen { } else if ((hook.getRight() + ModCompatHooks.getXOffset() + 13) <= x && (hook.getRight() + ModCompatHooks.getXOffset()) + 23 > x) { ChatLine chatLine = hook.getHoveredLine(Mouse.getY()); if (chatLine == null) return; - ((GuiNewChatAccessor) Minecraft.getMinecraft().ingameGUI.getChatGUI()).getDrawnChatLines().removeIf(line -> ((ChatLineHook) line).getUniqueId() == ((ChatLineHook) chatLine).getUniqueId()); - ((GuiNewChatAccessor) Minecraft.getMinecraft().ingameGUI.getChatGUI()).getChatLines().removeIf(line -> ((ChatLineHook) line).getUniqueId() == ((ChatLineHook) chatLine).getUniqueId()); + ModCompatHooks.getDrawnChatLines().removeIf(line -> ((ChatLineHook) line).getUniqueId() == ((ChatLineHook) chatLine).getUniqueId()); + ModCompatHooks.getChatLines().removeIf(line -> ((ChatLineHook) line).getUniqueId() == ((ChatLineHook) chatLine).getUniqueId()); } } diff --git a/src/main/kotlin/org/polyfrost/chatting/utils/ModCompatHooks.kt b/src/main/kotlin/org/polyfrost/chatting/utils/ModCompatHooks.kt index ad7d329..b6198fa 100644 --- a/src/main/kotlin/org/polyfrost/chatting/utils/ModCompatHooks.kt +++ b/src/main/kotlin/org/polyfrost/chatting/utils/ModCompatHooks.kt @@ -17,6 +17,7 @@ import net.minecraft.client.gui.Gui import net.minecraft.client.renderer.GlStateManager import org.polyfrost.chatting.hook.ChatLineHook import org.polyfrost.chatting.hook.GuiNewChatHook +import org.polyfrost.chatting.mixin.GuiNewChatAccessor // This exists because mixin doesn't like dummy classes object ModCompatHooks { @@ -45,6 +46,14 @@ object ModCompatHooks { get() = Minecraft.getMinecraft().fontRendererObj @JvmStatic + val chatLines: List<ChatLine> + get() = (Minecraft.getMinecraft().ingameGUI.chatGUI as GuiNewChatAccessor).chatLines + + @JvmStatic + val drawnChatLines: List<ChatLine> + get() = (Minecraft.getMinecraft().ingameGUI.chatGUI as GuiNewChatAccessor).drawnChatLines + + @JvmStatic fun redirectDrawString(text: String, x: Float, y: Float, color: Int, chatLine: ChatLine, screenshot: Boolean): Int { var actualX = x if (showChatHeads && !screenshot) { |