Skip to content

Commit 56e07d1

Browse files
committed
feat: notifications color mode
1 parent 45145e7 commit 56e07d1

File tree

5 files changed

+64
-47
lines changed

5 files changed

+64
-47
lines changed

src/main/java/net/ccbluex/liquidbounce/features/module/modules/client/ClickGUIModule.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ object ClickGUIModule : Module("ClickGUI", Category.CLIENT, Keyboard.KEY_RSHIFT,
3737
val spacedModules by boolean("SpacedModules", false)
3838
val panelsForcedInBoundaries by boolean("PanelsForcedInBoundaries", false)
3939

40-
val headerColor by boolean("Header Color", false) { style == "FDP" }
40+
val headerColor by boolean("Header Color", true) { style == "FDP" }
4141

4242
val categoryOutline by boolean("Outline", true) { style == "FDP" }
4343

src/main/java/net/ccbluex/liquidbounce/features/module/modules/other/AnticheatDetector.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import net.ccbluex.liquidbounce.utils.client.chat
1717
import net.minecraft.network.play.server.S32PacketConfirmTransaction
1818
import net.minecraft.network.play.server.S01PacketJoinGame
1919

20-
object AnticheatDetector : Module("AnticheatDetector", Category.OTHER) {
20+
object AnticheatDetector : Module("AntiCheatDetector", Category.OTHER) {
21+
2122
private val debug by boolean("Debug", true)
2223
private val actionNumbers = mutableListOf<Int>()
2324
private var check = false
@@ -141,4 +142,8 @@ object AnticheatDetector : Module("AnticheatDetector", Category.OTHER) {
141142
check = false
142143
detectedACName = ""
143144
}
145+
146+
init {
147+
state = true
148+
}
144149
}

src/main/java/net/ccbluex/liquidbounce/features/module/modules/visual/HitBubbles.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ object HitBubbles : Module("HitBubbles", Category.VISUAL) {
2929
init {
3030
state = true
3131
}
32-
32+
3333
private val followHit by boolean("Follow Hit", true)
3434
private val dynamicRotation by boolean("Dynamic Rotation", false)
3535

@@ -49,8 +49,8 @@ object HitBubbles : Module("HitBubbles", Category.VISUAL) {
4949
val bubblePosition = target.positionVector.addVector(0.0, target.height / 1.6, 0.0)
5050

5151
val hitLocation = if (followHit) {
52-
val playerEyes = mc.thePlayer.getPositionEyes(1.0f)
53-
val playerLook = mc.thePlayer.getLook(1.0f)
52+
val playerEyes = mc.thePlayer?.getPositionEyes(1.0f) ?: return@handler
53+
val playerLook = mc.thePlayer?.getLook(1.0f) ?: return@handler
5454
playerEyes.addVector(
5555
playerLook.xCoord * 3.0,
5656
playerLook.yCoord * 3.0,

src/main/java/net/ccbluex/liquidbounce/ui/client/hud/element/elements/Notifications.kt

Lines changed: 53 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,26 @@
66
package net.ccbluex.liquidbounce.ui.client.hud.element.elements
77

88
import net.ccbluex.liquidbounce.FDPClient.hud
9-
import net.ccbluex.liquidbounce.config.IntValue
10-
import net.ccbluex.liquidbounce.config.ListValue
119
import net.ccbluex.liquidbounce.ui.client.hud.designer.GuiHudDesigner
1210
import net.ccbluex.liquidbounce.ui.client.hud.element.Border
1311
import net.ccbluex.liquidbounce.ui.client.hud.element.Element
1412
import net.ccbluex.liquidbounce.ui.client.hud.element.ElementInfo
1513
import net.ccbluex.liquidbounce.ui.client.hud.element.Side
16-
import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notifications.Companion.blue2Value
17-
import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notifications.Companion.blueValue
18-
import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notifications.Companion.green2Value
19-
import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notifications.Companion.greenValue
20-
import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notifications.Companion.red2Value
21-
import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notifications.Companion.redValue
2214
import net.ccbluex.liquidbounce.ui.font.Fonts
23-
import net.ccbluex.liquidbounce.ui.font.Fonts.fontSemibold35
2415
import net.ccbluex.liquidbounce.ui.font.Fonts.fontIconXD85
2516
import net.ccbluex.liquidbounce.ui.font.Fonts.fontNovoAngularIcon85
17+
import net.ccbluex.liquidbounce.ui.font.Fonts.fontSFUI35
18+
import net.ccbluex.liquidbounce.ui.font.Fonts.fontSFUI40
19+
import net.ccbluex.liquidbounce.ui.font.Fonts.fontSemibold35
2620
import net.ccbluex.liquidbounce.utils.io.APIConnectorUtils
27-
import net.ccbluex.liquidbounce.utils.render.shader.UIEffectRenderer.drawShadowWithCustomAlpha
2821
import net.ccbluex.liquidbounce.utils.render.RenderUtils
2922
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawRect
3023
import net.ccbluex.liquidbounce.utils.render.Stencil
3124
import net.ccbluex.liquidbounce.utils.render.animation.AnimationUtil.easeInBackNotify
3225
import net.ccbluex.liquidbounce.utils.render.animation.AnimationUtil.easeOutBackNotify
33-
import net.ccbluex.liquidbounce.ui.font.Fonts.fontSFUI35
34-
import net.ccbluex.liquidbounce.ui.font.Fonts.fontSFUI40
26+
import net.ccbluex.liquidbounce.utils.render.ColorUtils.fade
27+
import net.ccbluex.liquidbounce.utils.client.ClientThemesUtils.getColor
28+
import net.ccbluex.liquidbounce.utils.render.shader.UIEffectRenderer.drawShadowWithCustomAlpha
3529
import net.minecraft.client.renderer.GlStateManager
3630
import net.minecraft.client.renderer.GlStateManager.resetColor
3731
import org.lwjgl.opengl.GL11
@@ -57,24 +51,20 @@ class Notifications(
5751
*/
5852
private val exampleNotification = Notification("Notification", "This is an example notification.", Type.INFO)
5953

60-
companion object {
61-
val styleValue by ListValue("Mode", arrayOf("ZAVZ", "CLASSIC", "IDE"), "ZAVZ")
62-
val redValue by IntValue("Red", 255, 0..255).apply {
63-
setSupport { styleValue == "ZAVZ" } }
64-
val greenValue by IntValue("Green", 0, 0..255).apply {
65-
setSupport { styleValue == "ZAVZ" } }
66-
val blueValue by IntValue("Blue", 84, 0..255).apply {
67-
setSupport { styleValue == "ZAVZ" } }
68-
val red2Value by IntValue("Red2", 0, 0..255).apply {
69-
setSupport { styleValue == "ZAVZ" } }
70-
val green2Value by IntValue("Green2", 19, 0..255).apply {
71-
setSupport { styleValue == "ZAVZ" } }
72-
val blue2Value by IntValue("Blue2", 0, 0..255).apply {
73-
setSupport { styleValue == "ZAVZ" } }
74-
75-
val alphaValue by IntValue("Alpha", 0, 0..255).apply {
76-
setSupport { styleValue == "ZAVZ" } }
77-
}
54+
private val styleValue by choices(
55+
"Mode", arrayOf("ZAVZ", "CLASSIC", "IDE"), "ZAVZ"
56+
)
57+
58+
private val colorMode by choices(
59+
"Color-Mode", arrayOf("Custom", "Fade", "Theme"), "Custom"
60+
)
61+
62+
private val customColor1 by color("Custom-Color-1", Color(0xFF0054).rgb) { colorMode == "Custom" }
63+
private val customColor2 by color("Custom-Color-2", Color(0x001300).rgb) { colorMode == "Custom" }
64+
65+
private val fadeColor1 by color("Fade-Color-1", Color(0xFF0054).rgb) { colorMode == "Fade" }
66+
private val fadeColor2 by color("Fade-Color-2", Color(0x001300).rgb) { colorMode == "Fade" }
67+
private val fadeDistance by int("Fade-Distance", 50, 0..100) { colorMode == "Fade" }
7868

7969
/**
8070
* Draw element
@@ -84,7 +74,30 @@ class Notifications(
8474
for ((index, notification) in hud.notifications.withIndex()) {
8575
GL11.glPushMatrix()
8676

87-
if (notification.drawNotification(index, Companion, renderX.toFloat(), renderY.toFloat())) {
77+
val color1: Int
78+
val color2: Int
79+
80+
when (colorMode) {
81+
"Custom" -> {
82+
color1 = customColor1.rgb
83+
color2 = customColor2.rgb
84+
}
85+
"Fade" -> {
86+
color1 = fade(fadeColor1, index * fadeDistance, 100).rgb
87+
color2 = fade(fadeColor2, index * fadeDistance, 100).rgb
88+
}
89+
"Theme" -> {
90+
val themeColor = getColor(index).rgb
91+
color1 = themeColor
92+
color2 = themeColor
93+
}
94+
else -> {
95+
color1 = customColor1.rgb
96+
color2 = customColor2.rgb
97+
}
98+
}
99+
100+
if (notification.drawNotification(index, styleValue, color1, color2)) {
88101
notificationsToRemove.add(notification)
89102
}
90103

@@ -104,7 +117,7 @@ class Notifications(
104117
"IDE" -> Border(-180F, -30F, 0F, 0F)
105118
"ZAVZ" -> Border(-185F, -30F, 0F, 0F)
106119
"CLASSIC" -> Border(0F, -30F, 135F, 0F)
107-
else -> Border(-exampleNotification.width.toFloat(), exampleNotification.height.toFloat(), 0F, 0F)
120+
else -> Border(-exampleNotification.width.toFloat(), -exampleNotification.height.toFloat(), 0F, 0F)
108121
}
109122
}
110123

@@ -137,12 +150,11 @@ class Notification(
137150
/**
138151
* Draw notification
139152
*/
140-
fun drawNotification(index: Int, parent: Notifications.Companion, originalX: Float, originalY: Float): Boolean {
153+
fun drawNotification(index: Int, style: String, colorValue1: Int, colorValue2: Int): Boolean {
141154
resetColor()
142155
glColor4f(1f, 1f, 1f, 1f)
143156

144157
val nowTime = System.currentTimeMillis()
145-
val style = parent.styleValue
146158
val realY = -(index + 1) * height
147159
var pct = (nowTime - animeXTime) / animeTime.toDouble()
148160

@@ -193,7 +205,7 @@ class Notification(
193205
}
194206
}
195207

196-
drawRect(0F, 0F, width.toFloat(), height.toFloat(), Color(0, 0, 0, parent.alphaValue))
208+
drawRect(0F, 0F, width.toFloat(), height.toFloat(), Color(0, 0, 0, 150)) // Reduced alpha for better visibility
197209
drawShadowWithCustomAlpha(0F, 0F, width.toFloat(), height.toFloat(), 240f)
198210
drawRect(
199211
0F,
@@ -395,7 +407,7 @@ class Notification(
395407

396408
// Rendering shapes and elements
397409
RenderUtils.drawShadow(1F, 0F, width.toFloat() - 1, height.toFloat())
398-
drawRect(1F, 0F, width.toFloat(), height.toFloat(), Color(0, 0, 0, 50))
410+
drawRect(1F, 0F, width.toFloat(), height.toFloat(), Color(0, 0, 0, 150)) // Reduced alpha for better visibility
399411

400412
// Draw Circle Function
401413
fun drawCircle(x: Float, y: Float, radius: Float, start: Int, end: Int) {
@@ -413,8 +425,8 @@ class Notification(
413425
var i = end.toFloat()
414426
while (i >= start) {
415427
val c = RenderUtils.getGradientOffset(
416-
Color(redValue, greenValue, blueValue),
417-
Color(red2Value, green2Value, blue2Value, 1),
428+
Color(colorValue1),
429+
Color(colorValue2, true),
418430
(abs(System.currentTimeMillis() / 360.0 + (i * 34 / 360) * 56 / 100) / 10)
419431
).rgb
420432
val f2 = (c shr 24 and 255).toFloat() / 255.0f
@@ -441,8 +453,8 @@ class Notification(
441453
height.toFloat() + 0.0,
442454
width * ((nowTime - displayTime) / (animeTime * 2F + time)) + 0.0,
443455
height.toFloat() + 2.0,
444-
Color(redValue, greenValue, blueValue).rgb,
445-
Color(red2Value, green2Value, blue2Value).rgb
456+
colorValue1,
457+
colorValue2
446458
)
447459
drawCircle(16f, 15f, 13f, 0, 360)
448460

@@ -483,4 +495,4 @@ enum class Type(var renderColor: Color) {
483495
SUCCESS(Color(0x60E066)), ERROR(Color(0xFF2F3A)), WARNING(Color(0xF5FD00)), INFO(Color(106, 106, 220));
484496
}
485497

486-
enum class FadeState { IN, STAY, OUT, END }
498+
enum class FadeState { IN, STAY, OUT, END }

src/main/java/net/ccbluex/liquidbounce/utils/client/ClientThemesUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ object ClientThemesUtils {
2121
* The selected color mode (e.g., "Zywl", "Water", "Magic", etc.).
2222
* Now a normal var with a default value "FDP".
2323
*/
24-
var ClientColorMode: String = "Reef"
24+
var ClientColorMode: String = "MoonPurple"
2525
set(value) {
2626
field = value.lowercase()
2727
}

0 commit comments

Comments
 (0)