Skip to content

Commit

Permalink
Fix rainbow math (#2619)
Browse files Browse the repository at this point in the history
  • Loading branch information
krossgg authored Dec 21, 2024
1 parent 54756e1 commit 6ac81a3
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public class TooltipHelper {
/**
* Returns a continually changing rainbow TextColor
*
* @param speed degrees of hue change per tick, or equivalently, number of complete hue cycles per 360 ticks
* @param speed degrees of hue change per tick
* @return Rainbow TextColor
*/
public static TextColor rainbowColor(float speed) {
return TextColor.fromRgb(GradientUtil.toRGB((GTValues.CLIENT_TIME % 360) * speed, 95f, 60f));
return TextColor.fromRgb(GradientUtil.toRGB((GTValues.CLIENT_TIME & ((1 << 20) - 1)) * speed, 95f, 60f));
}

public static final UnaryOperator<Style> RAINBOW_HSL = style -> style.withColor(rainbowColor(2.5f));
Expand Down

0 comments on commit 6ac81a3

Please sign in to comment.