From e428f5aca33d42bf35f6ee0dc8edc8df2cc753b3 Mon Sep 17 00:00:00 2001 From: olim88 Date: Mon, 3 Mar 2025 04:07:43 +0000 Subject: 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> --- .../de/hysky/skyblocker/utils/ColorUtilsTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/test/java/de/hysky/skyblocker/utils/ColorUtilsTest.java (limited to 'src/test/java') 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)); + } +} -- cgit