Skip to content

Commit

Permalink
+ add Arachne Boss Kill timer
Browse files Browse the repository at this point in the history
  • Loading branch information
inglettronald committed Oct 10, 2022
1 parent c933a10 commit bb0a679
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ Features:
- Bestiary Notifications for Ghasts/Zombie Villagers
- Notification when hype breaks and stops giving combat xp
- Hide arachne loot nametags
- Arachne Boss Kill timer

This is epic.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
}

group = "com.example.archloomtemplate"
version = "1.0.6"
version = "1.0.7"

// Toolchains:
java {
Expand Down
6 changes: 4 additions & 2 deletions src/main/kotlin/dulkirmod/DulkirMod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package dulkirmod
import dulkirmod.command.*
import dulkirmod.config.Config
import dulkirmod.events.ChatEvent
import dulkirmod.features.ArachneTimer
import dulkirmod.features.NametagCleaner
import dulkirmod.features.alarmClock
import dulkirmod.features.brokenHypeNotif
Expand Down Expand Up @@ -60,6 +61,7 @@ class DulkirMod {
MinecraftForge.EVENT_BUS.register(ChatEvent())
MinecraftForge.EVENT_BUS.register(NametagCleaner)
MinecraftForge.EVENT_BUS.register(DulkirMod.titleUtils)
MinecraftForge.EVENT_BUS.register(ArachneTimer())

keyBinds.forEach(ClientRegistry::registerKeyBinding)
}
Expand Down Expand Up @@ -102,8 +104,8 @@ class DulkirMod {
companion object {
const val MOD_ID = "dulkirmod"
const val MOD_NAME = "Dulkir Mod"
const val MOD_VERSION = "1.0.6"
const val CHAT_PREFIX = "<DulkirMod>"
const val MOD_VERSION = "1.0.7"
const val CHAT_PREFIX = "§f<§3DulkirMod§f>"

val mc: Minecraft = Minecraft.getMinecraft()
var config = Config
Expand Down
8 changes: 8 additions & 0 deletions src/main/kotlin/dulkirmod/config/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,14 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so
category = "Bestiary"
)
var hideArachneTags = false

@Property(
type = PropertyType.SWITCH,
name = "Arachne kill timer",
description = "Shows in chat.",
category = "Bestiary"
)
var arachneKillTimer = false
fun init() {
initialize()
addDependency("customMessage", "throttleNotifier")
Expand Down
42 changes: 42 additions & 0 deletions src/main/kotlin/dulkirmod/features/ArachneTimer.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package dulkirmod.features

import dulkirmod.DulkirMod
import dulkirmod.DulkirMod.Companion.mc
import dulkirmod.config.Config
import dulkirmod.utils.Utils
import net.minecraft.util.ChatComponentText
import net.minecraftforge.client.event.ClientChatReceivedEvent
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;

@SubscribeEvent(receiveCanceled = true, priority = EventPriority.LOW)
fun onChat(event: ClientChatReceivedEvent) {
if (!Config.arachneKillTimer) return

var killtime : Float = -1f;

if (event.type == 2.toByte()) {
return
}

val unformatted = Utils.stripColorCodes(event.message.unformattedText)
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()
}

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()
if (startmillis > -1) {
killtime = (endmillis - startmillis).toFloat() / 1000

mc.thePlayer.addChatMessage(
ChatComponentText("${DulkirMod.CHAT_PREFIX} §6Arachne took §7$killtime §6seconds to kill.")
)
}
}
}
}

0 comments on commit bb0a679

Please sign in to comment.