generated from nea89o/Forge1.8.9Template
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c933a10
commit bb0a679
Showing
5 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.") | ||
) | ||
} | ||
} | ||
} | ||
} |