summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/config
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-08-11 13:22:24 +0200
committerGitHub <noreply@github.com>2024-08-11 13:22:24 +0200
commit8903d9fa783455558d20eb32a2038c87ab5913be (patch)
tree2c925d0ecf625f8e8a5505960d0d51d2201e88e2 /src/main/java/at/hannibal2/skyhanni/config
parenta8d4861b051298cc8a1db3c5210a32abab866b1e (diff)
downloadskyhanni-8903d9fa783455558d20eb32a2038c87ab5913be.tar.gz
skyhanni-8903d9fa783455558d20eb32a2038c87ab5913be.tar.bz2
skyhanni-8903d9fa783455558d20eb32a2038c87ab5913be.zip
Add multi version preprocessor (#2283)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/config')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt12
1 files changed, 7 insertions, 5 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 db6ca3c30..817defc5f 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
@@ -28,6 +28,8 @@ import at.hannibal2.skyhanni.mixins.transformers.gui.AccessorGuiContainer
import at.hannibal2.skyhanni.utils.GuiRenderUtils
import at.hannibal2.skyhanni.utils.KeyboardManager
import at.hannibal2.skyhanni.utils.LorenzUtils.round
+import at.hannibal2.skyhanni.utils.compat.GuiScreenUtils
+import at.hannibal2.skyhanni.utils.compat.SkyhanniBaseScreen
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.GuiScreen
import net.minecraft.client.gui.ScaledResolution
@@ -41,7 +43,7 @@ class GuiPositionEditor(
private val positions: List<Position>,
private val border: Int,
private val oldScreen: GuiContainer? = null,
-) : GuiScreen() {
+) : SkyhanniBaseScreen() {
private var grabbedX = 0
private var grabbedY = 0
@@ -147,15 +149,15 @@ class GuiPositionEditor(
return hoveredPos
}
- private fun getScaledHeight() = ScaledResolution(Minecraft.getMinecraft()).scaledHeight
- private fun getScaledWidth() = ScaledResolution(Minecraft.getMinecraft()).scaledWidth
+ private fun getScaledHeight() = GuiScreenUtils.scaledWindowHeight
+ private fun getScaledWidth() = GuiScreenUtils.scaledWindowHeight
@Throws(IOException::class)
override fun mouseClicked(originalX: Int, priginalY: Int, mouseButton: Int) {
super.mouseClicked(originalX, priginalY, mouseButton)
- val mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth
- val mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1
+ val mouseX = GuiScreenUtils.mouseX
+ val mouseY = GuiScreenUtils.mouseY
for (i in positions.indices.reversed()) {
val position = positions[i]
val elementWidth = position.getDummySize().x