diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-05-02 09:25:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-02 09:25:07 +0200 |
commit | b748f088328deaaf91f35ade7bd2fcb094c20d0d (patch) | |
tree | fec83463bcfb8a2fd92167126e4af45a992b30f8 /src/main/java/at/hannibal2/skyhanni | |
parent | b0f1bc0b14c022876ec2a802bc10025e34cfe761 (diff) | |
download | skyhanni-b748f088328deaaf91f35ade7bd2fcb094c20d0d.tar.gz skyhanni-b748f088328deaaf91f35ade7bd2fcb094c20d0d.tar.bz2 skyhanni-b748f088328deaaf91f35ade7bd2fcb094c20d0d.zip |
Fix: Estimated Item Value not visible in PV (#1620)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Co-authored-by: Cal <cwolfson58@gmail.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
4 files changed, 21 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt b/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt index c9bfd61cb..709961ce6 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt @@ -1,14 +1,25 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.LorenzToolTipEvent +import at.hannibal2.skyhanni.events.item.ItemHoverEvent import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import net.minecraft.inventory.Slot +import net.minecraft.item.ItemStack // Please use LorenzToolTipEvent over ItemTooltipEvent if no special EventPriority is necessary object ToolTipData { + fun getTooltip(stack: ItemStack, toolTip: MutableList<String>): List<String> { + onHover(stack, toolTip) + return onTooltip(toolTip) + } + + private fun onHover(stack: ItemStack, toolTip: MutableList<String>) { + ItemHoverEvent(stack, toolTip).postAndCatch() + } + fun onTooltip(toolTip: MutableList<String>): List<String> { val slot = lastSlot ?: return toolTip val itemStack = slot.stack ?: return toolTip diff --git a/src/main/java/at/hannibal2/skyhanni/events/item/ItemHoverEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/item/ItemHoverEvent.kt new file mode 100644 index 000000000..2b3041d62 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/item/ItemHoverEvent.kt @@ -0,0 +1,6 @@ +package at.hannibal2.skyhanni.events.item + +import at.hannibal2.skyhanni.events.LorenzEvent +import net.minecraft.item.ItemStack + +class ItemHoverEvent(val itemStack: ItemStack, val toolTip: List<String>) : LorenzEvent() 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 c79c1f8a4..299fe6ec5 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 @@ -7,10 +7,10 @@ import at.hannibal2.skyhanni.data.jsonobjects.repo.neu.NeuReforgeStoneJson import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent -import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.events.NeuRepositoryReloadEvent import at.hannibal2.skyhanni.events.RenderItemTooltipEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent +import at.hannibal2.skyhanni.events.item.ItemHoverEvent import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList @@ -63,7 +63,7 @@ object EstimatedItemValue { } @SubscribeEvent - fun onTooltip(event: LorenzToolTipEvent) { + fun onTooltip(event: ItemHoverEvent) { if (!LorenzUtils.inSkyBlock) return if (!config.enabled) return diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinItemStack.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinItemStack.java index 8eb61b979..75c94b0b6 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinItemStack.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinItemStack.java @@ -25,6 +25,7 @@ public class MixinItemStack implements ItemStackCachedData { @Inject(method = "getTooltip", at = @At("RETURN")) public void getTooltip(EntityPlayer playerIn, boolean advanced, CallbackInfoReturnable<List<String>> ci) { - ToolTipData.INSTANCE.onTooltip(ci.getReturnValue()); + ItemStack stack = (ItemStack) (Object) this; + ToolTipData.INSTANCE.getTooltip(stack, ci.getReturnValue()); } } |