From 08aa76c496a6be564bbe68c367134745c187fdfc Mon Sep 17 00:00:00 2001 From: Wyvest Date: Sun, 30 Jul 2023 23:59:49 +0900 Subject: allow transparency in chat background --- build.gradle | 1 - .../java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java | 11 ++--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index 30dc6ac..5a18999 100644 --- a/build.gradle +++ b/build.gradle @@ -34,7 +34,6 @@ loom { runConfigs { client { vmArgs.remove("-XstartOnFirstThread") - ideConfigGenerated = true } } forge { 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)); -- cgit