aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-29 14:19:12 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-29 14:19:12 +0200
commit8df9246342cf7fc4e05da9749510b5621539aa83 (patch)
treed0483d5ad47dc69d0eb7bedf352d81c9bf472b2c /src/main/java/at/hannibal2
parent31f951605026d989de2e94b135a58c996f2d9edd (diff)
downloadskyhanni-8df9246342cf7fc4e05da9749510b5621539aa83.tar.gz
skyhanni-8df9246342cf7fc4e05da9749510b5621539aa83.tar.bz2
skyhanni-8df9246342cf7fc4e05da9749510b5621539aa83.zip
Detecting mushroom cow pet via strength in tab list instead of chat message
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorTimer.kt2
3 files changed, 13 insertions, 11 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 c12710a4b..1168b7f40 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt
@@ -2,10 +2,7 @@ package at.hannibal2.skyhanni.features.garden
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.IslandType
-import at.hannibal2.skyhanni.events.GardenToolChangeEvent
-import at.hannibal2.skyhanni.events.GuiContainerEvent
-import at.hannibal2.skyhanni.events.PacketEvent
-import at.hannibal2.skyhanni.events.ProfileJoinEvent
+import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NEUItems
@@ -44,6 +41,13 @@ class GardenAPI {
}
}
+ @SubscribeEvent
+ fun onTabListUpdate(event: TabListUpdateEvent) {
+ if (inGarden()) {
+ mushroomCowPet = event.tabList.any { it.startsWith(" Strength: §r§c❁") }
+ }
+ }
+
private fun checkItemInHand() {
val toolItem = Minecraft.getMinecraft().thePlayer.heldItem
val crop = getCropTypeFromItem(toolItem)
@@ -75,6 +79,7 @@ class GardenAPI {
var toolInHand: String? = null
private val cropsPerSecond: MutableMap<CropType, Int> get() = SkyHanniMod.feature.hidden.gardenCropsPerSecond
var cropInHand: CropType? = null
+ var mushroomCowPet = false
fun inGarden() = LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == IslandType.GARDEN
@@ -111,7 +116,7 @@ class GardenAPI {
setSpeed(-1)
return -1
}
-
+
fun CropType.setSpeed(speed: Int) {
cropsPerSecond[this] = speed
}
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 b39302ef3..e0d81011f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt
@@ -220,14 +220,12 @@ class GardenCropMilestoneDisplay {
currentSpeed = 0
lastBlocksPerSecond = blocksBroken
- val hasMushroomCow = hasMushroomCow()
- if (hasMushroomCow) {
+ if (GardenAPI.mushroomCowPet) {
CropType.MUSHROOM.setCounter(CropType.MUSHROOM.getCounter() + blocksBroken)
}
blocksBroken = 0
}
- private fun hasMushroomCow() = SkyHanniMod.feature.hidden.currentPet.contains("Mooshroom Cow")
private fun calculateSpeed(addedCounter: Int) {
currentSpeed += addedCounter
@@ -313,8 +311,7 @@ class GardenCropMilestoneDisplay {
lineMap[4] = Collections.singletonList("§7Crops/Minute§8: §e$format")
lineMap[5] = Collections.singletonList("§7Blocks/Second§8: §e$lastBlocksPerSecond")
-
- if (hasMushroomCow() && crop != CropType.MUSHROOM) {
+ if (GardenAPI.mushroomCowPet && crop != CropType.MUSHROOM) {
addMushroomCowData()
}
}
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 820b819be..ea63fb54f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorTimer.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorTimer.kt
@@ -16,7 +16,7 @@ class GardenVisitorTimer {
private var lastVisitors = 0
@SubscribeEvent
- fun onTick(event: TabListUpdateEvent) {
+ fun onTabListUpdate(event: TabListUpdateEvent) {
if (!isEnabled()) return
var visitorsAmount = 0