diff options
author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2023-01-14 14:51:55 -0500 |
---|---|---|
committer | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2023-01-14 14:51:55 -0500 |
commit | e52b994b8a7c32badab7017dc0040d6bfb1cbedb (patch) | |
tree | b7f1005a994524ee4f55b4eb0cf70e5038aef07a /src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_TextRendering.java | |
parent | e574e54a53b87ef4bbb33404b6fdb6b97c72dd81 (diff) | |
download | Chatting-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_TextRendering.java')
-rw-r--r-- | src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_TextRendering.java | 29 |
1 files changed, 29 insertions, 0 deletions
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); + } +} |