diff --git a/src/main/java/org/polyfrost/chatting/hook/GuiNewChatHook.java b/src/main/java/org/polyfrost/chatting/hook/GuiNewChatHook.java index e210ba9..475c773 100644 --- a/src/main/java/org/polyfrost/chatting/hook/GuiNewChatHook.java +++ b/src/main/java/org/polyfrost/chatting/hook/GuiNewChatHook.java @@ -11,7 +11,7 @@ public interface GuiNewChatHook { ChatLine chatting$getHoveredLine(int mouseY); - Transferable chatting$getChattingChatComponent(int mouseY); + Transferable chatting$getChattingChatComponent(int mouseY, int mouseButton); int chatting$getTextOpacity(); } diff --git a/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java b/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java index 17bcf27..80e09d5 100644 --- a/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java +++ b/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java @@ -141,7 +141,7 @@ private void mouseClicked(int mouseX, int mouseY, int mouseButton, CallbackInfo boolean copy = ChattingConfig.INSTANCE.getChatCopy(); int right = (int) ((hook.chatting$getRight() + ModCompatHooks.getXOffset() + 1 + hud.getPaddingX() * (ChattingConfig.INSTANCE.getExtendBG() ? 1f : 2f)) * hud.getScale() + (int) hud.position.getX()) * scale; if (copy && x > right && x < right + 9 * hud.getScale() * scale || (mouseButton == 1 && ChattingConfig.INSTANCE.getRightClickCopy() && (!ChattingConfig.INSTANCE.getRightClickCopyCtrl() || UKeyboard.isCtrlKeyDown()))) { - Transferable message = hook.chatting$getChattingChatComponent(Mouse.getY()); + Transferable message = hook.chatting$getChattingChatComponent(Mouse.getY(), mouseButton); if (message == null) return; try { Toolkit.getDefaultToolkit().getSystemClipboard().setContents(message, null); diff --git a/src/main/java/org/polyfrost/chatting/mixin/GuiNewChatMixin.java b/src/main/java/org/polyfrost/chatting/mixin/GuiNewChatMixin.java index 5074d45..bd1519e 100644 --- a/src/main/java/org/polyfrost/chatting/mixin/GuiNewChatMixin.java +++ b/src/main/java/org/polyfrost/chatting/mixin/GuiNewChatMixin.java @@ -393,18 +393,18 @@ private void chatScale(CallbackInfoReturnable cir) { } @Override - public Transferable chatting$getChattingChatComponent(int mouseY) { + public Transferable chatting$getChattingChatComponent(int mouseY, int mouseButton) { ChatLine subLine = chatting$getHoveredLine(mouseY); if (subLine != null) { ChatLine fullLine = ((ChatLineHook) subLine).chatting$getFullMessage(); - if (GuiScreen.isShiftKeyDown()) { + if (GuiScreen.isShiftKeyDown() && mouseButton == 0) { if (fullLine != null) { BufferedImage image = Chatting.INSTANCE.screenshotLine(subLine); if (image != null) RenderUtils.copyToClipboard(image); } return null; } - ChatLine line = GuiScreen.isCtrlKeyDown() ? subLine : fullLine; + ChatLine line = GuiScreen.isCtrlKeyDown() && mouseButton == 0 ? subLine : fullLine; String message = line == null ? "Could not find chat message." : line.getChatComponent().getFormattedText(); String actualMessage = GuiScreen.isAltKeyDown() ? message : EnumChatFormatting.getTextWithoutFormattingCodes(message); Notifications.INSTANCE.send("Chatting", line == null ? "Could not find chat message." : "Copied following text: " + actualMessage);