diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-24 19:37:10 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-24 19:37:10 +0100 |
commit | 7d7b2aaf85592840da824c6ce29c992cd669c84c (patch) | |
tree | a0b48ac677694de385a7435cee4fb0602dbdfc9b /src/main/java/at/hannibal2/skyhanni/config | |
parent | bb35657f6c5869f04c4ce633446a1809a07a0c07 (diff) | |
download | skyhanni-7d7b2aaf85592840da824c6ce29c992cd669c84c.tar.gz skyhanni-7d7b2aaf85592840da824c6ce29c992cd669c84c.tar.bz2 skyhanni-7d7b2aaf85592840da824c6ce29c992cd669c84c.zip |
Added support for editing gui elements what are only visible white in an inv
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/config')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt index d09fcbc25..a2eea8f3a 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt @@ -35,11 +35,9 @@ import java.io.IOException class GuiPositionEditor( overlayPositions: LinkedHashMap<Position, Position>, - closedCallback: Runnable, ) : GuiScreen() { private val positions: ArrayList<Position> private val originalPositions: ArrayList<Position> - private val closedCallback: Runnable private var grabbedX = 0 private var grabbedY = 0 private var clickedPos = -1 @@ -54,12 +52,10 @@ class GuiPositionEditor( } positions = pos originalPositions = ogPos - this.closedCallback = closedCallback } override fun onGuiClosed() { super.onGuiClosed() - closedCallback.run() clickedPos = -1 } @@ -85,9 +81,8 @@ class GuiPositionEditor( } drawDefaultBackground() - val text = "§cSkyHanni Position Editor" Utils.drawStringCentered( - text, Minecraft.getMinecraft().fontRendererObj, + "§cSkyHanni Position Editor", Minecraft.getMinecraft().fontRendererObj, (scaledResolution.scaledWidth / 2).toFloat(), 8f, true, 0xffffff ) @@ -112,17 +107,18 @@ class GuiPositionEditor( elementHeight = position.getDummySize().y.toInt() drawRect(x - border, y - border, x + elementWidth + border * 2, y + elementHeight + border * 2, -0x7fbfbfc0) + + if (hoveredPos == -1) { + hoveredPos = clickedPos + } + if (hoveredPos != -1) { val pos = positions[hoveredPos] - Utils.drawStringCentered( - "§b" + pos.internalName, Minecraft.getMinecraft().fontRendererObj, - (scaledResolution.scaledWidth / 2).toFloat(), 18f, true, 0xffffff - ) + Utils.drawStringCentered("§b" + pos.internalName, Minecraft.getMinecraft().fontRendererObj, + (scaledResolution.scaledWidth / 2).toFloat(), 18f, true, 0xffffff) val location = "§7x: §e${pos.rawX}§7, y: §e${pos.rawY}" - Utils.drawStringCentered( - location, Minecraft.getMinecraft().fontRendererObj, - (scaledResolution.scaledWidth / 2).toFloat(), 28f, true, 0xffffff - ) + Utils.drawStringCentered(location, Minecraft.getMinecraft().fontRendererObj, + (scaledResolution.scaledWidth / 2).toFloat(), 28f, true, 0xffffff) } } GlStateManager.popMatrix() |