diff options
author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-01-03 11:12:54 +0700 |
---|---|---|
committer | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-01-03 11:12:54 +0700 |
commit | 487709996c22fb0dbcac792076be799a09865600 (patch) | |
tree | 5ab6f27a54d673fb057fd3eafd9a5e27816f898c /src/main/kotlin/cc/woverflow/chatting/gui/components/ScreenshotButton.kt | |
parent | df895d122a8a2ea249e686578e026c1d0a8b8c47 (diff) | |
download | Chatting-487709996c22fb0dbcac792076be799a09865600.tar.gz Chatting-487709996c22fb0dbcac792076be799a09865600.tar.bz2 Chatting-487709996c22fb0dbcac792076be799a09865600.zip |
Chattils -> Chatting (1.1.0)
Update images (ty Mo2men)
update screenshot line tooltip (ty Mo2men)
Diffstat (limited to 'src/main/kotlin/cc/woverflow/chatting/gui/components/ScreenshotButton.kt')
-rw-r--r-- | src/main/kotlin/cc/woverflow/chatting/gui/components/ScreenshotButton.kt | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/main/kotlin/cc/woverflow/chatting/gui/components/ScreenshotButton.kt b/src/main/kotlin/cc/woverflow/chatting/gui/components/ScreenshotButton.kt new file mode 100644 index 0000000..379444c --- /dev/null +++ b/src/main/kotlin/cc/woverflow/chatting/gui/components/ScreenshotButton.kt @@ -0,0 +1,35 @@ +package cc.woverflow.chatting.gui.components + +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 +import net.minecraft.client.renderer.GlStateManager +import net.minecraft.util.ResourceLocation + +class ScreenshotButton : + CleanButton(448318, { UResolution.scaledWidth - 28 }, { UResolution.scaledHeight - 27 }, 12, 12, "") { + + override fun onMousePress() { + val chat = Minecraft.getMinecraft().ingameGUI.chatGUI + if (GuiUtil.getOpenedScreen() is GuiChat) { + Chatting.screenshotChat((chat as GuiNewChatAccessor).scrollPos) + } + } + + override fun drawButton(mc: Minecraft, mouseX: Int, mouseY: Int) { + super.drawButton(mc, mouseX, mouseY) + if (visible) { + if (hovered) { + GlStateManager.color(1f, 1f, 160f / 255f) + } else { + GlStateManager.color(1f, 1f, 1f) + } + mc.textureManager.bindTexture(ResourceLocation(Chatting.ID, "screenshot.png")) + Gui.drawModalRectWithCustomSizedTexture(xPosition + 1, yPosition + 1, 0f, 0f, 10, 10, 10f, 10f) + } + } +}
\ No newline at end of file |