aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/woverflow
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-03-26 12:47:57 +0700
committerWyvest <45589059+Wyvest@users.noreply.github.com>2022-03-26 12:47:57 +0700
commitc68035e02240469f94905ae8edccf9222e027485 (patch)
treee7340611943dbed345de3388ddc9c5745a5f8c2d /src/main/java/cc/woverflow
parent56ffd09c8018d8a1f740cd020d970393cc2abfda (diff)
downloadChatting-c68035e02240469f94905ae8edccf9222e027485.tar.gz
Chatting-c68035e02240469f94905ae8edccf9222e027485.tar.bz2
Chatting-c68035e02240469f94905ae8edccf9222e027485.zip
fix alpha of chat background
Diffstat (limited to 'src/main/java/cc/woverflow')
-rw-r--r--src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java
index d6a0b15..e9acce1 100644
--- a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java
+++ b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java
@@ -26,6 +26,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
+import java.awt.*;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.awt.image.BufferedImage;
@@ -106,11 +107,18 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook {
if (mouseX >= (left + ModCompatHooks.getXOffset()) && mouseY < bottom && mouseX < (right + 11 + ModCompatHooks.getXOffset()) && mouseY >= top) {
chatting$shouldCopy = true;
drawCopyChatBox(right, top);
- args.set(4, ChattingConfig.INSTANCE.getHoveredChatBackgroundColor().getRGB());
+ args.set(4, changeChatBackgroundColor(ChattingConfig.INSTANCE.getHoveredChatBackgroundColor(), args.get(4)));
return;
}
}
- args.set(4, ChattingConfig.INSTANCE.getChatBackgroundColor().getRGB());
+ args.set(4, changeChatBackgroundColor(ChattingConfig.INSTANCE.getChatBackgroundColor(), args.get(4)));
+ }
+
+ private int changeChatBackgroundColor(Color color, int alphaColor) {
+ return (((alphaColor >> 24) & 0xFF) << 24) |
+ ((color.getRed() & 0xFF) << 16) |
+ ((color.getGreen() & 0xFF) << 8) |
+ ((color.getBlue() & 0xFF));
}
@Redirect(method = "drawChat", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/GuiNewChat;drawnChatLines:Ljava/util/List;", opcode = Opcodes.GETFIELD))