aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-05-24 14:57:02 +0200
committerGitHub <noreply@github.com>2024-05-24 14:57:02 +0200
commitf7146145de7a3d597ee9203ccea95d7535d5a4e1 (patch)
tree861920ca3564797105ca0e0d47b778978b5ee3a5 /src/main/java/at/hannibal2/skyhanni
parent5f68fb1cab508c0a437624b888a830b496f3e3fd (diff)
downloadskyhanni-f7146145de7a3d597ee9203ccea95d7535d5a4e1.tar.gz
skyhanni-f7146145de7a3d597ee9203ccea95d7535d5a4e1.tar.bz2
skyhanni-f7146145de7a3d597ee9203ccea95d7535d5a4e1.zip
Fix: Correct shouldAllowLink (#1855)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderableTooltips.kt3
2 files changed, 10 insertions, 8 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt
index b26d88c4b..d893cef52 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt
@@ -151,7 +151,6 @@ interface Renderable {
override fun render(posX: Int, posY: Int) {
if (isHovered(posX, posY) && condition() &&
shouldAllowLink(true, bypassChecks) && (button - 100).isKeyClicked()
- && !NEUItems.neuHasFocus() && Minecraft.getMinecraft().currentScreen !is GuiIngameMenu
) {
onClick()
}
@@ -232,6 +231,7 @@ interface Renderable {
if (bypassChecks) {
return isGuiScreen
}
+ val inMenu = Minecraft.getMinecraft().currentScreen !is GuiIngameMenu
val isGuiPositionEditor = Minecraft.getMinecraft().currentScreen !is GuiPositionEditor
val isNotInSignAndOnSlot = if (Minecraft.getMinecraft().currentScreen !is GuiEditSign) {
ToolTipData.lastSlot == null || GuiData.preDrawEventCanceled
@@ -240,10 +240,11 @@ interface Renderable {
val openGui = Minecraft.getMinecraft().currentScreen?.javaClass?.name ?: "none"
val isInNeuPv = openGui == "io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer"
+ val neuFocus = NEUItems.neuHasFocus()
val isInSkyTilsPv = openGui == "gg.skytils.skytilsmod.gui.profile.ProfileGui"
- val result = isGuiScreen && isGuiPositionEditor && isNotInSignAndOnSlot && isConfigScreen &&
- !isInNeuPv && !isInSkyTilsPv
+ val result = isGuiScreen && isGuiPositionEditor && inMenu && isNotInSignAndOnSlot && isConfigScreen &&
+ !isInNeuPv && !isInSkyTilsPv && !neuFocus
if (debug) {
if (!result) {
@@ -251,9 +252,11 @@ interface Renderable {
logger.log("blocked link because:")
if (!isGuiScreen) logger.log("isGuiScreen")
if (!isGuiPositionEditor) logger.log("isGuiPositionEditor")
+ if (!inMenu) logger.log("inMenu")
if (!isNotInSignAndOnSlot) logger.log("isNotInSignAndOnSlot")
if (!isConfigScreen) logger.log("isConfigScreen")
if (isInNeuPv) logger.log("isInNeuPv")
+ if (neuFocus) logger.log("neuFocus")
if (isInSkyTilsPv) logger.log("isInSkyTilsPv")
logger.log("")
} else {
@@ -595,6 +598,7 @@ interface Renderable {
scrollValue: ScrollValue = ScrollValue(),
velocity: Double = 2.0,
button: Int? = null,
+ bypassChecks: Boolean = false,
horizontalAlign: HorizontalAlignment = HorizontalAlignment.LEFT,
verticalAlign: VerticalAlignment = VerticalAlignment.TOP,
) = object : Renderable {
@@ -617,7 +621,7 @@ interface Renderable {
override fun render(posX: Int, posY: Int) {
scroll.update(
- isHovered(posX, posY)
+ isHovered(posX, posY) && shouldAllowLink(true, bypassChecks)
)
var renderY = 0
@@ -651,6 +655,7 @@ interface Renderable {
xPadding: Int = 1,
yPadding: Int = 0,
hasHeader: Boolean = false,
+ bypassChecks: Boolean = false,
horizontalAlign: HorizontalAlignment = HorizontalAlignment.LEFT,
verticalAlign: VerticalAlignment = VerticalAlignment.TOP,
) = object : Renderable {
@@ -677,7 +682,7 @@ interface Renderable {
override fun render(posX: Int, posY: Int) {
scroll.update(
- isHovered(posX, posY)
+ isHovered(posX, posY) && shouldAllowLink(true, bypassChecks)
)
var renderY = 0
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderableTooltips.kt b/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderableTooltips.kt
index 61149866b..14e4fde13 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderableTooltips.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderableTooltips.kt
@@ -2,12 +2,10 @@ package at.hannibal2.skyhanni.utils.renderables
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LorenzColor
-import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.RenderUtils
import at.hannibal2.skyhanni.utils.renderables.RenderableUtils.renderXAligned
import io.github.moulberry.notenoughupdates.util.Utils
import net.minecraft.client.Minecraft
-import net.minecraft.client.gui.GuiIngameMenu
import net.minecraft.client.gui.ScaledResolution
import net.minecraft.client.renderer.GlStateManager
import net.minecraft.client.renderer.RenderHelper
@@ -43,7 +41,6 @@ object RenderableTooltips {
val tooltip = tooltip ?: return
val tips = tooltip.tips
if (tips.isEmpty()) return
- if (NEUItems.neuHasFocus() || Minecraft.getMinecraft().currentScreen is GuiIngameMenu) return
val x = Utils.getMouseX() + 12
val y = Utils.getMouseY() - if (tips.size > 1) 2 else -7