From 465bbc1901ba24453a7fde885d9e57ed23e56407 Mon Sep 17 00:00:00 2001 From: Wanja <105125277+Manchick0@users.noreply.github.com> Date: Sun, 22 Dec 2024 04:04:31 +0100 Subject: [PATCH] Clamp between 0 and 1 (#1088) * Clamp between 0 and 1 Updated the GameRenderMixin#getNightVisionStrength method to properly clamp the return value between 0 and 1, instead of 0 and 100. Added an additional check to reduce objectively pointless computation. * Use floats instead of doubles --- .../java/de/hysky/skyblocker/mixins/GameRendererMixin.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/hysky/skyblocker/mixins/GameRendererMixin.java b/src/main/java/de/hysky/skyblocker/mixins/GameRendererMixin.java index 36c76c4404..6c4fe75d86 100644 --- a/src/main/java/de/hysky/skyblocker/mixins/GameRendererMixin.java +++ b/src/main/java/de/hysky/skyblocker/mixins/GameRendererMixin.java @@ -14,7 +14,8 @@ public class GameRendererMixin { private static float onGetNightVisionStrength(float original) { if (original == 1.0F && Utils.isOnSkyblock()) { var strength = SkyblockerConfigManager.get().uiAndVisuals.nightVisionStrength; - return Math.clamp(strength / 100.0F, 0, 100); + if (strength == 0.0F) return 0.0F; + return Math.clamp(strength / 100.0F, 0, 1); } return original; }