aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/ambientaddons/features/misc/ThunderWarning.kt
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/misc/ThunderWarning.kt
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/misc/ThunderWarning.kt')
-rw-r--r--src/main/kotlin/com/ambientaddons/features/misc/ThunderWarning.kt41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/main/kotlin/com/ambientaddons/features/misc/ThunderWarning.kt b/src/main/kotlin/com/ambientaddons/features/misc/ThunderWarning.kt
new file mode 100644
index 0000000..fb16c43
--- /dev/null
+++ b/src/main/kotlin/com/ambientaddons/features/misc/ThunderWarning.kt
@@ -0,0 +1,41 @@
+package com.ambientaddons.features.misc
+
+import AmbientAddons.Companion.config
+import AmbientAddons.Companion.mc
+import com.ambientaddons.utils.Extensions.items
+import com.ambientaddons.utils.Extensions.skyblockID
+import com.ambientaddons.utils.SBLocation
+import gg.essential.universal.UChat
+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 ThunderWarning {
+ private var hadChargedThunderBottle = false
+ private var ticks = 0
+
+ @SubscribeEvent
+ fun onWorldLoad(event: WorldEvent.Load) {
+ hadChargedThunderBottle = false
+ }
+
+ @SubscribeEvent
+ fun onTick(event: ClientTickEvent) {
+ if (!config.thunderWarning || !SBLocation.inSkyblock || event.phase != TickEvent.Phase.START) return
+ if (ticks % 10 == 0) {
+ if (hasChargedThunderBottle() && !hadChargedThunderBottle) {
+ mc.ingameGUI.displayTitle("§dThunder charged!", null, 5, 40, 5)
+ mc.ingameGUI.displayTitle(null, "", 5, 40, 5)
+ mc.ingameGUI.displayTitle(null, null, 5, 40, 5)
+ mc.thePlayer.playSound("random.orb", 1f, 0.5f)
+ }
+ hadChargedThunderBottle = hasChargedThunderBottle()
+ }
+ ticks++
+ }
+
+ private fun hasChargedThunderBottle(): Boolean =
+ mc.thePlayer?.inventory?.items?.any { it?.skyblockID == "THUNDER_IN_A_BOTTLE" } == true
+
+} \ No newline at end of file