aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorCarsCupcake <84076092+CarsCupcake@users.noreply.github.com>2024-02-19 15:50:11 +0100
committerGitHub <noreply@github.com>2024-02-19 15:50:11 +0100
commitb065fc1113977529831be5eab587c1612efdde79 (patch)
tree545e04c7c76f9f3933a5451d3a5b0f16f3863189 /src/main/java/at/hannibal2/skyhanni/utils
parent96c657cbb5e1c9282911bb8b7b6f6239392ae07f (diff)
downloadskyhanni-b065fc1113977529831be5eab587c1612efdde79.tar.gz
skyhanni-b065fc1113977529831be5eab587c1612efdde79.tar.bz2
skyhanni-b065fc1113977529831be5eab587c1612efdde79.zip
Low Quiver Notification. #880
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt
index 42ca4ee00..f9a330f20 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt
@@ -1,5 +1,8 @@
package at.hannibal2.skyhanni.utils
+import at.hannibal2.skyhanni.SkyHanniMod
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.launch
import net.minecraft.client.Minecraft
import net.minecraft.client.audio.ISound
import net.minecraft.client.audio.PositionedSound
@@ -11,6 +14,7 @@ object SoundUtils {
private val beepSound by lazy { createSound("random.orb", 1f) }
private val clickSound by lazy { createSound("gui.button.press", 1f) }
private val errorSound by lazy { createSound("mob.endermen.portal", 0f) }
+ val plingSound by lazy { createSound("note.pling", 1f) }
val centuryActiveTimerAlert by lazy { createSound("skyhanni:centurytimer.active", 1f) }
fun ISound.playSound() {
@@ -57,6 +61,10 @@ object SoundUtils {
clickSound.playSound()
}
+ fun playPlingSound() {
+ plingSound.playSound()
+ }
+
fun command(args: Array<String>) {
if (args.isEmpty()) {
ChatUtils.userError("Specify a sound effect to test")
@@ -73,4 +81,13 @@ object SoundUtils {
fun playErrorSound() {
errorSound.playSound()
}
+
+ fun repeatSound(delay: Long, repeat: Int, sound: ISound) {
+ SkyHanniMod.coroutineScope.launch {
+ repeat(repeat) {
+ sound.playSound()
+ delay(delay)
+ }
+ }
+ }
}