diff options
author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-01-16 16:27:15 +0700 |
---|---|---|
committer | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-01-16 16:27:15 +0700 |
commit | 4e587bc97c3aee3c3458a6ac60a43122f7c7971e (patch) | |
tree | ab9df90c3b5763d60ea702fd13f15461bbb56421 /src/main/java | |
parent | 42f8aa3024772e708143d49355130ef2a7999243 (diff) | |
download | Chatting-4e587bc97c3aee3c3458a6ac60a43122f7c7971e.tar.gz Chatting-4e587bc97c3aee3c3458a6ac60a43122f7c7971e.tar.bz2 Chatting-4e587bc97c3aee3c3458a6ac60a43122f7c7971e.zip |
new: remove scroll bar
new: chat background color
fix: fix chat tab buttons not having bordered text
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java | 26 | ||||
-rw-r--r-- | src/main/java/cc/woverflow/chatting/mixin/WyvtilsListenerMixin.java | 4 |
2 files changed, 26 insertions, 4 deletions
diff --git a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java index 677ba4c..d6bc8f5 100644 --- a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java +++ b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java @@ -7,7 +7,7 @@ import cc.woverflow.chatting.config.ChattingConfig; import cc.woverflow.chatting.gui.components.CleanButton; import cc.woverflow.chatting.hook.GuiNewChatHook; import cc.woverflow.chatting.utils.ModCompatHooks; -import cc.woverflow.chatting.utils.RenderHelper; +import cc.woverflow.chatting.utils.RenderUtils; import gg.essential.universal.UMouse; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.*; @@ -125,6 +125,28 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { return ModCompatHooks.redirectDrawString(text, x, y, color); } + @ModifyArg(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiNewChat;drawRect(IIIII)V", ordinal = 0), index = 4) + private int changeChatBackgroundColor(int color) { + return (((color >> 24) & 0xFF) << 24) | + ((ChattingConfig.INSTANCE.getChatBackgroundColor().getRed() & 0xFF) << 16) | + ((ChattingConfig.INSTANCE.getChatBackgroundColor().getGreen() & 0xFF) << 8) | + ((ChattingConfig.INSTANCE.getChatBackgroundColor().getBlue() & 0xFF)); + } + + @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$shouldCopy) { @@ -210,7 +232,7 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { if (GuiScreen.isShiftKeyDown()) { if (fullLine != null) { BufferedImage image = Chatting.INSTANCE.screenshotLine(fullLine); - if (image != null) RenderHelper.INSTANCE.copyBufferedImageToClipboard(image); + if (image != null) RenderUtils.copyToClipboard(image); } return null; } diff --git a/src/main/java/cc/woverflow/chatting/mixin/WyvtilsListenerMixin.java b/src/main/java/cc/woverflow/chatting/mixin/WyvtilsListenerMixin.java index 7b22479..f5b7cfb 100644 --- a/src/main/java/cc/woverflow/chatting/mixin/WyvtilsListenerMixin.java +++ b/src/main/java/cc/woverflow/chatting/mixin/WyvtilsListenerMixin.java @@ -1,6 +1,6 @@ package cc.woverflow.chatting.mixin; -import cc.woverflow.chatting.utils.RenderHelper; +import cc.woverflow.chatting.utils.RenderUtils; import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; @@ -16,6 +16,6 @@ public class WyvtilsListenerMixin { @Dynamic("Wyvtils") @Inject(method = "onStringRendered", at = @At("HEAD"), cancellable = true, remap = false) private void cancelStringRender(@Coerce Object a, CallbackInfo ci) { - if (RenderHelper.INSTANCE.getBypassWyvtils()) ci.cancel(); + if (RenderUtils.getBypassWyvtils()) ci.cancel(); } } |