aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-03 22:14:45 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-03 22:14:45 +0100
commita6a8d13e007237568747e9dfd5d5b6795cfbb5de (patch)
treea107ce86571a813a6816cb19fcf39604f9fa1da8 /src/main/java/at/hannibal2/skyhanni/features
parent67a7b2b59b09b49d1fe9ea18611d42cac2667547 (diff)
downloadskyhanni-a6a8d13e007237568747e9dfd5d5b6795cfbb5de.tar.gz
skyhanni-a6a8d13e007237568747e9dfd5d5b6795cfbb5de.tar.bz2
skyhanni-a6a8d13e007237568747e9dfd5d5b6795cfbb5de.zip
Added Estimated Item Value support to NEU Profile Viewer
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt24
1 files changed, 22 insertions, 2 deletions
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