aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-08 13:23:09 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-08 13:23:09 +0100
commit22f6efe16fb49db123d10cf0117a85feea197ce1 (patch)
treeb6392c2617c6f443fde225e325f11ed34f77344e /src/main/java/at/hannibal2/skyhanni/features
parent6aaf8e71d1264b7e2205bce0f270a5adc6cda0ac (diff)
downloadskyhanni-22f6efe16fb49db123d10cf0117a85feea197ce1.tar.gz
skyhanni-22f6efe16fb49db123d10cf0117a85feea197ce1.tar.bz2
skyhanni-22f6efe16fb49db123d10cf0117a85feea197ce1.zip
Use LorenzToolTipEvent over ItemTooltipEvent if possible.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardTips.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenNextPlotPrice.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt6
11 files changed, 28 insertions, 32 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt
index 38e012128..5df99f31e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt
@@ -2,12 +2,12 @@ package at.hannibal2.skyhanni.features.bazaar
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.OSUtils
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
-import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.util.regex.Pattern
@@ -20,10 +20,10 @@ class BazaarCancelledBuyOrderClipboard {
private var latestAmount: String? = null
@SubscribeEvent
- fun onTooltip(event: ItemTooltipEvent) {
+ fun onTooltip(event: LorenzToolTipEvent) {
if (!isEnabled()) return
- val stack = event.itemStack ?: return
+ val stack = event.itemStack
val name = stack.name ?: return
if (!name.contains("Cancel Order")) return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardTips.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardTips.kt
index a8d62579c..b0a0cd42e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardTips.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardTips.kt
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.bingo.card
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.GuiContainerEvent
+import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.features.bingo.BingoAPI
import at.hannibal2.skyhanni.features.bingo.BingoAPI.getTip
import at.hannibal2.skyhanni.features.bingo.card.goals.GoalType
@@ -12,14 +13,13 @@ import at.hannibal2.skyhanni.utils.RenderUtils.highlight
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.inventory.GuiContainer
import net.minecraft.inventory.ContainerChest
-import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class BingoCardTips {
private val config get() = SkyHanniMod.feature.event.bingo.bingoCard
@SubscribeEvent
- fun onItemTooltipLow(event: ItemTooltipEvent) {
+ fun onItemTooltipLow(event: LorenzToolTipEvent) {
if (!isEnabled()) return
if (InventoryUtils.openInventoryName() != "Bingo Card") return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt
index f21274a02..a99c081c1 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt
@@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.GuiContainerEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
+import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.events.RenderItemTipEvent
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName
@@ -17,7 +18,6 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraft.client.gui.inventory.GuiChest
import net.minecraft.inventory.ContainerChest
-import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class DungeonFinderFeatures {
@@ -136,11 +136,10 @@ class DungeonFinderFeatures {
}
@SubscribeEvent
- fun onItemTooltip(event: ItemTooltipEvent) {
+ fun onItemTooltip(event: LorenzToolTipEvent) {
if (!LorenzUtils.inSkyBlock) return
if (!config.coloredClassLevel) return
- if (event.toolTip == null) return
val chestName = InventoryUtils.openInventoryName()
if (chestName != "Party Finder") return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
index f65e02107..ffb08f93b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
@@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.InventoryCloseEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
+import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.events.TabListUpdateEvent
import at.hannibal2.skyhanni.features.bazaar.BazaarApi
@@ -37,7 +38,6 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.TimeUtils
import at.hannibal2.skyhanni.utils.renderables.Renderable
import io.github.moulberry.notenoughupdates.NotEnoughUpdates
-import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.util.Collections
@@ -128,11 +128,11 @@ object ComposterOverlay {
}
@SubscribeEvent
- fun onTooltip(event: ItemTooltipEvent) {
+ fun onTooltip(event: LorenzToolTipEvent) {
if (inComposterUpgrades) {
update()
for (upgrade in ComposterUpgrade.entries) {
- event.itemStack?.name?.let {
+ event.itemStack.name?.let {
if (it.contains(upgrade.displayName)) {
maxLevel = ComposterUpgrade.regex.matchMatcher(it) {
group("level")?.romanToDecimalIfNecessary() ?: 0
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt
index 3a1f9cf5e..3c27842a6 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.garden.composter
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.GuiContainerEvent
+import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils
@@ -14,14 +15,13 @@ import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.RenderUtils.highlight
import net.minecraft.client.gui.inventory.GuiChest
import net.minecraft.inventory.ContainerChest
-import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class GardenComposterInventoryFeatures {
private val config get() = GardenAPI.config.composters
@SubscribeEvent
- fun onTooltip(event: ItemTooltipEvent) {
+ fun onTooltip(event: LorenzToolTipEvent) {
if (!GardenAPI.inGarden()) return
if (!config.upgradePrice) return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt
index 683834419..f47e45bf4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt
@@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.garden.inventory
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.data.jsonobjects.repo.AnitaUpgradeCostsJson
import at.hannibal2.skyhanni.data.jsonobjects.repo.AnitaUpgradeCostsJson.Price
+import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.utils.InventoryUtils
@@ -13,7 +14,6 @@ import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
-import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class AnitaExtraFarmingFortune {
@@ -21,14 +21,12 @@ class AnitaExtraFarmingFortune {
private var levelPrice = mapOf<Int, Price>()
@SubscribeEvent
- fun onItemTooltipLow(event: ItemTooltipEvent) {
+ fun onItemTooltip(event: LorenzToolTipEvent) {
if (!config.extraFarmingFortune) return
if (InventoryUtils.openInventoryName() != "Anita") return
- val stack = event.itemStack ?: return
-
- if (!stack.displayName.contains("Extra Farming Fortune")) return
+ if (!event.itemStack.displayName.contains("Extra Farming Fortune")) return
val anitaUpgrade = GardenAPI.storage?.fortune?.anitaUpgrade ?: return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt
index 6a37862a9..6c4aa6787 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt
@@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.data.GardenCropMilestones
import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter
import at.hannibal2.skyhanni.events.CropMilestoneUpdateEvent
import at.hannibal2.skyhanni.events.InventoryCloseEvent
+import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent
import at.hannibal2.skyhanni.features.garden.CropType
import at.hannibal2.skyhanni.features.garden.GardenAPI
@@ -14,7 +15,6 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.round
import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.StringUtils
-import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class GardenCropMilestoneInventory {
@@ -52,12 +52,11 @@ class GardenCropMilestoneInventory {
}
@SubscribeEvent
- fun onItemTooltipLow(event: ItemTooltipEvent) {
+ fun onItemTooltip(event: LorenzToolTipEvent) {
if (!LorenzUtils.inSkyBlock) return
if (!config.tooltipTweak.cropMilestoneTotalProgress) return
- val itemStack = event.itemStack ?: return
- val crop = GardenCropMilestones.getCropTypeByLore(itemStack) ?: return
+ val crop = GardenCropMilestones.getCropTypeByLore(event.itemStack) ?: return
val tier = GardenCropMilestones.getTierForCropCount(crop.getCounter(), crop)
if (tier > 20) return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenNextPlotPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenNextPlotPrice.kt
index bd2a3b5a3..9a4deaf2f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenNextPlotPrice.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenNextPlotPrice.kt
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.features.garden.inventory
+import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils
@@ -7,13 +8,12 @@ import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.NumberUtil
-import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class GardenNextPlotPrice {
@SubscribeEvent
- fun onTooltip(event: ItemTooltipEvent) {
+ fun onTooltip(event: LorenzToolTipEvent) {
if (!GardenAPI.inGarden()) return
if (!GardenAPI.config.plotPrice) return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt
index 787cbe059..6f3ce2ce7 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt
@@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.minion
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.jsonobjects.repo.MinionXPJson
import at.hannibal2.skyhanni.events.IslandChangeEvent
+import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.events.MinionCloseEvent
import at.hannibal2.skyhanni.events.MinionOpenEvent
import at.hannibal2.skyhanni.events.MinionStorageOpenEvent
@@ -19,7 +20,6 @@ import net.minecraft.block.BlockChest
import net.minecraft.client.Minecraft
import net.minecraft.item.Item
import net.minecraft.item.ItemStack
-import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.util.EnumMap
@@ -147,7 +147,7 @@ class MinionXp {
}
@SubscribeEvent
- fun onItemTooltipEvent(event: ItemTooltipEvent) {
+ fun onItemTooltipEvent(event: LorenzToolTipEvent) {
if (!LorenzUtils.inSkyBlock) return
if (!config.xpDisplay) return
when {
@@ -166,7 +166,7 @@ class MinionXp {
}
}
- private fun addXpInfoToTooltip(event: ItemTooltipEvent) {
+ private fun addXpInfoToTooltip(event: LorenzToolTipEvent) {
xpItemMap[toPrimitiveItemStack(event.itemStack)]?.let {
event.toolTip.add("")
event.toolTip.add(it)
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 cefac74a8..f46b98a7d 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
@@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
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.RenderItemTooltipEvent
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull
@@ -27,7 +28,6 @@ import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer
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 kotlin.math.roundToLong
@@ -58,7 +58,7 @@ object EstimatedItemValue {
}
@SubscribeEvent
- fun onTooltip(event: ItemTooltipEvent) {
+ fun onTooltip(event: LorenzToolTipEvent) {
if (!LorenzUtils.inSkyBlock) return
if (!config.enabled) return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt
index 47c002c92..256349220 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt
@@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
+import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.features.rift.RiftAPI
import at.hannibal2.skyhanni.features.rift.RiftAPI.motesNpcPrice
import at.hannibal2.skyhanni.utils.InventoryUtils
@@ -22,7 +23,6 @@ import at.hannibal2.skyhanni.utils.RenderUtils.highlight
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.renderables.Renderable
-import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -71,10 +71,10 @@ class ShowMotesNpcSellPrice {
}
@SubscribeEvent
- fun onItemTooltipLow(event: ItemTooltipEvent) {
+ fun onItemTooltipLow(event: LorenzToolTipEvent) {
if (!isShowPriceEnabled()) return
- val itemStack = event.itemStack ?: return
+ val itemStack = event.itemStack
val baseMotes = itemStack.motesNpcPrice() ?: return
val burgerStacks = config.burgerStacks