Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
TejasLamba2006 committed Jul 18, 2024
1 parent 3db441c commit ac8d071
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/main/java/keystrokesmod/utility/render/ColorUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@
import net.minecraft.client.renderer.GlStateManager;

import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

public class ColorUtils {
public static final List<AnimationUtils> animation = new ArrayList<>(Collections.nCopies(18, new AnimationUtils(0.0F)));
public static final List<AnimationUtils> animation = new ArrayList<>();

static {
for (int i = 0; i < 18; i++) {
animation.add(new AnimationUtils(0.0F));
}
}
// fixing this never >:(
private static final Pattern COLOR_PATTERN = Pattern.compile("(?i)§[0-9A-FK-OR]");

Expand All @@ -24,26 +32,25 @@ public static Color getBackgroundColor(int id) {
return new Color(255, 0, 255);
}
}
}

public static Color getFontColor(int id, int alpha) {
Color rawColor = getRawFontColor(id);
int speed = 12;

if (id == 1) {
animation[12].setAnimation(rawColor.getRed(), speed);
animation[13].setAnimation(rawColor.getGreen(), speed);
animation[14].setAnimation(rawColor.getBlue(), speed);
animation.get(12).setAnimation(rawColor.getRed(), speed);
animation.get(13).setAnimation(rawColor.getGreen(), speed);
animation.get(14).setAnimation(rawColor.getBlue(), speed);

return new Color((int) animation[12].getValue(), (int) animation[13].getValue(), (int) animation[14].getValue(), alpha);
return new Color((int) animation.get(12).getValue(), (int) animation.get(13).getValue(), (int) animation.get(14).getValue(), alpha);
}

if (id == 2) {
animation[15].setAnimation(rawColor.getRed(), speed);
animation[16].setAnimation(rawColor.getGreen(), speed);
animation[17].setAnimation(rawColor.getBlue(), speed);
animation.get(15).setAnimation(rawColor.getRed(), speed);
animation.get(16).setAnimation(rawColor.getGreen(), speed);
animation.get(17).setAnimation(rawColor.getBlue(), speed);

return new Color((int) animation[15].getValue(), (int) animation[16].getValue(), (int) animation[17].getValue(), alpha);
return new Color((int) animation.get(15).getValue(), (int) animation.get(16).getValue(), (int) animation.get(17).getValue(), alpha);
}

return rawColor;
Expand Down

0 comments on commit ac8d071

Please sign in to comment.