diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-11 04:09:39 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-11 04:09:39 +0100 |
commit | ddb85f57984ac76e766bd93b49bd356b11a0a07a (patch) | |
tree | 1312e3261fe61164178ee6668b5168af85d15e62 /src/main/java/at/hannibal2/skyhanni/features | |
parent | 219d26a54a3740dd0d3addf34a79c84275854690 (diff) | |
download | skyhanni-ddb85f57984ac76e766bd93b49bd356b11a0a07a.tar.gz skyhanni-ddb85f57984ac76e766bd93b49bd356b11a0a07a.tar.bz2 skyhanni-ddb85f57984ac76e766bd93b49bd356b11a0a07a.zip |
Use garden api more often
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
5 files changed, 13 insertions, 27 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenInventoryNumbers.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenInventoryNumbers.kt index 1c6efdc1b..6655fdf10 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenInventoryNumbers.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenInventoryNumbers.kt @@ -1,11 +1,9 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNeeded import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.regex.Pattern @@ -17,7 +15,7 @@ class GardenInventoryNumbers { @SubscribeEvent fun onRenderItemTip(event: RenderItemTipEvent) { - if (!isEnabled()) return + if (!GardenAPI.inGarden()) return if (InventoryUtils.openInventoryName() == "Crop Milestones") { if (!SkyHanniMod.feature.garden.numberCropMilestone) return @@ -40,6 +38,4 @@ class GardenInventoryNumbers { .forEach { event.stackTip = "" + it } } } - - private fun isEnabled() = LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == IslandType.GARDEN }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextPlotPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextPlotPrice.kt index c2a52e7f0..abea33203 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextPlotPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextPlotPrice.kt @@ -1,9 +1,11 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.IslandType -import at.hannibal2.skyhanni.utils.* +import at.hannibal2.skyhanni.utils.InventoryUtils +import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.name +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 @@ -11,7 +13,7 @@ class GardenNextPlotPrice { @SubscribeEvent fun onTooltip(event: ItemTooltipEvent) { - if (!isEnabled()) return + if (!GardenAPI.inGarden()) return if (!SkyHanniMod.feature.garden.plotPrice) return if (InventoryUtils.openInventoryName() != "Configure Plots") return @@ -42,6 +44,4 @@ class GardenNextPlotPrice { } } } - - private fun isEnabled() = LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == IslandType.GARDEN }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt index ad1718ed6..63dc2dd1c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt @@ -1,7 +1,6 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.ScoreboardData.Companion.sidebarLinesFormatted import at.hannibal2.skyhanni.data.SendTitleHelper import at.hannibal2.skyhanni.events.* @@ -41,7 +40,7 @@ class GardenVisitorFeatures { fun onInventoryOpen(event: InventoryOpenEvent) { inVisitorInventory = false - if (!isEnabled()) return + if (!GardenAPI.inGarden()) return val npcItem = event.inventoryItems[13] ?: return val lore = npcItem.getLore() var isVisitor = false @@ -125,7 +124,7 @@ class GardenVisitorFeatures { @SubscribeEvent fun onTooltip(event: ItemTooltipEvent) { - if (!isEnabled()) return + if (!GardenAPI.inGarden()) return if (!inVisitorInventory) return val name = event.itemStack.name ?: return if (name != "§aAccept Offer") return @@ -208,7 +207,7 @@ class GardenVisitorFeatures { @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { - if (!isEnabled()) return + if (!GardenAPI.inGarden()) return if (!config.visitorNeedsDisplay && !config.visitorHighlight) return if (tick++ % 30 != 0) return @@ -221,7 +220,7 @@ class GardenVisitorFeatures { @SubscribeEvent fun onTabListUpdate(event: TabListUpdateEvent) { - if (!isEnabled()) return + if (!GardenAPI.inGarden()) return var found = false val visitorsInTab = mutableListOf<String>() for (line in event.tabList) { @@ -334,7 +333,7 @@ class GardenVisitorFeatures { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent) { - if (!isEnabled()) return + if (!GardenAPI.inGarden()) return if (!config.visitorNeedsDisplay) return if (config.visitorNeedsOnlyWhenClose) { @@ -346,6 +345,4 @@ class GardenVisitorFeatures { } class Visitor(var entityId: Int, var done: Boolean = false, val items: MutableMap<String, Int> = mutableMapOf()) - - private fun isEnabled() = LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == IslandType.GARDEN }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorTimer.kt index f19762920..b3f67f956 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorTimer.kt @@ -1,10 +1,8 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.TimeUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -64,7 +62,5 @@ class GardenVisitorTimer { SkyHanniMod.feature.garden.visitorTimerPos.renderString(render) } - private fun isEnabled() = LorenzUtils.inSkyBlock && - SkyHanniMod.feature.garden.visitorTimerEnabled && - LorenzUtils.skyBlockIsland == IslandType.GARDEN + private fun isEnabled() = GardenAPI.inGarden() && SkyHanniMod.feature.garden.visitorTimerEnabled }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt index fce2b03f8..d1d9119cd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt @@ -1,14 +1,12 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryOpenEvent import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName 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.LorenzUtils.sortedDesc import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil @@ -96,6 +94,5 @@ class SkyMartBestProfit { } } - private fun isEnabled() = - LorenzUtils.inSkyBlock && config.skyMartCopperPrice && LorenzUtils.skyBlockIsland == IslandType.GARDEN + private fun isEnabled() = GardenAPI.inGarden() && config.skyMartCopperPrice }
\ No newline at end of file |