aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin')
-rw-r--r--src/main/kotlin/dulkirmod/DulkirMod.kt2
-rw-r--r--src/main/kotlin/dulkirmod/features/ScalableTooltips.kt47
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()