aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt24
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt22
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenBestCropTime.kt84
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt106
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenInventoryNumbers.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextPlotPrice.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorTimer.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt5
10 files changed, 144 insertions, 142 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt
index 940b955b8..d906be51a 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt
@@ -137,20 +137,7 @@ class HyPixelData {
}
}
- var islandType = IslandType.getBySidebarName(newIsland)
-
- if (islandType == IslandType.PRIVATE_ISLAND) {
- if (guesting) {
- islandType = IslandType.PRIVATE_ISLAND_GUEST
- }
- }
-
- if (islandType == IslandType.GARDEN) {
- if (guesting) {
- islandType = IslandType.GARDEN_GUEST
- }
- }
-
+ val islandType = getIslandType(newIsland, guesting)
if (skyBlockIsland != islandType) {
IslandChangeEvent(islandType, skyBlockIsland).postAndCatch()
if (islandType == IslandType.UNKNOWN) {
@@ -163,6 +150,15 @@ class HyPixelData {
}
}
+ private fun getIslandType(newIsland: String, guesting: Boolean): IslandType {
+ val islandType = IslandType.getBySidebarName(newIsland)
+ if (guesting) {
+ if (islandType == IslandType.PRIVATE_ISLAND) return IslandType.PRIVATE_ISLAND_GUEST
+ if (islandType == IslandType.GARDEN) return IslandType.GARDEN_GUEST
+ }
+ return islandType
+ }
+
private fun checkScoreboard(): Boolean {
val minecraft = Minecraft.getMinecraft()
val world = minecraft.theWorld ?: return false
diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt
index 95ce8823f..c499c3f34 100644
--- a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt
+++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt
@@ -38,8 +38,12 @@ abstract class LorenzEvent : Event() {
}
result
}.onFailure {
- it.printStackTrace()
- LorenzUtils.chat("§cSkyHanni caught and logged an ${it::class.simpleName ?: "error"} at ${eventName}.")
+ if (it is NoSuchMethodError) {
+ LorenzUtils.chat("§c[SkyHanni] You need to use a newer version of NotEnoughUpdates (alpha-11 or newer)! If you need help downloading it, go to the skyhanni discord.")
+ } else {
+ it.printStackTrace()
+ LorenzUtils.chat("§cSkyHanni caught and logged an ${it::class.simpleName ?: "error"} at ${eventName}.")
+ }
}.getOrDefault(isCanceled)
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt
index a8f8e84a8..9c4b46fb8 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt
@@ -1,12 +1,15 @@
package at.hannibal2.skyhanni.features.garden
+import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.GardenCropMilestones
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.events.GardenToolChangeEvent
+import at.hannibal2.skyhanni.events.ProfileJoinEvent
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
import net.minecraft.client.Minecraft
import net.minecraft.item.ItemStack
+import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
@@ -27,6 +30,16 @@ class GardenAPI {
}
}
+ @SubscribeEvent(priority = EventPriority.LOW)
+ fun onProfileJoin(event: ProfileJoinEvent) {
+ if (cropsPerSecond.isEmpty()) {
+ // TODO use enum
+ for (key in GardenCropMilestones.cropCounter.keys) {
+ cropsPerSecond[key] = -1
+ }
+ }
+ }
+
private fun loadCropInHand(): String? {
val heldItem = Minecraft.getMinecraft().thePlayer.heldItem ?: return null
if (readCounter(heldItem) == -1) return null
@@ -38,6 +51,7 @@ class GardenAPI {
fun inGarden() = LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == IslandType.GARDEN
var cropInHand: String? = null
+ val cropsPerSecond: MutableMap<String, Int> get() = SkyHanniMod.feature.hidden.gardenCropsPerSecond
fun getCropTypeFromItem(heldItem: ItemStack): String? {
val name = heldItem.name ?: return null
@@ -76,5 +90,13 @@ class GardenAPI {
}
return -1
}
+
+ fun getCropsPerSecond(itemName: String): Int? {
+ if (itemName.endsWith(" Mushroom")) {
+ return cropsPerSecond["Mushroom"]
+ }
+ return cropsPerSecond[itemName]
+ }
+
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenBestCropTime.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenBestCropTime.kt
new file mode 100644
index 000000000..d5920658f
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenBestCropTime.kt
@@ -0,0 +1,84 @@
+package at.hannibal2.skyhanni.features.garden
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.GardenCropMilestones
+import at.hannibal2.skyhanni.utils.LorenzUtils.sorted
+import at.hannibal2.skyhanni.utils.TimeUtils
+import java.util.*
+
+class GardenBestCropTime {
+ val display = mutableListOf<List<Any>>()
+ val timeTillNextCrop = mutableMapOf<String, Long>()
+ private val config get() = SkyHanniMod.feature.garden
+
+ fun drawBestDisplay(currentCrop: String?) {
+ if (timeTillNextCrop.size < GardenAPI.cropsPerSecond.size) {
+ updateTimeTillNextCrop()
+ }
+
+ val gardenExp = config.cropMilestoneBestType == 0
+ val sorted = if (gardenExp) {
+ val helpMap = mutableMapOf<String, Long>()
+ for ((cropName, time) in timeTillNextCrop) {
+ val crops = GardenCropMilestones.cropCounter[cropName]!!
+ val currentTier = GardenCropMilestones.getTierForCrops(crops)
+ val gardenExpForTier = getGardenExpForTier(currentTier + 1)
+ val fakeTime = time / gardenExpForTier
+ helpMap[cropName] = fakeTime
+ }
+ helpMap.sorted()
+ } else {
+ timeTillNextCrop.sorted()
+ }
+
+ val title = if (gardenExp) "§2Garden Experience" else "§bSkyBlock Level"
+ display.add(Collections.singletonList("§eBest Crop Time §7($title§7)"))
+
+ if (sorted.isEmpty()) {
+ display.add(Collections.singletonList("§cFarm crops to add them to this list!"))
+ }
+
+ var number = 0
+ for (cropName in sorted.keys) {
+ val millis = timeTillNextCrop[cropName]!!
+ val duration = TimeUtils.formatDuration(millis)
+
+ val isCurrent = cropName == currentCrop
+ val color = if (isCurrent) "§e" else ""
+ number++
+ if (number > config.cropMilestoneShowOnlyBest && !isCurrent) continue
+ val cropNameDisplay = "$number# $color$cropName"
+ if (gardenExp) {
+ val crops = GardenCropMilestones.cropCounter[cropName]!!
+ val currentTier = GardenCropMilestones.getTierForCrops(crops)
+ val gardenExpForTier = getGardenExpForTier(currentTier + 1)
+ display.add(Collections.singletonList(" $cropNameDisplay §b$duration §7(§2$gardenExpForTier §7Exp)"))
+ } else {
+ display.add(Collections.singletonList(" $cropNameDisplay §b$duration"))
+ }
+ }
+ }
+
+ private fun getGardenExpForTier(gardenLevel: Int) = if (gardenLevel > 30) 300 else gardenLevel * 10
+
+ fun updateTimeTillNextCrop() {
+ for ((cropName, speed) in GardenAPI.cropsPerSecond) {
+ if (speed == -1) continue
+
+ val crops = GardenCropMilestones.cropCounter[cropName]!!
+ val currentTier = GardenCropMilestones.getTierForCrops(crops)
+
+ val cropsForCurrentTier = GardenCropMilestones.getCropsForTier(currentTier)
+ val nextTier = currentTier + 1
+ val cropsForNextTier = GardenCropMilestones.getCropsForTier(nextTier)
+
+ val have = crops - cropsForCurrentTier
+ val need = cropsForNextTier - cropsForCurrentTier
+
+ val missing = need - have
+ val missingTimeSeconds = missing / speed
+ val millis = missingTimeSeconds * 1000
+ timeTillNextCrop[cropName] = millis
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt
index a3dcfd131..2854aec45 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt
@@ -4,7 +4,6 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.GardenCropMilestones
import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.sorted
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import at.hannibal2.skyhanni.utils.TimeUtils
@@ -14,22 +13,11 @@ import java.util.*
class GardenCropMilestoneDisplay {
private val progressDisplay = mutableListOf<List<Any>>()
- private val bestCropDisplay = mutableListOf<List<Any>>()
private var needsInventory = false
private val cultivatingData = mutableMapOf<String, Int>()
- private val timeTillNextCrop = mutableMapOf<String, Long>()
private val config get() = SkyHanniMod.feature.garden
- companion object {
- fun getCropsPerSecond(crop: String): Int? {
- if (crop.endsWith(" Mushroom")) {
- return cropsPerSecond["Mushroom"]
- }
- return cropsPerSecond[crop]
- }
-
- private val cropsPerSecond: MutableMap<String, Int> get() = SkyHanniMod.feature.hidden.gardenCropsPerSecond
- }
+ private val bestCropTime = GardenBestCropTime()
@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) {
@@ -37,7 +25,7 @@ class GardenCropMilestoneDisplay {
config.cropMilestoneProgressDisplayPos.renderStringsAndItems(progressDisplay)
if (config.cropMilestoneBestDisplay) {
- config.cropMilestoneNextDisplayPos.renderStringsAndItems(bestCropDisplay)
+ config.cropMilestoneNextDisplayPos.renderStringsAndItems(bestCropTime.display)
}
}
@@ -46,17 +34,12 @@ class GardenCropMilestoneDisplay {
if (GardenCropMilestones.cropCounter.values.sum() == 0L) {
needsInventory = true
}
- if (cropsPerSecond.isEmpty()) {
- for (key in GardenCropMilestones.cropCounter.keys) {
- cropsPerSecond[key] = -1
- }
- }
}
@SubscribeEvent
fun onCropMilestoneUpdate(event: CropMilestoneUpdateEvent) {
needsInventory = false
- updateTimeTillNextCrop()
+ bestCropTime.updateTimeTillNextCrop()
update()
}
@@ -96,12 +79,10 @@ class GardenCropMilestoneDisplay {
if (System.currentTimeMillis() > lastSecondStart + 1_000) {
lastSecondStart = System.currentTimeMillis()
if (countInLastSecond > 8) {
-// println("currentSpeed: $currentSpeed")
allCounters.add(currentSpeed)
while (allCounters.size > 30) {
allCounters.removeFirst()
}
-// println("allCounters: $allCounters")
averageSpeedPerSecond = allCounters.average().toInt()
}
countInLastSecond = 0
@@ -121,7 +102,7 @@ class GardenCropMilestoneDisplay {
private fun update() {
progressDisplay.clear()
- bestCropDisplay.clear()
+ bestCropTime.display.clear()
GardenAPI.cropInHand?.let {
val crops = GardenCropMilestones.cropCounter[it]
if (crops == null) {
@@ -131,87 +112,16 @@ class GardenCropMilestoneDisplay {
drawProgressDisplay(it, crops)
if (config.cropMilestoneBestDisplay) {
- drawBestDisplay(it)
+ bestCropTime.drawBestDisplay(it)
}
}
if (config.cropMilestoneBestAlwaysOn) {
if (GardenAPI.cropInHand == null) {
- drawBestDisplay(null)
- }
- }
- }
-
- private fun drawBestDisplay(currentCrop: String?) {
- if (timeTillNextCrop.size < cropsPerSecond.size) {
- updateTimeTillNextCrop()
- }
-
- val gardenExp = config.cropMilestoneBestType == 0
- val sorted = if (gardenExp) {
- val helpMap = mutableMapOf<String, Long>()
- for ((cropName, time) in timeTillNextCrop) {
- val crops = GardenCropMilestones.cropCounter[cropName]!!
- val currentTier = GardenCropMilestones.getTierForCrops(crops)
- val gardenExpForTier = getGardenExpForTier(currentTier + 1)
- val fakeTime = time / gardenExpForTier
- helpMap[cropName] = fakeTime
- }
- helpMap.sorted()
- } else {
- timeTillNextCrop.sorted()
- }
-
- val title = if (gardenExp) "§2Garden Experience" else "§bSkyBlock Level"
- bestCropDisplay.add(Collections.singletonList("§eBest Crop Time §7($title§7)"))
-
- if (sorted.isEmpty()) {
- bestCropDisplay.add(Collections.singletonList("§cFarm crops to add them to this list!"))
- }
-
- var number = 0
- for (cropName in sorted.keys) {
- val millis = timeTillNextCrop[cropName]!!
- val duration = TimeUtils.formatDuration(millis)
-
- val isCurrent = cropName == currentCrop
- val color = if (isCurrent) "§e" else ""
- number++
- if (number > config.cropMilestoneShowOnlyBest && !isCurrent) continue
- val cropNameDisplay = "$number# $color$cropName"
- if (gardenExp) {
- val crops = GardenCropMilestones.cropCounter[cropName]!!
- val currentTier = GardenCropMilestones.getTierForCrops(crops)
- val gardenExpForTier = getGardenExpForTier(currentTier + 1)
- bestCropDisplay.add(Collections.singletonList(" $cropNameDisplay §b$duration §7(§2$gardenExpForTier §7Exp)"))
- } else {
- bestCropDisplay.add(Collections.singletonList(" $cropNameDisplay §b$duration"))
+ bestCropTime.drawBestDisplay(null)
}
}
}
- private fun updateTimeTillNextCrop() {
- for ((cropName, speed) in cropsPerSecond) {
- if (speed == -1) continue
-
- val crops = GardenCropMilestones.cropCounter[cropName]!!
- val currentTier = GardenCropMilestones.getTierForCrops(crops)
-
- val cropsForCurrentTier = GardenCropMilestones.getCropsForTier(currentTier)
- val nextTier = currentTier + 1
- val cropsForNextTier = GardenCropMilestones.getCropsForTier(nextTier)
-
- val have = crops - cropsForCurrentTier
- val need = cropsForNextTier - cropsForCurrentTier
-
- val missing = need - have
- val missingTimeSeconds = missing / speed
- val millis = missingTimeSeconds * 1000
- timeTillNextCrop[cropName] = millis
- }
- }
-
- private fun getGardenExpForTier(gardenLevel: Int) = if (gardenLevel > 30) 300 else gardenLevel * 10
-
private fun drawProgressDisplay(it: String, crops: Long) {
progressDisplay.add(Collections.singletonList("§6Crop Milestones"))
@@ -242,11 +152,11 @@ class GardenCropMilestoneDisplay {
progressDisplay.add(Collections.singletonList("§e$haveFormat§8/§e$needFormat"))
if (averageSpeedPerSecond != 0) {
- cropsPerSecond[it] = averageSpeedPerSecond
+ GardenAPI.cropsPerSecond[it] = averageSpeedPerSecond
val missing = need - have
val missingTimeSeconds = missing / averageSpeedPerSecond
val millis = missingTimeSeconds * 1000
- timeTillNextCrop[it] = millis
+ bestCropTime.timeTillNextCrop[it] = millis
val duration = TimeUtils.formatDuration(millis)
progressDisplay.add(Collections.singletonList("§7in §b$duration"))
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 b783e9093..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
@@ -178,7 +177,7 @@ class GardenVisitorFeatures {
val rawName = NEUItems.getItemStack(multiplier.first).name ?: continue
val crop = rawName.removeColor()
val cropAmount = multiplier.second.toLong() * amount
- GardenCropMilestoneDisplay.getCropsPerSecond(crop)?.let {
+ GardenAPI.getCropsPerSecond(crop)?.let {
val formatAmount = LorenzUtils.formatInteger(cropAmount)
val formatName = "§e${formatAmount}§7x $crop "
val formatSpeed = if (it != -1) {
@@ -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