summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mobs/MobHighlight.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mobs/SpawnTimers.kt49
2 files changed, 52 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mobs/MobHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/mobs/MobHighlight.kt
index a366f5ce5..cbe1bae37 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mobs/MobHighlight.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mobs/MobHighlight.kt
@@ -41,7 +41,7 @@ class MobHighlight {
val entity = event.entity
val maxHealth = event.maxHealth
if (config.arachneKeeperHighlight) {
- if (maxHealth == 3_000 && entity is EntityCaveSpider) {
+ if ((maxHealth == 3_000 || maxHealth == 12_000) && entity is EntityCaveSpider) {
RenderLivingEntityHelper.setEntityColor(entity, LorenzColor.DARK_BLUE.toColor().withAlpha(127))
{ config.arachneKeeperHighlight }
RenderLivingEntityHelper.setNoHurtTime(entity) { config.arachneKeeperHighlight }
@@ -88,10 +88,9 @@ class MobHighlight {
!entity.hasNameTagWith(1, "[§7Lv500§8] §lArachne")
) return
- val maxHealth = entity.baseMaxHealth
- if (maxHealth == 12 || maxHealth == 4000) {
+ if (entity is EntityCaveSpider) {
markArachneMinis(entity)
- } else {
+ } else if (entity.baseMaxHealth == 20_000 || entity.baseMaxHealth == 100_000) {
markArachne(entity)
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mobs/SpawnTimers.kt b/src/main/java/at/hannibal2/skyhanni/features/mobs/SpawnTimers.kt
new file mode 100644
index 000000000..b2d76824d
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/mobs/SpawnTimers.kt
@@ -0,0 +1,49 @@
+package at.hannibal2.skyhanni.features.mobs
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.IslandType
+import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
+import at.hannibal2.skyhanni.utils.LorenzVec
+import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
+import at.hannibal2.skyhanni.utils.SimpleTimeMark
+import at.hannibal2.skyhanni.utils.StringUtils.removeColor
+import at.hannibal2.skyhanni.utils.TimeUtils.format
+import net.minecraftforge.client.event.RenderWorldLastEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import kotlin.time.Duration.Companion.seconds
+
+class SpawnTimers {
+ private val config get() = SkyHanniMod.feature.combat.mobs
+
+ private val arachneAltarLocation = LorenzVec(-283f, 51f, -179f)
+ private var arachneSpawnTime = SimpleTimeMark.farPast()
+ private val arachneFragmentMessage = "^☄ [a-z0-9_]{2,22} placed an arachne's calling! something is awakening! \\(4/4\\)\$".toRegex()
+ private val arachneCrystalMessage = "^☄ [a-z0-9_]{2,22} placed an arachne crystal! something is awakening!$".toRegex()
+
+ @SubscribeEvent
+ fun onRenderWorld(event: RenderWorldLastEvent) {
+ if (!isEnabled()) return
+ if (arachneSpawnTime.isInPast()) return
+ val countDown = arachneSpawnTime.timeUntil()
+
+ val format = countDown.format(showMilliSeconds = true)
+ event.drawDynamicText(arachneAltarLocation, "§b$format", 1.5)
+ }
+
+ @SubscribeEvent
+ fun onChatReceived(event: LorenzChatEvent) {
+ if (!isEnabled()) return
+ val message = event.message.removeColor().lowercase()
+
+ if (arachneFragmentMessage.matches(message) || arachneCrystalMessage.matches(message)) {
+ arachneSpawnTime = if (arachneCrystalMessage.matches(message))
+ SimpleTimeMark.now() + 24.seconds
+ else
+ SimpleTimeMark.now() + 19.seconds
+ }
+ }
+
+ fun isEnabled() = IslandType.SPIDER_DEN.isInIsland() && LorenzUtils.skyBlockArea == "Arachne's Sanctuary" && config.showArachneSpawnTimer
+} \ No newline at end of file