aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-02-20 18:32:31 +0100
committerGitHub <noreply@github.com>2024-02-20 18:32:31 +0100
commit3ab20a18d4a2be4cdba1f16cfa3d5a9276227042 (patch)
tree42ea557a74f43c991b28cfca439d952ceb803858 /src/main/java/at/hannibal2/skyhanni/features
parent2d1a900fd40150cff686ea4f2c260d120140d653 (diff)
downloadskyhanni-3ab20a18d4a2be4cdba1f16cfa3d5a9276227042.tar.gz
skyhanni-3ab20a18d4a2be4cdba1f16cfa3d5a9276227042.tar.bz2
skyhanni-3ab20a18d4a2be4cdba1f16cfa3d5a9276227042.zip
Added option to only show Ender Node tracker while holding a pickaxe. #984
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt
index adb0edd38..9ca631d39 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt
@@ -15,8 +15,12 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut
import at.hannibal2.skyhanni.utils.ConditionalUtils.afterChange
import at.hannibal2.skyhanni.utils.ConfigUtils
+import at.hannibal2.skyhanni.utils.InventoryUtils
+import at.hannibal2.skyhanni.utils.ItemCategory
+import at.hannibal2.skyhanni.utils.ItemCategory.Companion.containsItem
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull
import at.hannibal2.skyhanni.utils.NEUItems.getPriceOrNull
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
@@ -62,9 +66,8 @@ object EnderNodeTracker {
@SubscribeEvent
fun onChat(event: LorenzChatEvent) {
- if (!config.enabled) return
+ if (!isEnabled()) return
if (!ProfileStorageData.loaded) return
- if (!isInTheEnd()) return
// don't call removeColor because we want to distinguish enderman pet rarity
val message = event.message.trim()
@@ -102,8 +105,7 @@ object EnderNodeTracker {
@SubscribeEvent
fun onIslandChange(event: IslandChangeEvent) {
- if (!config.enabled) return
- if (event.newIsland != IslandType.THE_END) return
+ if (!isEnabled()) return
miteGelInInventory = Minecraft.getMinecraft().thePlayer.inventory.mainInventory
.filter { it?.getInternalNameOrNull() == EnderNode.MITE_GEL.internalName }
.sumOf { it.stackSize }
@@ -111,9 +113,8 @@ object EnderNodeTracker {
@SubscribeEvent
fun onSackChange(event: SackChangeEvent) {
- if (!config.enabled) return
+ if (!isEnabled()) return
if (!ProfileStorageData.loaded) return
- if (!isInTheEnd()) return
val change = event.sackChanges
.firstOrNull { it.internalName == EnderNode.MITE_GEL.internalName && it.delta > 0 }
@@ -126,8 +127,7 @@ object EnderNodeTracker {
@SubscribeEvent
fun onInventoryUpdate(event: OwnInventoryItemUpdateEvent) {
- if (!config.enabled) return
- if (!isInTheEnd()) return
+ if (!isEnabled()) return
if (!ProfileStorageData.loaded) return
val newMiteGelInInventory = Minecraft.getMinecraft().thePlayer.inventory.mainInventory
@@ -144,8 +144,7 @@ object EnderNodeTracker {
@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent) {
- if (!config.enabled) return
- if (!isInTheEnd()) return
+ if (!isEnabled()) return
tracker.renderDisplay(config.position)
}
@@ -184,7 +183,10 @@ object EnderNodeTracker {
return newProfit
}
- private fun isInTheEnd() = LorenzUtils.skyBlockArea == "The End"
+ private fun isEnabled() = IslandType.THE_END.isInIsland() && config.enabled &&
+ (!config.onlyPickaxe || hasItemInHand())
+
+ private fun hasItemInHand() = ItemCategory.miningTools.containsItem(InventoryUtils.getItemInHand())
private fun isEnderArmor(displayName: EnderNode) = when (displayName) {
EnderNode.END_HELMET,