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 /src/main/kotlin/cc/woverflow/chatting/gui/components | |
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
Diffstat (limited to 'src/main/kotlin/cc/woverflow/chatting/gui/components')
5 files changed, 21 insertions, 70 deletions
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 |