diff options
author | inglettronald <inglettronald@gmail.com> | 2023-06-05 13:53:26 -0500 |
---|---|---|
committer | inglettronald <inglettronald@gmail.com> | 2023-06-05 13:53:26 -0500 |
commit | 44daa2779ae9e9462af9b0c19cd6838bf94d165d (patch) | |
tree | 3b0e6652c72443f65be417d392976df0e63849f1 /src | |
parent | 27916b0a2cd045c61c156cb0439cb8ed9cf656f7 (diff) | |
download | DulkirMod-44daa2779ae9e9462af9b0c19cd6838bf94d165d.tar.gz DulkirMod-44daa2779ae9e9462af9b0c19cd6838bf94d165d.tar.bz2 DulkirMod-44daa2779ae9e9462af9b0c19cd6838bf94d165d.zip |
double hook impl
Diffstat (limited to 'src')
-rw-r--r-- | src/main/kotlin/dulkirmod/events/ChatEvent.kt | 2 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/features/chat/DoubleHookDing.kt | 20 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/main/kotlin/dulkirmod/events/ChatEvent.kt b/src/main/kotlin/dulkirmod/events/ChatEvent.kt index b66765b..52026e9 100644 --- a/src/main/kotlin/dulkirmod/events/ChatEvent.kt +++ b/src/main/kotlin/dulkirmod/events/ChatEvent.kt @@ -36,5 +36,7 @@ object ChatEvent { // Key Hud Element DungeonKeyDisplay.handle(unformatted) + + DoubleHookDing.handle(event, unformatted) } }
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/features/chat/DoubleHookDing.kt b/src/main/kotlin/dulkirmod/features/chat/DoubleHookDing.kt new file mode 100644 index 0000000..fa56966 --- /dev/null +++ b/src/main/kotlin/dulkirmod/features/chat/DoubleHookDing.kt @@ -0,0 +1,20 @@ +package dulkirmod.features.chat + +import dulkirmod.DulkirMod +import dulkirmod.config.DulkirConfig +import net.minecraft.client.audio.SoundCategory +import net.minecraftforge.client.event.ClientChatReceivedEvent + +object DoubleHookDing { + fun handle(event: ClientChatReceivedEvent, unformatted: String) { + if (unformatted.startsWith("It's a Double Hook!")) { + if (DulkirConfig.doubleHookDing) { + val prevNote = DulkirMod.mc.gameSettings.getSoundLevel(SoundCategory.RECORDS) + DulkirMod.mc.gameSettings.setSoundLevel(SoundCategory.RECORDS, 1f) + DulkirMod.mc.thePlayer.playSound("note.pling", 1f * DulkirConfig.secretSoundVolume, 1f) + DulkirMod.mc.gameSettings.setSoundLevel(SoundCategory.RECORDS, prevNote) + } + if (DulkirConfig.removeHookMessage) event.isCanceled = true + } + } +}
\ No newline at end of file |