diff options
author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-08-16 21:54:31 +0700 |
---|---|---|
committer | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-08-16 21:54:31 +0700 |
commit | 794dcf0a1312b58cf1247c0907414fd1eb88e06d (patch) | |
tree | 7f3d608a901a0ac8164ca6a29a69410de7701dc8 | |
parent | 89938d618307955ac1218b0f286bb1b1ce252e35 (diff) | |
download | Chatting-794dcf0a1312b58cf1247c0907414fd1eb88e06d.tar.gz Chatting-794dcf0a1312b58cf1247c0907414fd1eb88e06d.tar.bz2 Chatting-794dcf0a1312b58cf1247c0907414fd1eb88e06d.zip |
new: completely remove Essential
fix: fix copy chat button not rendering when patcher transparent chat is enabled
12 files changed, 91 insertions, 286 deletions
diff --git a/build.gradle b/build.gradle index 6ff1e21..6c2aee8 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,7 @@ loom { launchConfigs { client { arg("--tweakClass", "cc.polyfrost.oneconfigwrapper.OneConfigWrapper") - arg("--tweakClass", "gg.essential.loader.stage0.EssentialSetupTweaker") + property("mixin.debug.export", "true") } } runConfigs { @@ -57,13 +57,9 @@ dependencies { minecraft("com.mojang:minecraft:1.8.9") mappings("de.oceanlabs.mcp:mcp_stable:22-1.8.9") forge("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9") - compileOnly ('org.spongepowered:mixin:0.8.5-SNAPSHOT') - compileOnly('cc.polyfrost:oneconfig-1.8.9-forge:0.1.0-alpha50') - include('cc.polyfrost:oneconfig-wrapper-1.8.9-forge:1.0.0-alpha6') - compileOnly 'gg.essential:essential-1.8.9-forge:1933' - include ('gg.essential:loader-launchwrapper:1.1.1') { - transitive = false - } + compileOnly ('org.spongepowered:mixin:0.7.11-SNAPSHOT') + compileOnly('cc.polyfrost:oneconfig-1.8.9-forge:0.1.0-alpha+') + include('cc.polyfrost:oneconfig-wrapper-launchwrapper:1.0.0-alpha+') modRuntimeOnly("me.djtheredstoner:DevAuth-forge-legacy:1.1.0") } diff --git a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java index fe76b29..13c91ef 100644 --- a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java +++ b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java @@ -9,7 +9,7 @@ import cc.woverflow.chatting.gui.components.CleanButton; import cc.woverflow.chatting.hook.GuiNewChatHook; import cc.woverflow.chatting.utils.ModCompatHooks; import cc.woverflow.chatting.utils.RenderUtils; -import gg.essential.universal.UMouse; +import cc.polyfrost.oneconfig.libs.universal.UMouse; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.*; import net.minecraft.client.renderer.GlStateManager; @@ -71,6 +71,8 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { @Shadow public abstract void deleteChatLine(int id); + @Shadow public abstract int getChatWidth(); + @Unique private static final ResourceLocation COPY = new ResourceLocation("chatting:copy.png"); @@ -121,26 +123,46 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { : linesToDraw; } + private boolean lineInBounds = false; + @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) { - int left = args.get(0); - int top = args.get(1); - int right = args.get(2); - int bottom = args.get(3); + args.set(4, changeChatBackgroundColor(ChattingConfig.INSTANCE.getChatBackgroundColor(), args.get(4))); + if (mc.currentScreen instanceof GuiChat) { + int left = args.get(0); + int top = args.get(1); + int right = args.get(2); + int bottom = args.get(3); + if (isInBounds(left, top, right, bottom, getChatScale())) { + chatting$shouldCopy = true; + lineInBounds = true; + args.set(4, changeChatBackgroundColor(ChattingConfig.INSTANCE.getHoveredChatBackgroundColor(), args.get(4))); + } + } + } + + @ModifyArgs(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;drawStringWithShadow(Ljava/lang/String;FFI)I")) + private void drawChatBox(Args args) { if (mc.currentScreen instanceof GuiChat) { float f = this.getChatScale(); - int mouseX = MathHelper.floor_double(UMouse.getScaledX()) - 3; - int mouseY = MathHelper.floor_double(UMouse.getScaledY()) - 27 + ModCompatHooks.getYOffset() - ModCompatHooks.getChatPosition(); - mouseX = MathHelper.floor_float((float) mouseX / f); - mouseY = -(MathHelper.floor_float((float) mouseY / f)); //WHY DO I NEED TO DO THIS - if (mouseX >= (left + ModCompatHooks.getXOffset()) && mouseY < bottom && mouseX < (right + 11 + ModCompatHooks.getXOffset()) && mouseY >= top) { + int left = 0; + int top = (int) ((float) args.get(2) - 1); + int right = MathHelper.ceiling_float_int((float)getChatWidth() / f) + 4; + int bottom = (int) ((float) args.get(2) + 8); + if ((chatting$shouldCopy && lineInBounds) || isInBounds(left, top, right, bottom, f)) { chatting$shouldCopy = true; drawCopyChatBox(right, top); - args.set(4, changeChatBackgroundColor(ChattingConfig.INSTANCE.getHoveredChatBackgroundColor(), args.get(4))); - return; } } - args.set(4, changeChatBackgroundColor(ChattingConfig.INSTANCE.getChatBackgroundColor(), args.get(4))); + lineInBounds = false; + } + + private boolean isInBounds(int left, int top, int right, int bottom, float chatScale) { + int mouseX = MathHelper.floor_double(UMouse.getScaledX()) - 3; + int mouseY = MathHelper.floor_double(UMouse.getScaledY()) - 27 + ModCompatHooks.getYOffset() - ModCompatHooks.getChatPosition(); + mouseX = MathHelper.floor_float((float) mouseX / chatScale); + mouseY = -(MathHelper.floor_float((float) mouseY / chatScale)); //WHY DO I NEED TO DO THIS + return mouseX >= (left + ModCompatHooks.getXOffset()) && mouseY < bottom && mouseX < (right + 11 + ModCompatHooks.getXOffset()) && mouseY >= top; } private int changeChatBackgroundColor(OneColor color, int alphaColor) { diff --git a/src/main/kotlin/cc/woverflow/chatting/Chatting.kt b/src/main/kotlin/cc/woverflow/chatting/Chatting.kt index 3b7eb8b..3aa6302 100644 --- a/src/main/kotlin/cc/woverflow/chatting/Chatting.kt +++ b/src/main/kotlin/cc/woverflow/chatting/Chatting.kt @@ -1,7 +1,10 @@ package cc.woverflow.chatting +import cc.polyfrost.oneconfig.libs.universal.UDesktop import cc.polyfrost.oneconfig.libs.universal.UResolution import cc.polyfrost.oneconfig.utils.commands.CommandManager +import cc.polyfrost.oneconfig.utils.dsl.browseLink +import cc.polyfrost.oneconfig.utils.notifications.Notifications import cc.woverflow.chatting.chat.ChatSearchingManager import cc.woverflow.chatting.chat.ChatShortcuts import cc.woverflow.chatting.chat.ChatSpamBlock @@ -42,7 +45,7 @@ import java.util.* modid = Chatting.ID, name = Chatting.NAME, version = Chatting.VER, - modLanguageAdapter = "gg.essential.api.utils.KotlinAdapter" + modLanguageAdapter = "cc.polyfrost.oneconfig.utils.KotlinLanguageAdapter" ) object Chatting { @@ -92,9 +95,9 @@ object Chatting { fun onForgeLoad(event: FMLLoadCompleteEvent) { if (ChattingConfig.informForAlternatives) { if (isHychat) { - //sendBrandedNotification(NAME, "Hychat can be removed as it is replaced by Chatting. Click here for more information.", action = { - // UDesktop.browseURL("https://microcontrollersdev.github.io/Alternatives/1.8.9/hychat") - //}) + Notifications.INSTANCE.send(NAME, "Hychat can be removed as it is replaced by Chatting. Click here for more information.") { + UDesktop.browseLink("https://microcontrollersdev.github.io/Alternatives/1.8.9/hychat") + } } if (isSkytils) { try { @@ -116,23 +119,23 @@ object Chatting { val chatTabs = skytilsClass.getDeclaredField("chatTabs") chatTabs.isAccessible = true if (chatTabs.getBoolean(instance)) { - //sendBrandedNotification(NAME, "Skytils' chat tabs can be disabled as it is replace by Chatting.\nClick here to automatically do this.", 6F, action = { - // chatTabs.setBoolean(instance, false) - // ChattingConfig.chatTabs = true - // ChattingConfig.hypixelOnlyChatTabs = true - // ChattingConfig.save() - // skytilsClass.getMethod("markDirty").invoke(instance) - // skytilsClass.getMethod("writeData").invoke(instance) - //}) + Notifications.INSTANCE.send(NAME, "Skytils' chat tabs can be disabled as it is replace by Chatting.\nClick here to automatically do this.", 6F) { + chatTabs.setBoolean(instance, false) + ChattingConfig.chatTabs = true + ChattingConfig.hypixelOnlyChatTabs = true + ChattingConfig.save() + skytilsClass.getMethod("markDirty").invoke(instance) + skytilsClass.getMethod("writeData").invoke(instance) + } } val copyChat = skytilsClass.getDeclaredField("chatTabs") copyChat.isAccessible = true if (copyChat.getBoolean(instance)) { - //sendBrandedNotification(NAME, "Skytils' copy chat messages can be disabled as it is replace by Chatting.\nClick here to automatically do this.", 6F, action = { - // copyChat.setBoolean(instance, false) - // skytilsClass.getMethod("markDirty").invoke(instance) - // skytilsClass.getMethod("writeData").invoke(instance) - //}) + Notifications.INSTANCE.send(NAME, "Skytils' copy chat messages can be disabled as it is replace by Chatting.\nClick here to automatically do this.", 6F) { + copyChat.setBoolean(instance, false) + skytilsClass.getMethod("markDirty").invoke(instance) + skytilsClass.getMethod("writeData").invoke(instance) + } } } @@ -197,11 +200,11 @@ object Chatting { private fun screenshot(messages: List<String>): BufferedImage? { if (messages.isEmpty()) { - //sendBrandedNotification("Chatting", "Chat window is empty.") + Notifications.INSTANCE.send("Chatting", "Chat window is empty.") return null } if (!OpenGlHelper.isFramebufferEnabled()) { - //sendBrandedNotification("Chatting", "Screenshot failed, please disable “Fast Render” in OptiFine’s “Performance” tab.") + Notifications.INSTANCE.send("Chatting", "Screenshot failed, please disable “Fast Render” in OptiFine’s “Performance” tab.") return null } @@ -220,11 +223,11 @@ object Chatting { val image = fb.screenshot(file) Minecraft.getMinecraft().entityRenderer.setupOverlayRendering() Minecraft.getMinecraft().framebuffer.bindFramebuffer(true) - //sendBrandedNotification("Chatting", "Chat screenshotted successfully." + (if (ChattingConfig.copyMode != 1) "\nClick to open." else ""), action = { - // if (!UDesktop.open(file)) { - // sendBrandedNotification("Chatting", "Could not browse!") - // } - // }) + Notifications.INSTANCE.send("Chatting", "Chat screenshotted successfully." + (if (ChattingConfig.copyMode != 1) "\nClick to open." else "")) { + if (!UDesktop.open(file)) { + Notifications.INSTANCE.send("Chatting", "Could not browse!") + } + } return image } } diff --git a/src/main/kotlin/cc/woverflow/chatting/config/ChattingConfig.kt b/src/main/kotlin/cc/woverflow/chatting/config/ChattingConfig.kt index 9704e29..40ebd9a 100644 --- a/src/main/kotlin/cc/woverflow/chatting/config/ChattingConfig.kt +++ b/src/main/kotlin/cc/woverflow/chatting/config/ChattingConfig.kt @@ -1,26 +1,18 @@ package cc.woverflow.chatting.config import cc.polyfrost.oneconfig.config.Config -import cc.polyfrost.oneconfig.config.annotations.Button -import cc.polyfrost.oneconfig.config.annotations.Checkbox -import cc.polyfrost.oneconfig.config.annotations.Dropdown -import cc.polyfrost.oneconfig.config.annotations.Info -import cc.polyfrost.oneconfig.config.annotations.Slider -import cc.polyfrost.oneconfig.config.annotations.Switch +import cc.polyfrost.oneconfig.config.annotations.* import cc.polyfrost.oneconfig.config.core.OneColor import cc.polyfrost.oneconfig.config.data.InfoType import cc.polyfrost.oneconfig.config.data.Mod import cc.polyfrost.oneconfig.config.data.ModType import cc.polyfrost.oneconfig.config.migration.VigilanceMigrator -import cc.polyfrost.oneconfig.utils.dsl.openScreen import cc.polyfrost.oneconfig.utils.hypixel.HypixelUtils import cc.woverflow.chatting.Chatting import cc.woverflow.chatting.chat.ChatShortcuts import cc.woverflow.chatting.chat.ChatTab import cc.woverflow.chatting.chat.ChatTabs -import cc.woverflow.chatting.gui.ChatShortcutViewGui import cc.woverflow.chatting.gui.components.TabButton - import java.io.File object ChattingConfig : @@ -48,14 +40,14 @@ object ChattingConfig : ) var removeScrollBar = false - @cc.polyfrost.oneconfig.config.annotations.Color( + @Color( name = "Chat Background Color", category = "General", allowAlpha = false ) var chatBackgroundColor = OneColor(0, 0, 0, 128) - @cc.polyfrost.oneconfig.config.annotations.Color( + @Color( name = "Copy Chat Message Background Color", category = "General", allowAlpha = false @@ -197,12 +189,6 @@ object ChattingConfig : ) var hypixelOnlyChatShortcuts = true - @Button( - name = "Open Chat Shortcuts Editor GUI", - category = "Shortcuts", text = "Open" - ) - var openChatShortcutsGUI = Runnable { ChatShortcutViewGui().openScreen() } - init { initialize() addListener("chatTabs") { diff --git a/src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutEditGui.kt b/src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutEditGui.kt deleted file mode 100644 index 983e2ed..0000000 --- a/src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutEditGui.kt +++ /dev/null @@ -1,88 +0,0 @@ -package cc.woverflow.chatting.gui - -import cc.woverflow.chatting.chat.ChatShortcuts -import gg.essential.api.EssentialAPI -import gg.essential.api.gui.buildConfirmationModal -import gg.essential.elementa.ElementaVersion -import gg.essential.elementa.WindowScreen -import gg.essential.elementa.components.UIBlock -import gg.essential.elementa.constraints.CenterConstraint -import gg.essential.elementa.constraints.SiblingConstraint -import gg.essential.elementa.dsl.* -import gg.essential.vigilance.gui.VigilancePalette -import gg.essential.vigilance.gui.settings.ButtonComponent -import gg.essential.vigilance.gui.settings.TextComponent - -class ChatShortcutEditGui(private var alias: String, private var command: String, private val editing: Boolean) : - WindowScreen(restoreCurrentGuiOnClose = true, version = ElementaVersion.V1) { - - private val initialAlias = alias - private val initialCommand = command - - override fun initScreen(width: Int, height: Int) { - super.initScreen(width, height) - window.clearChildren() // make sure everything is cleared, sometimes the shortcuts duplicated - val block by UIBlock(VigilancePalette.getBackground()).constrain { - this.x = CenterConstraint() - this.y = CenterConstraint() - this.width = 100.pixels() - this.height = 100.pixels() - } childOf window - TextComponent(initialAlias, "Alias", wrap = false, protected = false).constrain { - x = CenterConstraint() - y = 10.percent() - }.childOf(block).onValueChange { - if (it is String) alias = it - } - TextComponent(initialCommand, "Command", wrap = false, protected = false).constrain { - x = CenterConstraint() - y = SiblingConstraint() - }.childOf(block).onValueChange { - if (it is String) command = it - } - if (editing) { - ButtonComponent("Reset") { - EssentialAPI.getGuiUtil().openScreen(ChatShortcutEditGui(initialAlias, initialCommand, editing)) - } constrain { - x = CenterConstraint() - y = 70.percent() - } childOf window - } - ButtonComponent("Save") { - alias = alias.substringAfter("/") - command = command.substringAfter("/") - if (editing) { - ChatShortcuts.removeShortcut(initialAlias) - } - if (alias.isBlank() || command.isBlank()) { - return@ButtonComponent - } - if (ChatShortcuts.shortcuts.any { it.first == alias }) { - EssentialAPI.getGuiUtil().openScreen(ChatShortcutConfirmGui(alias, command)) - return@ButtonComponent - } - ChatShortcuts.writeShortcut(alias, command) - restorePreviousScreen() - } constrain { - x = CenterConstraint() - y = 80.percent() - } childOf window - } - - inner class ChatShortcutConfirmGui(private var alias: String, private var command: String) : - WindowScreen(restoreCurrentGuiOnClose = true, version = ElementaVersion.V1) { - override fun initScreen(width: Int, height: Int) { - super.initScreen(width, height) - EssentialAPI.getEssentialComponentFactory().buildConfirmationModal { - text = "An alias with this name already exists, are you sure you want to overwrite it?" - onConfirm = { - ChatShortcuts.writeShortcut(alias, command) - EssentialAPI.getGuiUtil().openScreen(null) - } - onDeny = { - restorePreviousScreen() - } - } childOf this@ChatShortcutConfirmGui.window - } - } -} diff --git a/src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutViewGui.kt b/src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutViewGui.kt deleted file mode 100644 index 0fa2ef7..0000000 --- a/src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutViewGui.kt +++ /dev/null @@ -1,65 +0,0 @@ -package cc.woverflow.chatting.gui - -import cc.woverflow.chatting.chat.ChatShortcuts -import cc.woverflow.chatting.gui.components.TextBlock -import gg.essential.api.EssentialAPI -import gg.essential.elementa.ElementaVersion -import gg.essential.elementa.WindowScreen -import gg.essential.elementa.components.ScrollComponent -import gg.essential.elementa.components.UIBlock -import gg.essential.elementa.constraints.CenterConstraint -import gg.essential.elementa.constraints.RelativeWindowConstraint -import gg.essential.elementa.constraints.SiblingConstraint -import gg.essential.elementa.dsl.* -import gg.essential.vigilance.gui.VigilancePalette -import gg.essential.vigilance.gui.settings.ButtonComponent - -class ChatShortcutViewGui : WindowScreen(version = ElementaVersion.V1) { - override fun initScreen(width: Int, height: Int) { - super.initScreen(width, height) - window.clearChildren() // make sure everything is cleared, sometimes the shortcuts duplicated - val container by ScrollComponent() constrain { - x = 0.pixels() - y = 0.pixels() - this.width = 85.percent() - this.height = 85.percent() - } childOf window - for ((index, shortcut) in ChatShortcuts.shortcuts.withIndex()) { - val block = UIBlock(VigilancePalette.getBackground()).constrain { - x = 3.percent() - y = (index * 12).percent() - this.width = 94.percent() - this.height = 25.pixels() - } childOf container - TextBlock(shortcut.first).constrain { - x = RelativeWindowConstraint(0.05F) - y = CenterConstraint() - } childOf block - TextBlock(shortcut.second).constrain { - x = SiblingConstraint(10F) - y = CenterConstraint() - } childOf block - ButtonComponent("Edit") { - println("${shortcut.first} ${shortcut.second}") - EssentialAPI.getGuiUtil().openScreen(ChatShortcutEditGui(shortcut.first, shortcut.second, true)) - } constrain { - x = SiblingConstraint(20F) - y = CenterConstraint() - } childOf block - ButtonComponent("Delete") { - println("${shortcut.first} ${shortcut.second}") - ChatShortcuts.removeShortcut(shortcut.first) - EssentialAPI.getGuiUtil().openScreen(ChatShortcutViewGui()) - } constrain { - x = SiblingConstraint(5F) - y = CenterConstraint() - } childOf block - } - ButtonComponent("New") { - EssentialAPI.getGuiUtil().openScreen(ChatShortcutEditGui("", "", false)) - } constrain { - x = CenterConstraint() - y = 90.percent() - } childOf window - } -}
\ No newline at end of file diff --git a/src/main/kotlin/cc/woverflow/chatting/gui/components/ClearButton.kt b/src/main/kotlin/cc/woverflow/chatting/gui/components/ClearButton.kt index 2e46974..6ac3d34 100644 --- a/src/main/kotlin/cc/woverflow/chatting/gui/components/ClearButton.kt +++ b/src/main/kotlin/cc/woverflow/chatting/gui/components/ClearButton.kt @@ -1,41 +1,33 @@ package cc.woverflow.chatting.gui.components +import cc.polyfrost.oneconfig.libs.universal.ChatColor +import cc.polyfrost.oneconfig.libs.universal.UChat +import cc.polyfrost.oneconfig.libs.universal.UResolution +import cc.polyfrost.oneconfig.utils.Multithreading import cc.woverflow.chatting.Chatting -import gg.essential.api.EssentialAPI -import gg.essential.api.gui.buildConfirmationModal -import gg.essential.elementa.ElementaVersion -import gg.essential.elementa.WindowScreen -import gg.essential.elementa.components.UIBlock -import gg.essential.elementa.dsl.childOf -import gg.essential.elementa.utils.withAlpha -import gg.essential.universal.ChatColor -import gg.essential.universal.UResolution import net.minecraft.client.Minecraft import net.minecraft.client.gui.Gui import net.minecraft.client.renderer.GlStateManager import net.minecraft.util.ResourceLocation -import java.awt.Color class ClearButton : CleanButton(13379014, { UResolution.scaledWidth - 28 }, { UResolution.scaledHeight - 27 }, 12, 12, "", { RenderType.NONE }) { - override fun onMousePress() { - EssentialAPI.getGuiUtil().openScreen(object : WindowScreen(ElementaVersion.V1, restoreCurrentGuiOnClose = true, drawDefaultBackground = false) { - init { - UIBlock(Color.BLACK.withAlpha(0.3f)) childOf window - EssentialAPI.getEssentialComponentFactory().buildConfirmationModal { - text = "${ChatColor.RED}Are ${ChatColor.RED}you ${ChatColor.RED}sure ${ChatColor.RED}you ${ChatColor.RED}want ${ChatColor.RED}to ${ChatColor.RED}clear ${ChatColor.RED}the ${ChatColor.RED}chat?${ChatColor.RESET}" - secondaryText = "${ChatColor.BOLD}This${ChatColor.BOLD} ${ChatColor.BOLD}is${ChatColor.BOLD} ${ChatColor.BOLD}irreversible.${ChatColor.RESET}" + var times = 0 - onConfirm = { - Minecraft.getMinecraft().ingameGUI.chatGUI.clearChatMessages() - restorePreviousScreen() - } - onDeny = { restorePreviousScreen() } - } childOf window + override fun onMousePress() { + ++times + if (times > 1) { + times = 0 + Minecraft.getMinecraft().ingameGUI.chatGUI.clearChatMessages() + } else { + UChat.chat(ChatColor.RED + ChatColor.BOLD.toString() + "Click again to clear the chat!") + Multithreading.runAsync { + Thread.sleep(3000) + times = 0 } - }) + } } override fun drawButton(mc: Minecraft, mouseX: Int, mouseY: Int) { diff --git a/src/main/kotlin/cc/woverflow/chatting/gui/components/ScreenshotButton.kt b/src/main/kotlin/cc/woverflow/chatting/gui/components/ScreenshotButton.kt index 9fc5e8d..4f65427 100644 --- a/src/main/kotlin/cc/woverflow/chatting/gui/components/ScreenshotButton.kt +++ b/src/main/kotlin/cc/woverflow/chatting/gui/components/ScreenshotButton.kt @@ -1,9 +1,9 @@ package cc.woverflow.chatting.gui.components +import cc.polyfrost.oneconfig.libs.universal.UResolution +import cc.polyfrost.oneconfig.libs.universal.UScreen import cc.woverflow.chatting.Chatting import cc.woverflow.chatting.mixin.GuiNewChatAccessor -import gg.essential.api.utils.GuiUtil -import gg.essential.universal.UResolution import net.minecraft.client.Minecraft import net.minecraft.client.gui.Gui import net.minecraft.client.gui.GuiChat @@ -16,7 +16,7 @@ class ScreenshotButton : override fun onMousePress() { val chat = Minecraft.getMinecraft().ingameGUI.chatGUI - if (GuiUtil.getOpenedScreen() is GuiChat) { + if (UScreen.currentScreen is GuiChat) { Chatting.screenshotChat((chat as GuiNewChatAccessor).scrollPos) } } diff --git a/src/main/kotlin/cc/woverflow/chatting/gui/components/SearchButton.kt b/src/main/kotlin/cc/woverflow/chatting/gui/components/SearchButton.kt index 819eac0..2194bbb 100644 --- a/src/main/kotlin/cc/woverflow/chatting/gui/components/SearchButton.kt +++ b/src/main/kotlin/cc/woverflow/chatting/gui/components/SearchButton.kt @@ -1,8 +1,8 @@ package cc.woverflow.chatting.gui.components +import cc.polyfrost.oneconfig.libs.universal.UResolution import cc.woverflow.chatting.Chatting import cc.woverflow.chatting.hook.GuiNewChatHook -import gg.essential.universal.UResolution import net.minecraft.client.Minecraft import net.minecraft.client.gui.Gui import net.minecraft.client.gui.GuiTextField diff --git a/src/main/kotlin/cc/woverflow/chatting/gui/components/TabButton.kt b/src/main/kotlin/cc/woverflow/chatting/gui/components/TabButton.kt index da20eed..f320925 100644 --- a/src/main/kotlin/cc/woverflow/chatting/gui/components/TabButton.kt +++ b/src/main/kotlin/cc/woverflow/chatting/gui/components/TabButton.kt @@ -1,9 +1,9 @@ package cc.woverflow.chatting.gui.components +import cc.polyfrost.oneconfig.libs.universal.UResolution import cc.woverflow.chatting.chat.ChatTab import cc.woverflow.chatting.chat.ChatTabs import cc.woverflow.chatting.config.ChattingConfig -import gg.essential.universal.UResolution class TabButton(buttonId: Int, x: Int, widthIn: Int, heightIn: Int, private val chatTab: ChatTab) : CleanButton(buttonId, { x }, { diff --git a/src/main/kotlin/cc/woverflow/chatting/gui/components/TextBlock.kt b/src/main/kotlin/cc/woverflow/chatting/gui/components/TextBlock.kt deleted file mode 100644 index 8a4f32a..0000000 --- a/src/main/kotlin/cc/woverflow/chatting/gui/components/TextBlock.kt +++ /dev/null @@ -1,41 +0,0 @@ -package cc.woverflow.chatting.gui.components - -import gg.essential.elementa.components.UIBlock -import gg.essential.elementa.components.UIText -import gg.essential.elementa.constraints.ChildBasedSizeConstraint -import gg.essential.elementa.dsl.* -import gg.essential.elementa.effects.OutlineEffect -import gg.essential.elementa.state.BasicState -import gg.essential.vigilance.gui.VigilancePalette -import gg.essential.vigilance.gui.settings.SettingComponent - -/** - * Heavily modified from Vigilance under LGPLv3 (modified to be just a text block) - * https://github.com/Sk1erLLC/Vigilance/blob/master/LICENSE - */ -class TextBlock( - text: String -) : SettingComponent() { - private val textHolder = UIBlock() constrain { - width = ChildBasedSizeConstraint() + 6.pixels() - height = ChildBasedSizeConstraint() + 6.pixels() - color = VigilancePalette.getDarkHighlight().toConstraint() - } childOf this effect OutlineEffect( - VigilancePalette.getDivider(), - 1f - ).bindColor(BasicState(VigilancePalette.getDivider())) - - private val text: UIText = UIText(text) constrain { - x = 3.pixels() - y = 3.pixels() - } - - init { - this.text childOf textHolder - - constrain { - width = ChildBasedSizeConstraint() - height = ChildBasedSizeConstraint() - } - } -}
\ No newline at end of file diff --git a/src/main/resources/mixins.chatting.json b/src/main/resources/mixins.chatting.json index 35e4024..5a7c5bf 100644 --- a/src/main/resources/mixins.chatting.json +++ b/src/main/resources/mixins.chatting.json @@ -1,6 +1,6 @@ { "compatibilityLevel": "JAVA_8", - "minVersion": "0.8", + "minVersion": "0.7", "package": "cc.woverflow.chatting.mixin", "refmap": "mixins.${id}.refmap.json", "mixins": [ |