aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt24
2 files changed, 25 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt
index 4f3110789..2f7617924 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt
@@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.isRancherSign
import at.hannibal2.skyhanni.utils.NEUItems
+import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.inventory.GuiChest
import net.minecraft.client.gui.inventory.GuiEditSign
@@ -26,7 +27,7 @@ class GuiEditManager {
if (isInGui()) return
Minecraft.getMinecraft().currentScreen?.let {
- if (it !is GuiInventory && it !is GuiChest && it !is GuiEditSign) return
+ if (it !is GuiInventory && it !is GuiChest && it !is GuiEditSign && it !is GuiProfileViewer) return
if (it is GuiEditSign && !it.isRancherSign()) return
}
@@ -95,4 +96,4 @@ class GuiEditManager {
}
}
-class Vector2i(val x: Int, val y: Int) \ No newline at end of file
+class Vector2i(val x: Int, val y: Int)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
index e9ec914ee..7dfd5656a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
@@ -66,8 +66,10 @@ import io.github.moulberry.notenoughupdates.events.RepositoryReloadEvent
import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer
import io.github.moulberry.notenoughupdates.recipes.Ingredient
import io.github.moulberry.notenoughupdates.util.Constants
+import net.minecraft.client.Minecraft
import net.minecraft.init.Items
import net.minecraft.item.ItemStack
+import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.io.File
import java.util.Locale
@@ -97,13 +99,28 @@ object EstimatedItemValue {
}
@SubscribeEvent
- fun onRenderOverlay(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) {
+ fun onTooltip(event: ItemTooltipEvent) {
+ if (!LorenzUtils.inSkyBlock) return
+ if (!config.enabled) return
+
+ if (Minecraft.getMinecraft().currentScreen is GuiProfileViewer) {
+ updateItem(event.itemStack)
+ tryRendering()
+ }
+ }
+
+ private fun tryRendering() {
currentlyShowing = checkCurrentlyVisible()
if (!currentlyShowing) return
config.itemPriceDataPos.renderStringsAndItems(display, posLabel = "Estimated Item Value")
}
+ @SubscribeEvent
+ fun onRenderOverlay(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) {
+ tryRendering()
+ }
+
private fun checkCurrentlyVisible(): Boolean {
if (!LorenzUtils.inSkyBlock) return false
if (!config.enabled) return false
@@ -132,7 +149,10 @@ object EstimatedItemValue {
if (!LorenzUtils.inSkyBlock) return
if (!config.enabled) return
- val item = event.stack
+ updateItem(event.stack)
+ }
+
+ private fun updateItem(item: ItemStack) {
val oldData = cache[item]
if (oldData != null) {
display = oldData