aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/ambientaddons/features/dungeon
diff options
context:
space:
mode:
authorAppability <appable@icloud.com>2022-11-12 14:35:15 -0800
committerAppability <appable@icloud.com>2022-11-12 14:35:15 -0800
commitde601769d8a1b5fc7543d5b0b4a95596db926416 (patch)
tree3fea24e9e4d55f93e00553e2a2ca9f6ecb1ef713 /src/main/kotlin/com/ambientaddons/features/dungeon
parent2b21d3a18b412ec8c205beacf403f0147dc04618 (diff)
downloadAmbientAddons-de601769d8a1b5fc7543d5b0b4a95596db926416.tar.gz
AmbientAddons-de601769d8a1b5fc7543d5b0b4a95596db926416.tar.bz2
AmbientAddons-de601769d8a1b5fc7543d5b0b4a95596db926416.zip
placeholder custom end info, farming qol, thunder warning
Diffstat (limited to 'src/main/kotlin/com/ambientaddons/features/dungeon')
-rw-r--r--src/main/kotlin/com/ambientaddons/features/dungeon/CustomEndInfo.kt45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/main/kotlin/com/ambientaddons/features/dungeon/CustomEndInfo.kt b/src/main/kotlin/com/ambientaddons/features/dungeon/CustomEndInfo.kt
new file mode 100644
index 0000000..f67590a
--- /dev/null
+++ b/src/main/kotlin/com/ambientaddons/features/dungeon/CustomEndInfo.kt
@@ -0,0 +1,45 @@
+package com.ambientaddons.features.dungeon
+
+import AmbientAddons.Companion.config
+import AmbientAddons.Companion.mc
+import com.ambientaddons.utils.Area
+import com.ambientaddons.utils.Extensions.stripControlCodes
+import com.ambientaddons.utils.SBLocation
+import gg.essential.universal.UChat
+import net.minecraftforge.client.event.ClientChatReceivedEvent
+import net.minecraftforge.event.world.WorldEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent
+
+object CustomEndInfo {
+ private var ticks = 0
+ private var showExtraStatsTime = -1
+ private var hasShownExtraStats = false
+
+ @SubscribeEvent
+ fun onWorldUnload(event: WorldEvent.Unload) {
+ hasShownExtraStats = false
+ }
+
+ @SubscribeEvent(receiveCanceled = true)
+ fun onChatReceived(event: ClientChatReceivedEvent) {
+ if (SBLocation.area != Area.Dungeon || config.customEndInfo == 0) return
+ val stripped = event.message.unformattedText.stripControlCodes().trim().replace(",", "")
+ if (!hasShownExtraStats && listOf("Master Mode Catacombs - ", "The Catacombs - ").any { stripped.startsWith(it) }) {
+ showExtraStatsTime = ticks + 10
+ hasShownExtraStats = true
+ }
+ }
+
+ @SubscribeEvent
+ fun onTick(event: ClientTickEvent) {
+ if (event.phase != TickEvent.Phase.START) return
+ if (ticks == showExtraStatsTime) {
+ mc.thePlayer?.sendChatMessage("/showextrastats")
+ }
+ ticks++
+ }
+
+
+} \ No newline at end of file