diff options
author | Wyvest <wyvestbusiness@gmail.com> | 2023-07-30 23:59:49 +0900 |
---|---|---|
committer | Wyvest <wyvestbusiness@gmail.com> | 2023-07-30 23:59:57 +0900 |
commit | 08aa76c496a6be564bbe68c367134745c187fdfc (patch) | |
tree | 885fd848117c6e6b44c17db931d6b1d0845fbea7 /src/main/java | |
parent | 1dbe363d00e84fe12230f66a24a530d581426910 (diff) | |
download | Chatting-08aa76c496a6be564bbe68c367134745c187fdfc.tar.gz Chatting-08aa76c496a6be564bbe68c367134745c187fdfc.tar.bz2 Chatting-08aa76c496a6be564bbe68c367134745c187fdfc.zip |
allow transparency in chat background
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java index 97b00a7..92c3dfe 100644 --- a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java +++ b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java @@ -101,7 +101,7 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { @ModifyArgs(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiNewChat;drawRect(IIIII)V"), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/util/MathHelper;clamp_double(DDD)D"), to = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;enableBlend()V"))) private void captureDrawRect(Args args) { - args.set(4, changeChatBackgroundColor(ChattingConfig.INSTANCE.getChatBackgroundColor(), args.get(4))); + args.set(4, ChattingConfig.INSTANCE.getChatBackgroundColor().getRGB()); if (mc.currentScreen instanceof GuiChat) { int left = args.get(0); int top = args.get(1); @@ -110,7 +110,7 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { if (isInBounds(left, top, right, bottom, getChatScale())) { chatting$isHovering = true; lineInBounds = true; - args.set(4, changeChatBackgroundColor(ChattingConfig.INSTANCE.getHoveredChatBackgroundColor(), args.get(4))); + args.set(4, ChattingConfig.INSTANCE.getHoveredChatBackgroundColor().getRGB()); } } } @@ -139,13 +139,6 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { return mouseX >= (left + ModCompatHooks.getXOffset()) && mouseY < bottom && mouseX < (right + 23 + ModCompatHooks.getXOffset()) && mouseY >= top; } - private int changeChatBackgroundColor(OneColor color, int alphaColor) { - return (((alphaColor >> 24) & 0xFF) << 24) | - ((color.getRed() & 0xFF) << 16) | - ((color.getGreen() & 0xFF) << 8) | - ((color.getBlue() & 0xFF)); - } - @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)); |