aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod
diff options
context:
space:
mode:
authoringlettronald <inglettronald@gmail.com>2023-01-19 13:52:33 -0600
committeringlettronald <inglettronald@gmail.com>2023-01-19 13:52:33 -0600
commitd13f43266a82c81962af8471f471a7824a0bcf7b (patch)
tree916412118feac226e86fa3809f9655f624fa3c6e /src/main/kotlin/dulkirmod
parent2243e9f155d4ffa7c6fee47ff06fbaa9e4786919 (diff)
downloadDulkirMod-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.kt49
-rw-r--r--src/main/kotlin/dulkirmod/features/chat/Bridge.kt2
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())
}
}