diff options
author | inglettronald <inglettronald@gmail.com> | 2023-01-19 13:52:33 -0600 |
---|---|---|
committer | inglettronald <inglettronald@gmail.com> | 2023-01-19 13:52:33 -0600 |
commit | d13f43266a82c81962af8471f471a7824a0bcf7b (patch) | |
tree | 916412118feac226e86fa3809f9655f624fa3c6e /src/main/kotlin/dulkirmod | |
parent | 2243e9f155d4ffa7c6fee47ff06fbaa9e4786919 (diff) | |
download | DulkirMod-d13f43266a82c81962af8471f471a7824a0bcf7b.tar.gz DulkirMod-d13f43266a82c81962af8471f471a7824a0bcf7b.tar.bz2 DulkirMod-d13f43266a82c81962af8471f471a7824a0bcf7b.zip |
bridge formatting fix and tooltip code update
Diffstat (limited to 'src/main/kotlin/dulkirmod')
-rw-r--r-- | src/main/kotlin/dulkirmod/features/ScalableTooltips.kt | 49 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/features/chat/Bridge.kt | 2 |
2 files changed, 32 insertions, 19 deletions
diff --git a/src/main/kotlin/dulkirmod/features/ScalableTooltips.kt b/src/main/kotlin/dulkirmod/features/ScalableTooltips.kt index 6b0a66f..a3ce2f1 100644 --- a/src/main/kotlin/dulkirmod/features/ScalableTooltips.kt +++ b/src/main/kotlin/dulkirmod/features/ScalableTooltips.kt @@ -14,6 +14,7 @@ object ScalableTooltips { var scrollX: Int = 0 // Checks to see if large tooltips should be snapped (for larger than can fit on screen code) var snapFlag: Boolean = true + var scaleScale: Float = 0f fun drawScaledHoveringText( textLines: List<String>, @@ -25,7 +26,35 @@ object ScalableTooltips { ): Boolean { if(!Config.scaledTooltips) return false if(textLines.isEmpty()) return true - val scale = Config.tooltipSize + + // Calculate the amount of translation that should be applied based on how much the user has scrolled + 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 + } + } 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) { + //Scrolling to access higher stuff + scrollY += Minecraft.getMinecraft().displayHeight/108 + } + } + if (Mouse.isButtonDown(2)) { + scaleScale = 0f + } + + val scale = (Config.tooltipSize + scaleScale).coerceAtLeast(0f) // Calculate the width and height of the tooltip box var width = 0 @@ -45,23 +74,6 @@ object ScalableTooltips { GlStateManager.disableLighting() GlStateManager.disableDepth() - // Calculate the amount of translation that should be applied based on how much the user has scrolled - 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 - } - } else { - if (eventDWheel < 0) { - scrollY -= Minecraft.getMinecraft().displayHeight/108 - } else if (eventDWheel > 0) { - //Scrolling to access higher stuff - scrollY += Minecraft.getMinecraft().displayHeight/108 - } - } // calculates where it wants to put the tooltip based on user input var x = ((mouseX + 12 + scrollX) / scale).toInt() @@ -139,6 +151,7 @@ object ScalableTooltips { fun resetPos() { scrollX = 0 scrollY = 0 + scaleScale = 0f snapFlag = true } }
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/features/chat/Bridge.kt b/src/main/kotlin/dulkirmod/features/chat/Bridge.kt index 6249ead..83efb98 100644 --- a/src/main/kotlin/dulkirmod/features/chat/Bridge.kt +++ b/src/main/kotlin/dulkirmod/features/chat/Bridge.kt @@ -57,7 +57,7 @@ object Bridge { "$newPrefix > $color$playerName§f: " ) event.message.siblings[1] = ChatComponentText( - event.message.siblings[1].unformattedText.replace("$playerName: ", "") + event.message.siblings[1].unformattedText.replace("$playerName » ", "") ).setChatStyle(event.message.siblings[1].chatStyle.createShallowCopy()) } } |