diff options
author | Appability <appable@icloud.com> | 2022-11-12 14:35:15 -0800 |
---|---|---|
committer | Appability <appable@icloud.com> | 2022-11-12 14:35:15 -0800 |
commit | de601769d8a1b5fc7543d5b0b4a95596db926416 (patch) | |
tree | 3fea24e9e4d55f93e00553e2a2ca9f6ecb1ef713 /src/main/kotlin/com/ambientaddons/features/misc/ThunderWarning.kt | |
parent | 2b21d3a18b412ec8c205beacf403f0147dc04618 (diff) | |
download | AmbientAddons-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.kt | 41 |
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 |