diff options
| author | Brandon <brandon.wamboldt@gmail.com> | 2023-09-23 07:25:19 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-23 12:25:19 +0200 |
| commit | fe33e64b35d4ed8a049e5c1a85b4c7b0873b325b (patch) | |
| tree | 3b3f3625cdd72ed626c3f3dd39b2030c49b8183c /src/main/java/at/hannibal2/skyhanni/features | |
| parent | e9c51ac3a9d61cf9c5616c476cbbb8dcb7cba87c (diff) | |
| download | skyhanni-fe33e64b35d4ed8a049e5c1a85b4c7b0873b325b.tar.gz skyhanni-fe33e64b35d4ed8a049e5c1a85b4c7b0873b325b.tar.bz2 skyhanni-fe33e64b35d4ed8a049e5c1a85b4c7b0873b325b.zip | |
Arachne fixes + timer #441
* Fix inconsistencies with arachne brood highlighting and add countdown…
* Merge branch 'beta' into arachne-fixes
* fixed merge conflicts
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/mobs/MobHighlight.kt | 7 | ||||
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/mobs/SpawnTimers.kt | 49 |
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 |
