aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorolim88 <bobq4582@gmail.com>2025-03-03 04:07:43 +0000
committerGitHub <noreply@github.com>2025-03-03 12:07:43 +0800
commite428f5aca33d42bf35f6ee0dc8edc8df2cc753b3 (patch)
tree8348e7d8043e2cbe9fd99f2052bf11e808d848b8 /src/test/java
parent9219939d0769b10f4ec504f57d98a60c24247185 (diff)
downloadSkyblocker-e428f5aca33d42bf35f6ee0dc8edc8df2cc753b3.tar.gz
Skyblocker-e428f5aca33d42bf35f6ee0dc8edc8df2cc753b3.tar.bz2
Skyblocker-e428f5aca33d42bf35f6ee0dc8edc8df2cc753b3.zip
Health bars (#1028)
* basic features working prototype for the feature * add config and main features * add option to show on mobs with only a health value also adds tooltips for options * clean up code and add more comments * increase default size * improve removing health code and incorrectly spell amour * show when the nametag is shown let it be rendered though walls if the nametag is being rendered * add suggested changes add fading between colours and fix problems * Disable depth test and cleanup * Migrate to oklab interpolation * Fix health bar alpha * Default off --------- Co-authored-by: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/de/hysky/skyblocker/utils/ColorUtilsTest.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/java/de/hysky/skyblocker/utils/ColorUtilsTest.java b/src/test/java/de/hysky/skyblocker/utils/ColorUtilsTest.java
new file mode 100644
index 00000000..bd250511
--- /dev/null
+++ b/src/test/java/de/hysky/skyblocker/utils/ColorUtilsTest.java
@@ -0,0 +1,19 @@
+package de.hysky.skyblocker.utils;
+
+import net.minecraft.util.math.ColorHelper;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class ColorUtilsTest {
+ @Test
+ void testFloatComponents() {
+ Assertions.assertArrayEquals(new float[]{0.2f, 0.4f, 0.6f}, ColorUtils.getFloatComponents(ColorHelper.getArgb(51, 102, 153)));
+ }
+
+ @Test
+ void testInterpolate() {
+ Assertions.assertEquals(0x00FE00, ColorUtils.interpolate(0.5, 0xFF0000, 0x00FF00, 0x0000FF));
+ Assertions.assertEquals(0xD0A800, ColorUtils.interpolate(0.25, 0xFF0000, 0x00FF00, 0x0000FF));
+ Assertions.assertEquals(0x00A9BE, ColorUtils.interpolate(0.75, 0xFF0000, 0x00FF00, 0x0000FF));
+ }
+}