File tree 1 file changed +31
-0
lines changed
src/main/kotlin/com/lambda/client/gui/hudgui/elements/player
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com.lambda.client.gui.hudgui.elements.player
2
+
3
+ import com.lambda.client.event.SafeClientEvent
4
+ import com.lambda.client.gui.hudgui.LabelHud
5
+ import com.lambda.client.util.color.ColorConverter
6
+ import com.lambda.client.util.text.RomanNumerals
7
+ import net.minecraft.potion.*
8
+ import net.minecraft.client.resources.I18n
9
+
10
+ internal object Effects : LabelHud(
11
+ name = " Effects" ,
12
+ category = Category .PLAYER ,
13
+ description = " Displays active effects"
14
+ ) {
15
+
16
+ private val romanNumerals by setting(" Roman Numerals" , true )
17
+ private val coloredEffectNames by setting(" Colored Effect Names" , true )
18
+
19
+ override fun SafeClientEvent.updateText () {
20
+ player.activePotionEffects.sortedBy { it.duration }.forEach {
21
+ val amplifier = if (romanNumerals) RomanNumerals .numberToRoman(it.amplifier + 1 ) else (it.amplifier + 1 ).toString()
22
+ val duration = Potion .getPotionDurationString(it, 1f )
23
+ val color = if (coloredEffectNames) ColorConverter .hexToRgb(it.potion.liquidColor) else secondaryColor
24
+ val name = I18n .format(it.potion.name)
25
+
26
+ displayText.add(name, color)
27
+ displayText.add(amplifier, primaryColor)
28
+ displayText.addLine(" (${duration} )" , primaryColor)
29
+ }
30
+ }
31
+ }
You can’t perform that action at this time.
0 commit comments