mirror of https://github.com/kami-blue/client
[enhancement] Added sound to FriendHighlight. (#1600)
This commit is contained in:
parent
a971ff2751
commit
72cd9d9767
|
@ -9,6 +9,8 @@ import me.zeroeightsix.kami.util.color.ColorTextFormatting
|
|||
import me.zeroeightsix.kami.util.color.ColorTextFormatting.ColourCode
|
||||
import me.zeroeightsix.kami.util.event.listener
|
||||
import me.zeroeightsix.kami.util.text.MessageSendHelper
|
||||
import net.minecraft.client.audio.PositionedSoundRecord
|
||||
import net.minecraft.init.SoundEvents
|
||||
import net.minecraft.util.text.TextComponentString
|
||||
import net.minecraft.util.text.TextFormatting
|
||||
import net.minecraftforge.client.event.ClientChatReceivedEvent
|
||||
|
@ -22,6 +24,7 @@ import net.minecraftforge.client.event.ClientChatReceivedEvent
|
|||
object FriendHighlight : Module() {
|
||||
private val bold = register(Settings.b("Bold", true))
|
||||
private val colour = register(Settings.e<ColourCode>("Color", ColourCode.GRAY))
|
||||
private val sound = register(Settings.b("Sound", true))
|
||||
|
||||
private val regex1 = "<(.*?)>".toRegex()
|
||||
private val regex2 = "[<>]".toRegex()
|
||||
|
@ -38,6 +41,7 @@ object FriendHighlight : Module() {
|
|||
if (playerName == null || !FriendManager.isFriend(playerName)) return@listener
|
||||
val modified = it.message.formattedText.replaceFirst(playerName, getReplacement(playerName))
|
||||
val textComponent = TextComponentString(modified)
|
||||
if (sound.value) mc.getSoundHandler().playSound(PositionedSoundRecord.getRecord(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0f, 1.0f))
|
||||
|
||||
it.message = textComponent
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue