aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/features/ArachneTimer.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/dulkirmod/features/ArachneTimer.kt')
-rw-r--r--src/main/kotlin/dulkirmod/features/ArachneTimer.kt22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/main/kotlin/dulkirmod/features/ArachneTimer.kt b/src/main/kotlin/dulkirmod/features/ArachneTimer.kt
index 7e0f144..d5334ba 100644
--- a/src/main/kotlin/dulkirmod/features/ArachneTimer.kt
+++ b/src/main/kotlin/dulkirmod/features/ArachneTimer.kt
@@ -4,14 +4,18 @@ import dulkirmod.DulkirMod
import dulkirmod.DulkirMod.Companion.mc
import dulkirmod.config.Config
import dulkirmod.utils.Utils
+import dulkirmod.utils.WorldRenderUtils
import net.minecraft.util.ChatComponentText
+import net.minecraft.util.Vec3
import net.minecraftforge.client.event.ClientChatReceivedEvent
+import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class ArachneTimer {
- private var startmillis : Long = -1;
- private var endmillis : Long = -1;
+ private var startmillis : Long = -1
+ private var endmillis : Long = -1
+ private var spawnmillis : Long = -1
@SubscribeEvent(receiveCanceled = true, priority = EventPriority.LOW)
fun onChat(event: ClientChatReceivedEvent) {
@@ -27,6 +31,9 @@ class ArachneTimer {
if (unformatted == "[BOSS] Arachne: You dare to call me, the queen of the dark, to you. I'll accept no excuses, you shall die!") {
startmillis = System.currentTimeMillis()
}
+ else if (unformatted.startsWith('☄') && unformatted.contains("Something is awakening!")) {
+ spawnmillis = System.currentTimeMillis()
+ }
if (unformatted == "[BOSS] Arachne: You are lucky this time that you only called out a portion of my power. If you dared to face me at my peak, you would not survive!") {
endmillis = System.currentTimeMillis()
@@ -39,4 +46,15 @@ class ArachneTimer {
}
}
}
+ @SubscribeEvent
+ fun onWorldRenderLast(event: RenderWorldLastEvent) {
+ if (!Config.arachneSpawnTimer) return
+
+ if (spawnmillis > startmillis) {
+ val color = Utils.getColorString(Config.bestiaryNotifColor)
+ var time = 18 - (System.currentTimeMillis() - spawnmillis)/1000
+ if (time < 0) time = 0
+ WorldRenderUtils.render(Vec3(-282.5, 50.8, -178.5), "${color}${time}")
+ }
+ }
} \ No newline at end of file