aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-26 17:37:59 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-26 17:37:59 +0100
commitf676436eda47f06a856aeeb40030d2e736f9724f (patch)
tree16be64f991381948f5b158e7fc6ef04d05b413dd /src
parentdea252c20bef556b4747b15b2d031c5ee31571e6 (diff)
downloadskyhanni-f676436eda47f06a856aeeb40030d2e736f9724f.tar.gz
skyhanni-f676436eda47f06a856aeeb40030d2e736f9724f.tar.bz2
skyhanni-f676436eda47f06a856aeeb40030d2e736f9724f.zip
Fixed Reindrake mob, Frosty NPC and frosty the snow blaster shop counting as sea creatures in barn fishing timer.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt39
1 files changed, 29 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt
index 8943e74d6..79fdc21f3 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt
@@ -13,8 +13,10 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
import at.hannibal2.skyhanni.utils.SoundUtils
+import at.hannibal2.skyhanni.utils.StringUtils
import at.hannibal2.skyhanni.utils.TimeUnit
import at.hannibal2.skyhanni.utils.TimeUtils
+import at.hannibal2.skyhanni.utils.getLorenzVec
import net.minecraft.client.Minecraft
import net.minecraft.entity.item.EntityArmorStand
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -75,15 +77,32 @@ class FishingTimer {
}
}
- private fun countMobs() = EntityUtils.getEntities<EntityArmorStand>()
- .map { entity ->
- val name = entity.name
- val isSummonedSoul = name.contains("'")
- val hasFishingMobName = SeaCreatureManager.allFishingMobs.keys.any { name.contains(it) }
- if (hasFishingMobName && !isSummonedSoul) {
- if (name == "Sea Emperor" || name == "Rider of the Deep") 2 else 1
- } else 0
- }.sum()
+ private fun countMobs() = EntityUtils.getEntities<EntityArmorStand>().map { entity -> amount(entity) }.sum()
+
+ private fun amount(entity: EntityArmorStand): Int {
+ val name = entity.name
+ // a dragon, will always be fought
+ if (name == "Reindrake") return 0
+
+ // a npc shop
+ if (name == "§5Frosty the Snow Blaster") return 0
+
+ if (name == "Frosty") {
+ val npcLocation = LorenzVec(-1.5, 76.0, 92.5)
+ if (entity.getLorenzVec().distance(npcLocation) < 1) {
+ return 0
+ }
+ }
+
+ val isSummonedSoul = name.contains("'")
+ val hasFishingMobName = SeaCreatureManager.allFishingMobs.keys.any { name.contains(it) }
+ if (!hasFishingMobName || isSummonedSoul) return 0
+
+ if (name == "Sea Emperor" || name == "Rider of the Deep") {
+ return 2
+ }
+ return 1
+ }
private fun isRightLocation(): Boolean {
inHollows = false
@@ -117,7 +136,7 @@ class FishingTimer {
val barnTimerAlertTime = config.alertTime * 1_000
val color = if (duration > barnTimerAlertTime) "§c" else "§e"
val timeFormat = TimeUtils.formatDuration(duration, biggestUnit = TimeUnit.MINUTE)
- val name = if (currentCount == 1) "sea creature" else "sea creatures"
+ val name = StringUtils.optionalPlural(currentCount, "sea creature", "sea creatures")
val text = "$color$timeFormat §8(§e$currentCount §b$name§8)"
config.pos.renderString(text, posLabel = "BarnTimer")