aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt24
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt18
3 files changed, 23 insertions, 23 deletions
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 4218056e9..534c88ac4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.garden
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.IslandType
+import at.hannibal2.skyhanni.data.ScoreboardData
import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -34,6 +35,8 @@ class GardenAPI {
if (!inGarden()) return
tick++
if (tick % 10 == 0) {
+ onBarnPlot = ScoreboardData.sidebarLinesFormatted.contains(" §7⏣ §aThe Garden")
+
// We ignore random hypixel moments
Minecraft.getMinecraft().currentScreen ?: return
checkItemInHand()
@@ -79,6 +82,7 @@ class GardenAPI {
private val cropsPerSecond: MutableMap<CropType, Int> get() = SkyHanniMod.feature.hidden.gardenCropsPerSecond
var cropInHand: CropType? = null
var mushroomCowPet = false
+ var onBarnPlot = false
fun inGarden() = LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == IslandType.GARDEN
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt
index de36c15a8..0c8d83cc3 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt
@@ -91,27 +91,31 @@ class GardenOptimalSpeed {
@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) {
if (!isEnabled()) return
- if (!Minecraft.getMinecraft().thePlayer.onGround) return
if (optimalSpeed == -1) return
val text = "Optimal Speed: §f$optimalSpeed"
if (optimalSpeed != currentSpeed) {
config.optimalSpeedPos.renderString("§c$text", posLabel = "Garden Optimal Speed")
- if (config.optimalSpeedWarning) {
- if (System.currentTimeMillis() > lastWarnTime + 20_000) {
- lastWarnTime = System.currentTimeMillis()
- SendTitleHelper.sendTitle("§cWrong speed!", 3_000)
- cropInHand?.let {
- LorenzUtils.chat("§e[SkyHanni] Wrong speed for ${it.cropName}: §f$currentSpeed §e(§f$optimalSpeed §eis optimal)")
- }
- }
- }
+ warn()
} else {
config.optimalSpeedPos.renderString("§a$text", posLabel = "Garden Optimal Speed")
}
}
+ private fun warn() {
+ if (!config.optimalSpeedWarning) return
+ if (!Minecraft.getMinecraft().thePlayer.onGround) return
+ if (GardenAPI.onBarnPlot) return
+ if (System.currentTimeMillis() < lastWarnTime + 20_000) return
+
+ lastWarnTime = System.currentTimeMillis()
+ SendTitleHelper.sendTitle("§cWrong speed!", 3_000)
+ cropInHand?.let {
+ LorenzUtils.chat("§e[SkyHanni] Wrong speed for ${it.cropName}: §f$currentSpeed §e(§f$optimalSpeed §eis optimal)")
+ }
+ }
+
private fun isRancherOverlayEnabled() = GardenAPI.inGarden() && config.optimalSpeedSignEnabled
private fun isEnabled() = GardenAPI.inGarden() && config.optimalSpeedEnabled
} \ 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 0581c167c..25495a596 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.ScoreboardData.Companion.sidebarLinesFormatted
import at.hannibal2.skyhanni.data.SendTitleHelper
import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.features.garden.GardenAPI.Companion.getSpeed
@@ -29,11 +28,9 @@ import net.minecraftforge.fml.common.gameevent.TickEvent
import java.util.regex.Pattern
class GardenVisitorFeatures {
-
private val visitors = mutableMapOf<String, Visitor>()
private var display = listOf<List<Any>>()
private var lastClickedNpc = 0
- private var onBarnPlot = false
private var tick = 0
private val copperPattern = Pattern.compile(" §8\\+§c(.*) Copper")
private val gardenExperiencePattern = Pattern.compile(" §8\\+§2(.*) §7Garden Experience")
@@ -196,7 +193,7 @@ class GardenVisitorFeatures {
@SubscribeEvent
fun onCheckRender(event: CheckRenderEntityEvent<*>) {
if (!GardenAPI.inGarden()) return
- if (!onBarnPlot) return
+ if (!GardenAPI.onBarnPlot) return
if (config.visitorHighlightStatus != 1 && config.visitorHighlightStatus != 2) return
val entity = event.entity
@@ -210,7 +207,7 @@ class GardenVisitorFeatures {
@SubscribeEvent
fun onRenderWorld(event: RenderWorldLastEvent) {
if (!GardenAPI.inGarden()) return
- if (!onBarnPlot) return
+ if (!GardenAPI.onBarnPlot) return
if (config.visitorHighlightStatus != 1 && config.visitorHighlightStatus != 2) return
for (visitor in visitors.values) {
@@ -319,11 +316,9 @@ class GardenVisitorFeatures {
fun onTick(event: TickEvent.ClientTickEvent) {
if (!GardenAPI.inGarden()) return
if (!config.visitorNeedsDisplay && config.visitorHighlightStatus == 3) return
- if (tick++ % 30 != 0) return
-
- onBarnPlot = sidebarLinesFormatted.contains(" §7⏣ §aThe Garden")
+ if (tick++ % 10 != 0) return
- if (onBarnPlot && config.visitorHighlightStatus != 3) {
+ if (GardenAPI.onBarnPlot && config.visitorHighlightStatus != 3) {
checkVisitorsReady()
}
}
@@ -511,10 +506,7 @@ class GardenVisitorFeatures {
if (!GardenAPI.inGarden()) return
if (!config.visitorNeedsDisplay) return
- if (config.visitorNeedsOnlyWhenClose) {
- //TODO check if on barn plot (sidebar)
- if (!onBarnPlot) return
- }
+ if (config.visitorNeedsOnlyWhenClose && !GardenAPI.onBarnPlot) return
config.visitorNeedsPos.renderStringsAndItems(display, posLabel = "Visitor Items Needed")
}