diff --git a/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java b/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java index e093d4c..10a766a 100644 --- a/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java +++ b/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java @@ -1,7 +1,6 @@ package org.polyfrost.chatting.mixin; -import cc.polyfrost.oneconfig.libs.universal.UDesktop; -import cc.polyfrost.oneconfig.libs.universal.UKeyboard; +import cc.polyfrost.oneconfig.libs.universal.*; import com.google.common.collect.Lists; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.*; @@ -11,20 +10,11 @@ import org.lwjgl.input.Mouse; import org.polyfrost.chatting.chat.*; import org.polyfrost.chatting.config.ChattingConfig; -import org.polyfrost.chatting.gui.components.CleanButton; -import org.polyfrost.chatting.gui.components.ClearButton; -import org.polyfrost.chatting.gui.components.ScreenshotButton; -import org.polyfrost.chatting.gui.components.SearchButton; -import org.polyfrost.chatting.hook.ChatLineHook; -import org.polyfrost.chatting.hook.GuiChatHook; -import org.polyfrost.chatting.hook.GuiNewChatHook; +import org.polyfrost.chatting.gui.components.*; +import org.polyfrost.chatting.hook.*; import org.polyfrost.chatting.utils.ModCompatHooks; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyArg; +import org.spongepowered.asm.mixin.*; +import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.awt.*; @@ -69,7 +59,7 @@ public abstract class GuiChatMixin extends GuiScreen implements GuiChatHook { @Inject(method = "initGui", at = @At("TAIL")) private void init(CallbackInfo ci) { chatting$initButtons(); - if (ChattingConfig.INSTANCE.getInputFieldDraft()) { + if (ChattingConfig.INSTANCE.getChatInput().getInputFieldDraft()) { String command = (ChatHooks.INSTANCE.getCommandDraft().startsWith("/") ? "" : "/") + ChatHooks.INSTANCE.getCommandDraft(); inputField.setText(inputField.getText().equals("/") ? command : ChatHooks.INSTANCE.getDraft()); } @@ -114,16 +104,20 @@ private void onDrawScreen(int mouseX, int mouseY, float partialTicks, CallbackIn } } - @ModifyArg(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiChat;drawRect(IIIII)V"), index = 2) - private int modifyRight(int right) { + @Redirect(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiChat;drawRect(IIIII)V")) + private void drawBG(int left, int top, int right, int bottom, int color) { ChattingConfig config = ChattingConfig.INSTANCE; - ChatHooks.INSTANCE.setInputBoxRight(config.getCompactInputBox() ? Math.max((int) config.getChatWindow().getWidth() + 2, ChatHooks.INSTANCE.getInputRight() + (inputField.getText().length() < ModCompatHooks.getChatInputLimit() ? 8 : 2)) : right); - return ChatHooks.INSTANCE.getInputBoxRight(); + ChatHooks.INSTANCE.setInputBoxRight(config.getChatInput().getCompactInputBox() ? Math.max((int) config.getChatWindow().getWidth() + 2, ChatHooks.INSTANCE.getInputRight() + (inputField.getText().length() < ModCompatHooks.getChatInputLimit() ? 8 : 2)) : right); + config.getChatInput().drawBG(left, bottom, ChatHooks.INSTANCE.getInputBoxRight() - left, top - bottom); } - @ModifyArg(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiChat;drawRect(IIIII)V"), index = 4) - private int modifyInputBoxColor(int color) { - return ChattingConfig.INSTANCE.getInputBoxBackgroundColor().getRGB(); + @Redirect(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiTextField;drawTextBox()V")) + private void scale(GuiTextField instance) { + ChatInputBox inputBox = ChattingConfig.INSTANCE.getChatInput(); + GlStateManager.pushMatrix(); + GlStateManager.scale(inputBox.getScale(), inputBox.getScale(), 1f); + instance.drawTextBox(); + GlStateManager.popMatrix(); } @Inject(method = "mouseClicked", at = @At("HEAD")) @@ -163,14 +157,14 @@ private String modifySentMessage(String original) { @Inject(method = "keyTyped", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiChat;sendChatMessage(Ljava/lang/String;)V")) private void clearDraft(CallbackInfo ci) { - if (ChattingConfig.INSTANCE.getInputFieldDraft()) { + if (ChattingConfig.INSTANCE.getChatInput().getInputFieldDraft()) { inputField.setText(inputField.getText().startsWith("/") ? "/" : ""); } } @Inject(method = "onGuiClosed", at = @At("HEAD")) private void saveDraft(CallbackInfo ci) { - if (ChattingConfig.INSTANCE.getInputFieldDraft()) { + if (ChattingConfig.INSTANCE.getChatInput().getInputFieldDraft()) { if (inputField.getText().startsWith("/")) { ChatHooks.INSTANCE.setCommandDraft(inputField.getText()); } else { diff --git a/src/main/java/org/polyfrost/chatting/mixin/GuiIngameForgeMixin.java b/src/main/java/org/polyfrost/chatting/mixin/GuiIngameForgeMixin.java index 56d5478..489f51f 100644 --- a/src/main/java/org/polyfrost/chatting/mixin/GuiIngameForgeMixin.java +++ b/src/main/java/org/polyfrost/chatting/mixin/GuiIngameForgeMixin.java @@ -19,6 +19,6 @@ private void cancelTranslate(Args args) { @Inject(method = "renderChat", at = @At(value = "HEAD"), cancellable = true, remap = false) private void cancelChat(int width, int height, CallbackInfo ci) { - if (!ChattingConfig.INSTANCE.getChatWindow().isEnabled()) ci.cancel(); + if (!ChattingConfig.INSTANCE.getChatWindow().canShow()) ci.cancel(); } } diff --git a/src/main/java/org/polyfrost/chatting/mixin/GuiNewChatMixin.java b/src/main/java/org/polyfrost/chatting/mixin/GuiNewChatMixin.java index 2bf5892..52b286b 100644 --- a/src/main/java/org/polyfrost/chatting/mixin/GuiNewChatMixin.java +++ b/src/main/java/org/polyfrost/chatting/mixin/GuiNewChatMixin.java @@ -59,7 +59,6 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { private int scrollPos; @Shadow public abstract int getChatWidth(); - @Unique private static final ResourceLocation COPY = new ResourceLocation("chatting:copy.png"); @Unique @@ -173,7 +172,7 @@ private void startScissor(int updateCounter, CallbackInfo ci) { int mcScale = new ScaledResolution(mc).getScaleFactor(); GL11.glEnable(GL11.GL_SCISSOR_TEST); int height = (int) hud.getAnimationHeight(); - GL11.glScissor((int) hud.position.getX() * mcScale, mc.displayHeight - (int) (hud.position.getBottomY() + 1) * mcScale, (int) (hud.position.getWidth() + (getChatOpen() ? 20 : 0) * hud.getScale()) * mcScale, (height + 1) * mcScale); + GL11.glScissor((int) hud.position.getX() * mcScale, mc.displayHeight - (int) (hud.position.getBottomY() + 1) * mcScale, (int) hud.getAnimationWidth() * mcScale, (height + 1) * mcScale); } @Inject(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;popMatrix()V")) diff --git a/src/main/java/org/polyfrost/chatting/mixin/GuiTextFieldMixin.java b/src/main/java/org/polyfrost/chatting/mixin/GuiTextFieldMixin.java index e406d89..75af92c 100644 --- a/src/main/java/org/polyfrost/chatting/mixin/GuiTextFieldMixin.java +++ b/src/main/java/org/polyfrost/chatting/mixin/GuiTextFieldMixin.java @@ -2,6 +2,7 @@ import net.minecraft.client.gui.GuiTextField; import org.polyfrost.chatting.chat.ChatHooks; +import org.polyfrost.chatting.config.ChattingConfig; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyVariable; @@ -9,7 +10,21 @@ @Mixin(GuiTextField.class) public abstract class GuiTextFieldMixin { - @ModifyVariable(method = "drawTextBox", at = @At(value = "STORE"), ordinal = 6) + @ModifyVariable(method = "drawTextBox", at = @At(value = "STORE"), ordinal = 3) + private int setX(int value) { + ChattingConfig config = ChattingConfig.INSTANCE; + if (ChatHooks.INSTANCE.checkField(this)) return (int) (value / config.getChatWindow().getScale()); + return value; + } + + @ModifyVariable(method = "drawTextBox", at = @At(value = "STORE"), ordinal = 4) + private int setY(int value) { + ChattingConfig config = ChattingConfig.INSTANCE; + if (ChatHooks.INSTANCE.checkField(this)) return (int) config.getChatInput().getBgTop(); + return value; + } + + @ModifyVariable(method = "drawTextBox", at = @At(value = "STORE"), ordinal = 5) private int getRight(int right) { if (ChatHooks.INSTANCE.checkField(this)) ChatHooks.INSTANCE.setInputRight(right); return right; diff --git a/src/main/java/org/polyfrost/chatting/mixin/HudUtilsMixin.java b/src/main/java/org/polyfrost/chatting/mixin/HudUtilsMixin.java new file mode 100644 index 0000000..f5b204e --- /dev/null +++ b/src/main/java/org/polyfrost/chatting/mixin/HudUtilsMixin.java @@ -0,0 +1,63 @@ +package org.polyfrost.chatting.mixin; + +import cc.polyfrost.oneconfig.config.Config; +import cc.polyfrost.oneconfig.config.elements.BasicOption; +import cc.polyfrost.oneconfig.hud.HUDUtils; +import cc.polyfrost.oneconfig.hud.Hud; +import org.polyfrost.chatting.chat.ChatHooks; +import org.polyfrost.chatting.config.ChattingConfig; +import org.spongepowered.asm.mixin.*; +import org.spongepowered.asm.mixin.injection.*; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.Supplier; + +@Mixin(HUDUtils.class) +public class HudUtilsMixin { + + @Unique + private static boolean isChatWindow, isInputBox; + + @Redirect(method = "addHudOptions", at = @At(value = "INVOKE", target = "Lcc/polyfrost/oneconfig/hud/Hud;setConfig(Lcc/polyfrost/oneconfig/config/Config;)V"), remap = false) + private static void detect(Hud instance, Config config) { + isChatWindow = instance.equals(ChattingConfig.INSTANCE.getChatWindow()); + isInputBox = instance.equals(ChattingConfig.INSTANCE.getChatInput()); + instance.setConfig(config); + } + + @Redirect(method = "addHudOptions", at = @At(value = "INVOKE", target = "Ljava/util/ArrayList;add(Ljava/lang/Object;)Z"), remap = false) + private static boolean paddingY(ArrayList instance, Object e) { + BasicOption option = (BasicOption) e; + if (isChatWindow || isInputBox) { + ArrayList removeQueue = new ArrayList<>(); + for (Object object : instance) { + BasicOption basicOption = (BasicOption) object; + List shows = Arrays.asList("Show in F3 (Debug)", "Show in GUIs", "Enabled", "Position Alignment"); + if (basicOption.name.equals("Show in Chat") || (isInputBox && shows.contains(basicOption.name))) { + removeQueue.add(basicOption); + } + if (basicOption.name.equals("Input Field Draft")) { + basicOption.addListener(ChatHooks.INSTANCE::resetDraft); + } + } + instance.removeAll(removeQueue); + } + List paddings = Arrays.asList("X-Padding", "Y-Padding"); + if (isInputBox && paddings.contains(option.name)) return false; + return instance.add(option); + } + + @Redirect(method = "addHudOptions", at = @At(value = "INVOKE", target = "Lcc/polyfrost/oneconfig/config/elements/BasicOption;addDependency(Ljava/lang/String;Ljava/util/function/Supplier;)V", ordinal = 5), remap = false) + private static void no(BasicOption instance, String optionName, Supplier supplier) { + if (isInputBox) return; + instance.addDependency(optionName, supplier); + } + + @Redirect(method = "addHudOptions", at = @At(value = "INVOKE", target = "Lcc/polyfrost/oneconfig/config/elements/BasicOption;addDependency(Ljava/lang/String;Ljava/util/function/Supplier;)V", ordinal = 6), remap = false) + private static void no1(BasicOption instance, String optionName, Supplier supplier) { + if (isInputBox) return; + instance.addDependency(optionName, supplier); + } +} diff --git a/src/main/java/org/polyfrost/chatting/mixin/InventoryPlayerMixin.java b/src/main/java/org/polyfrost/chatting/mixin/InventoryPlayerMixin.java index 1809e5a..6837a78 100644 --- a/src/main/java/org/polyfrost/chatting/mixin/InventoryPlayerMixin.java +++ b/src/main/java/org/polyfrost/chatting/mixin/InventoryPlayerMixin.java @@ -2,6 +2,7 @@ import net.minecraft.entity.player.InventoryPlayer; import org.polyfrost.chatting.Chatting; +import org.polyfrost.chatting.config.ChattingConfig; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -11,7 +12,7 @@ public class InventoryPlayerMixin { @Inject(method = "changeCurrentItem", at = @At("HEAD"), cancellable = true) private void cancelHotbarScrolling(int direction, CallbackInfo ci) { - if (Chatting.INSTANCE.getPeaking()) { + if (Chatting.INSTANCE.getPeaking() && ChattingConfig.INSTANCE.getPeakScrolling()) { ci.cancel(); } } diff --git a/src/main/kotlin/org/polyfrost/chatting/Chatting.kt b/src/main/kotlin/org/polyfrost/chatting/Chatting.kt index ef3f699..c1cedba 100644 --- a/src/main/kotlin/org/polyfrost/chatting/Chatting.kt +++ b/src/main/kotlin/org/polyfrost/chatting/Chatting.kt @@ -65,6 +65,7 @@ object Chatting { var deltaTime = 17L private var lastPressed = false; var peaking = false + get() = ChattingConfig.chatPeak && field private val fileFormatter: SimpleDateFormat = SimpleDateFormat("yyyy-MM-dd_HH.mm.ss'.png'") @@ -177,7 +178,7 @@ object Chatting { if (mc.currentScreen is GuiChat) peaking = false - if (peaking) { + if (peaking && ChattingConfig.peakScrolling) { var i = Mouse.getDWheel().coerceIn(-1..1) if (i != 0) { @@ -196,14 +197,14 @@ object Chatting { @SubscribeEvent fun peak(e: KeyInputEvent) { val key = ChattingConfig.chatPeakBind - if (key.isActive != lastPressed) { + if (key.isActive != lastPressed && ChattingConfig.chatPeak) { lastPressed = key.isActive if (key.isActive) { peaking = !peaking - if (!peaking) mc.ingameGUI.chatGUI.resetScroll() } else if (!ChattingConfig.peakMode) { peaking = false } + if (!peaking) mc.ingameGUI.chatGUI.resetScroll() } } diff --git a/src/main/kotlin/org/polyfrost/chatting/chat/ChatInputBox.kt b/src/main/kotlin/org/polyfrost/chatting/chat/ChatInputBox.kt new file mode 100644 index 0000000..aa3db21 --- /dev/null +++ b/src/main/kotlin/org/polyfrost/chatting/chat/ChatInputBox.kt @@ -0,0 +1,63 @@ +package org.polyfrost.chatting.chat + +import cc.polyfrost.oneconfig.config.annotations.Exclude +import cc.polyfrost.oneconfig.config.annotations.Switch +import cc.polyfrost.oneconfig.hud.BasicHud +import cc.polyfrost.oneconfig.libs.universal.UMatrixStack +import cc.polyfrost.oneconfig.utils.dsl.nanoVG +import net.minecraft.client.renderer.GlStateManager +import org.polyfrost.chatting.utils.ModCompatHooks + +class ChatInputBox: BasicHud(true, -100f, -100f) { + + init { + paddingX = 0f + paddingY = 0f + } + + @Switch( + name = "Compact Input Box", category = "Input Box", + description = "Make the chat input box the same width as the chat box." + ) + var compactInputBox = false + + @Switch( + name = "Input Field Draft", category = "Input Box", + description = "Drafts the text you wrote in the input field after closing the chat and back it up when opening the chat again." + ) + var inputFieldDraft = false + + @Exclude + var bgTop = 0f + + fun drawBG(x: Float, y: Float, width: Float, height: Float) { + bgTop = y / scale + height + 2 + if (!ModCompatHooks.shouldDrawInputBox) return + GlStateManager.enableAlpha() + GlStateManager.enableBlend() + nanoVG(true) { + drawBackground(x, y, width * scale, height * scale, scale) + } + GlStateManager.disableBlend() + GlStateManager.disableAlpha() + } + + override fun isEnabled(): Boolean { + return true + } + + override fun draw(matrices: UMatrixStack?, x: Float, y: Float, scale: Float, example: Boolean) { + } + + override fun shouldShow(): Boolean { + return false + } + + override fun getWidth(scale: Float, example: Boolean): Float { + return 0f + } + + override fun getHeight(scale: Float, example: Boolean): Float { + return 0f + } +} \ No newline at end of file diff --git a/src/main/kotlin/org/polyfrost/chatting/chat/ChatWindow.kt b/src/main/kotlin/org/polyfrost/chatting/chat/ChatWindow.kt index 5a5463f..211570d 100644 --- a/src/main/kotlin/org/polyfrost/chatting/chat/ChatWindow.kt +++ b/src/main/kotlin/org/polyfrost/chatting/chat/ChatWindow.kt @@ -6,6 +6,7 @@ import cc.polyfrost.oneconfig.hud.BasicHud import cc.polyfrost.oneconfig.internal.hud.HudCore import cc.polyfrost.oneconfig.libs.universal.UGraphics.GL import cc.polyfrost.oneconfig.libs.universal.UMatrixStack +import cc.polyfrost.oneconfig.platform.Platform import cc.polyfrost.oneconfig.utils.dsl.* import club.sk1er.patcher.config.PatcherConfig import net.minecraft.client.gui.* @@ -92,8 +93,9 @@ class ChatWindow : BasicHud(true, 2f, 1080 - 27f - 45f) { GlStateManager.disableAlpha() } - fun getAlphaBG(): Int { - return bgColor.alpha + fun canShow(): Boolean { + showInChat = true + return isEnabled && (shouldShow() || Platform.getGuiPlatform().isInChat) } fun getPaddingX(): Float { diff --git a/src/main/kotlin/org/polyfrost/chatting/config/ChattingConfig.kt b/src/main/kotlin/org/polyfrost/chatting/config/ChattingConfig.kt index 8994a2c..b863000 100644 --- a/src/main/kotlin/org/polyfrost/chatting/config/ChattingConfig.kt +++ b/src/main/kotlin/org/polyfrost/chatting/config/ChattingConfig.kt @@ -11,7 +11,6 @@ import cc.polyfrost.oneconfig.config.migration.VigilanceMigrator import cc.polyfrost.oneconfig.libs.universal.UKeyboard import cc.polyfrost.oneconfig.libs.universal.UMinecraft import cc.polyfrost.oneconfig.utils.hypixel.HypixelUtils -import club.sk1er.patcher.config.PatcherConfig import org.polyfrost.chatting.Chatting import org.polyfrost.chatting.chat.* import org.polyfrost.chatting.gui.components.TabButton @@ -41,18 +40,6 @@ object ChattingConfig : Config( ) var hoveredChatBackgroundColor = OneColor(80, 80, 80, 128) - @Switch( - name = "Compact Input Box", category = "General", - description = "Make the chat input box the same width as the chat box." - ) - var compactInputBox = false - - @Color( - name = "Input Box Background Color", category = "General", - description = "The color of the chat input box background." - ) - var inputBoxBackgroundColor = OneColor(0, 0, 0, 128) - @Checkbox( name = "Message Fade" ) @@ -66,18 +53,24 @@ object ChattingConfig : Config( @Switch( name = "Inform Outdated Mods", category = "General", - description = "Inform the user when a mod can be replaced by Chatting." + description = "Inform the user when a mod can be replaced by Chatting.", + size = 2 ) var informForAlternatives = true @Switch( - name = "Input Field Draft", category = "General", - description = "Drafts the text you wrote in the input field after closing the chat and back it up when opening the chat again." + name = "Chat Peak", + description = "Allows you to view / scroll chat while moving around." ) - var inputFieldDraft = false + var chatPeak = false + + @Switch( + name = "Scrolling", + ) + var peakScrolling = false @KeyBind( - name = "Chat Peak" + name = "Peak KeyBind" ) var chatPeakBind = OneKeyBind(UKeyboard.KEY_Z) @@ -275,22 +268,29 @@ object ChattingConfig : Config( var customChatHeight = false @Slider( - min = 180F, max = 2160F, name = "Focused Height (px)", category = "Chat Window", + min = 20F, max = 2160F, name = "Focused Height (px)", category = "Chat Window", description = "The height of the chat window when focused." ) var focusedHeight = 180 + get() = field.coerceIn(20, 2160) @Slider( - min = 180F, max = 2160F, name = "Unfocused Height (px)", category = "Chat Window", + min = 20F, max = 2160F, name = "Unfocused Height (px)", category = "Chat Window", description = "The height of the chat window when unfocused." ) - var unfocusedHeight = 180 + var unfocusedHeight = 90 + get() = field.coerceIn(20, 2160) @HUD( name = "Chat Window", category = "Chat Window" ) var chatWindow = ChatWindow() + @HUD( + name = "Chat Input Box", category = "Input Box" + ) + var chatInput = ChatInputBox() + @Dropdown( name = "Screenshot Mode", category = "Screenshotting", options = ["Save To System", "Add To Clipboard", "Both"], description = "What to do when taking a screenshot." @@ -368,18 +368,15 @@ object ChattingConfig : Config( addDependency("scrollingSpeed", "smoothScrolling") addDependency("messageSpeed", "smoothChat") addDependency("bgDuration", "smoothBG") + addDependency("peakScrolling", "chatPeak") + addDependency("chatPeakBind", "chatPeak") + addDependency("peakMode", "chatPeak") addDependency("smoothChat", "BetterChat Smooth Chat") { !ModCompatHooks.betterChatSmoothMessages } - addDependency("inputBoxBackgroundColor", "Patcher's Transparent Chat Input Field. Please turn it off to use this feature.") { - !Chatting.isPatcher || !PatcherConfig.transparentChatInputField - } addListener("peakMode") { Chatting.peaking = false } - addListener("inputFieldDraft") { - ChatHooks.resetDraft() - } addListener("hideChatHeadOnConsecutiveMessages") { ChatLineHook.`chatting$chatLines`.map { it.get() as ChatLineHook? }.forEach { it?.`chatting$updatePlayerInfo`() } } diff --git a/src/main/kotlin/org/polyfrost/chatting/gui/components/CleanButton.kt b/src/main/kotlin/org/polyfrost/chatting/gui/components/CleanButton.kt index 6db7ad9..9d7929a 100644 --- a/src/main/kotlin/org/polyfrost/chatting/gui/components/CleanButton.kt +++ b/src/main/kotlin/org/polyfrost/chatting/gui/components/CleanButton.kt @@ -46,7 +46,7 @@ open class CleanButton( } open fun setPositionY() { - yPosition = UResolution.scaledHeight - 27 + if (ChattingConfig.compactInputBox && xPosition - ChatHooks.inputBoxRight >= 1) 13 else 0 + yPosition = UResolution.scaledHeight - 27 + if (ChattingConfig.chatInput.compactInputBox && xPosition - ChatHooks.inputBoxRight >= 1) 13 else 0 } override fun mousePressed(mc: Minecraft, mouseX: Int, mouseY: Int): Boolean { diff --git a/src/main/kotlin/org/polyfrost/chatting/utils/ModCompatHooks.kt b/src/main/kotlin/org/polyfrost/chatting/utils/ModCompatHooks.kt index 4f3f53f..3ea5126 100644 --- a/src/main/kotlin/org/polyfrost/chatting/utils/ModCompatHooks.kt +++ b/src/main/kotlin/org/polyfrost/chatting/utils/ModCompatHooks.kt @@ -65,6 +65,9 @@ object ModCompatHooks { @JvmStatic val chatInputLimit get() = if (isPatcher && PatcherConfig.extendedChatLength) 256 else 100 + @JvmStatic + val shouldDrawInputBox + get() = !isPatcher || !PatcherConfig.transparentChatInputField @JvmStatic fun redirectDrawString(text: String, x: Float, y: Float, color: Int, chatLine: ChatLine, screenshot: Boolean): Int { diff --git a/src/main/resources/mixins.chatting.json b/src/main/resources/mixins.chatting.json index 2df1ad3..8e3639a 100644 --- a/src/main/resources/mixins.chatting.json +++ b/src/main/resources/mixins.chatting.json @@ -24,6 +24,7 @@ "GuiUtilsMixin" ], "mixins": [ + "HudUtilsMixin", "InventoryPlayerMixin" ] } \ No newline at end of file