diff options
author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-05-08 11:32:56 +0700 |
---|---|---|
committer | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-05-08 11:32:56 +0700 |
commit | f91dbeef8de0913d584ff797efe8ba0d0d1833c0 (patch) | |
tree | 42d6e922918c2cd3a1f03526639274819e3a87f9 | |
parent | 5a7c1803dfeeda9a88dc4c290d60e907a43aeebd (diff) | |
download | Chatting-f91dbeef8de0913d584ff797efe8ba0d0d1833c0.tar.gz Chatting-f91dbeef8de0913d584ff797efe8ba0d0d1833c0.tar.bz2 Chatting-f91dbeef8de0913d584ff797efe8ba0d0d1833c0.zip |
confirm before wiping
-rw-r--r-- | gradle.properties | 2 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chatting/gui/components/ClearButton.kt | 25 |
2 files changed, 25 insertions, 2 deletions
diff --git a/gradle.properties b/gradle.properties index b79423e..c9fd914 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ org.gradle.jvmargs=-Xmx2G mod_name = Chatting mod_id = chatting -mod_version = 1.4.0-alpha1 +mod_version = 1.4.0-beta2 loom.platform = forge
\ 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 3035a98..2e46974 100644 --- a/src/main/kotlin/cc/woverflow/chatting/gui/components/ClearButton.kt +++ b/src/main/kotlin/cc/woverflow/chatting/gui/components/ClearButton.kt @@ -1,18 +1,41 @@ package cc.woverflow.chatting.gui.components 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() { - Minecraft.getMinecraft().ingameGUI.chatGUI.clearChatMessages() + 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}" + + onConfirm = { + Minecraft.getMinecraft().ingameGUI.chatGUI.clearChatMessages() + restorePreviousScreen() + } + onDeny = { restorePreviousScreen() } + } childOf window + } + }) } override fun drawButton(mc: Minecraft, mouseX: Int, mouseY: Int) { |