Skip to content

Commit

Permalink
Clamp between 0 and 1 (#1088)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Manchick0 authored Dec 22, 2024
1 parent 3ea671e commit 465bbc1
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 465bbc1

Please sign in to comment.