diff options
author | inglettronald <inglettronald@gmail.com> | 2023-01-30 13:15:34 -0600 |
---|---|---|
committer | inglettronald <inglettronald@gmail.com> | 2023-01-30 13:15:34 -0600 |
commit | 3c820cd5c1933d1d6a131203be5766b543613d5d (patch) | |
tree | f23aca35d8377f3395214e83677f0f3f2d21ebec /src/main/kotlin | |
parent | d87f25e4b82bd7bd2c15943c23c685cafefad20f (diff) | |
download | DulkirMod-3c820cd5c1933d1d6a131203be5766b543613d5d.tar.gz DulkirMod-3c820cd5c1933d1d6a131203be5766b543613d5d.tar.bz2 DulkirMod-3c820cd5c1933d1d6a131203be5766b543613d5d.zip |
versioning, remove print statement, and fix some scrolling func
Diffstat (limited to 'src/main/kotlin')
-rw-r--r-- | src/main/kotlin/dulkirmod/DulkirMod.kt | 2 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/features/ScalableTooltips.kt | 47 |
2 files changed, 26 insertions, 23 deletions
diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt index 7022105..ab11e9e 100644 --- a/src/main/kotlin/dulkirmod/DulkirMod.kt +++ b/src/main/kotlin/dulkirmod/DulkirMod.kt @@ -121,7 +121,7 @@ class DulkirMod { companion object { const val MOD_ID = "dulkirmod" const val MOD_NAME = "Dulkir Mod" - const val MOD_VERSION = "1.1.4" + const val MOD_VERSION = "1.1.5" const val CHAT_PREFIX = "§f<§3DulkirMod§f>" val mc: Minecraft = Minecraft.getMinecraft() diff --git a/src/main/kotlin/dulkirmod/features/ScalableTooltips.kt b/src/main/kotlin/dulkirmod/features/ScalableTooltips.kt index e471849..7d1d623 100644 --- a/src/main/kotlin/dulkirmod/features/ScalableTooltips.kt +++ b/src/main/kotlin/dulkirmod/features/ScalableTooltips.kt @@ -1,8 +1,10 @@ package dulkirmod.features +import dulkirmod.DulkirMod.Companion.mc import dulkirmod.config.Config import net.minecraft.client.Minecraft import net.minecraft.client.gui.FontRenderer +import net.minecraft.client.gui.GuiChat import net.minecraft.client.renderer.GlStateManager import net.minecraft.client.renderer.RenderHelper import net.minecraft.item.ItemStack @@ -30,30 +32,31 @@ object ScalableTooltips { if(textLines.isEmpty()) return true // Calculate the amount of translation that should be applied based on how much the user has scrolled + // Only allows the user to scroll if you are NOT inside a chat GUI. val eventDWheel = Mouse.getDWheel() - if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - if (eventDWheel < 0) { - scrollX += Minecraft.getMinecraft().displayWidth/192 - } else if (eventDWheel > 0) { - //Scrolling to access higher stuff - scrollX -= Minecraft.getMinecraft().displayWidth/192 + if (mc.currentScreen !is GuiChat) { + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + if (eventDWheel < 0) { + scrollX += Minecraft.getMinecraft().displayWidth / 192 + } else if (eventDWheel > 0) { + scrollX -= Minecraft.getMinecraft().displayWidth / 192 + } + } else if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) { + if (eventDWheel < 0) { + scaleScale -= .1f + } else if (eventDWheel > 0) { + scaleScale += .1f + } + } else { + if (eventDWheel < 0) { + scrollY -= Minecraft.getMinecraft().displayHeight / 108 + } else if (eventDWheel > 0) { + scrollY += Minecraft.getMinecraft().displayHeight / 108 + } } - } else if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) { - if (eventDWheel < 0) { - scaleScale -= .1f - } else if (eventDWheel > 0) { - scaleScale += .1f + if (Mouse.isButtonDown(2)) { + scaleScale = 0f } - } else { - if (eventDWheel < 0) { - scrollY -= Minecraft.getMinecraft().displayHeight/108 - } else if (eventDWheel > 0) { - //Scrolling to access higher stuff - scrollY += Minecraft.getMinecraft().displayHeight/108 - } - } - if (Mouse.isButtonDown(2)) { - scaleScale = 0f } val scale = (Config.tooltipSize + scaleScale).coerceAtLeast(0f) @@ -115,7 +118,7 @@ object ScalableTooltips { snapFlag = false } - //updates the position of x and y if it has been modified. + // updates the position of x and y if it has been modified. x = ((mouseX + 12 + scrollX) / scale).toInt() y = ((mouseY - 12 + scrollY) / scale).toInt() |