aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java
diff options
context:
space:
mode:
authorWyvest <wyvestbusiness@gmail.com>2023-11-23 19:07:22 +0900
committerWyvest <wyvestbusiness@gmail.com>2023-11-23 19:07:22 +0900
commit50dec3baa84ea72f9a711b936aabacf53aa04e05 (patch)
tree1f2840895ebf6934e2c1e9d78cfa3d963910b061 /src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java
parent97a700fe1af0360b6deed3c6b0b0a3839d5a690d (diff)
downloadChatting-50dec3baa84ea72f9a711b936aabacf53aa04e05.tar.gz
Chatting-50dec3baa84ea72f9a711b936aabacf53aa04e05.tar.bz2
Chatting-50dec3baa84ea72f9a711b936aabacf53aa04e05.zip
Various chat head bug fixes
- Fix chat heads making chat lines go over chat background - Fix chat heads making tooltip hovers not work properly
Diffstat (limited to 'src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java')
-rw-r--r--src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java b/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java
index 167bbd4..d434958 100644
--- a/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java
+++ b/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java
@@ -1,5 +1,6 @@
package org.polyfrost.chatting.mixin;
+import cc.polyfrost.oneconfig.libs.universal.UResolution;
import org.polyfrost.chatting.chat.*;
import org.polyfrost.chatting.config.ChattingConfig;
import org.polyfrost.chatting.gui.components.ClearButton;
@@ -102,6 +103,15 @@ public abstract class GuiChatMixin extends GuiScreen {
return ChattingConfig.INSTANCE.getInputBoxBackgroundColor().getRGB();
}
+ @ModifyArg(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiNewChat;getChatComponent(II)Lnet/minecraft/util/IChatComponent;"), index = 0)
+ private int modifyChatComponentX(int x) {
+ if (ChattingConfig.INSTANCE.getShowChatHeads()) {
+ return x - (10 * (int) UResolution.getScaleFactor());
+ } else {
+ return x;
+ }
+ }
+
@Inject(method = "mouseClicked", at = @At("HEAD"))
private void mouseClicked(int mouseX, int mouseY, int mouseButton, CallbackInfo ci) {
GuiNewChatHook hook = ((GuiNewChatHook) Minecraft.getMinecraft().ingameGUI.getChatGUI());
@@ -126,6 +136,15 @@ public abstract class GuiChatMixin extends GuiScreen {
}
+ @ModifyArg(method = "mouseClicked", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiNewChat;getChatComponent(II)Lnet/minecraft/util/IChatComponent;"), index = 0)
+ private int modifyChatComponentX2(int x) {
+ if (ChattingConfig.INSTANCE.getShowChatHeads()) {
+ return x - (10 * (int) UResolution.getScaleFactor());
+ } else {
+ return x;
+ }
+ }
+
@ModifyArg(method = "keyTyped", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiChat;sendChatMessage(Ljava/lang/String;)V"), index = 0)
private String modifySentMessage(String original) {
if (ChattingConfig.INSTANCE.getChatShortcuts()) {