aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat/skyblockhud/SpecialColour.java
diff options
context:
space:
mode:
authorThatGravyBoat <thatgravyboat@gmail.com>2021-07-06 19:09:11 -0230
committerGitHub <noreply@github.com>2021-07-06 19:09:11 -0230
commit93248d28d6b314b42f6b0d82164975343b214ece (patch)
treee3e06c24454080f059355133d633e5a076d85ad3 /src/main/java/com/thatgravyboat/skyblockhud/SpecialColour.java
parent91464c8f433e8bf323932ac956678971207b607e (diff)
parent804767ebfc26e2a1252bc327def02389b35dfc6e (diff)
downloadSkyblockHud-Death-Defied-93248d28d6b314b42f6b0d82164975343b214ece.tar.gz
SkyblockHud-Death-Defied-93248d28d6b314b42f6b0d82164975343b214ece.tar.bz2
SkyblockHud-Death-Defied-93248d28d6b314b42f6b0d82164975343b214ece.zip
Merge pull request #2 from ThatGravyBoat/prettier
Add prettier settings and format code
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/SpecialColour.java')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/SpecialColour.java26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/SpecialColour.java b/src/main/java/com/thatgravyboat/skyblockhud/SpecialColour.java
index 8501c9d..38a48cc 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/SpecialColour.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/SpecialColour.java
@@ -25,9 +25,8 @@ public class SpecialColour {
int[] arr = new int[split.length];
-
- for(int i=0; i<split.length; i++) {
- arr[i] = Integer.parseInt(split[split.length-1-i], RADIX);
+ for (int i = 0; i < split.length; i++) {
+ arr[i] = Integer.parseInt(split[split.length - 1 - i], RADIX);
}
return arr;
}
@@ -40,7 +39,7 @@ public class SpecialColour {
int a = d[3];
int chr = d[4];
- return (a & 0xFF) << 24 | (r & 0xFF) << 16 | (g & 0xFF) << 8 | (b & 0xFF);
+ return ((a & 0xFF) << 24 | (r & 0xFF) << 16 | (g & 0xFF) << 8 | (b & 0xFF));
}
public static int getSpeed(String special) {
@@ -48,15 +47,16 @@ public class SpecialColour {
}
public static float getSecondsForSpeed(int speed) {
- return (255-speed)/254f*(MAX_CHROMA_SECS-MIN_CHROMA_SECS)+MIN_CHROMA_SECS;
+ return ((255 - speed) / 254f * (MAX_CHROMA_SECS - MIN_CHROMA_SECS) + MIN_CHROMA_SECS);
}
private static final int MIN_CHROMA_SECS = 1;
private static final int MAX_CHROMA_SECS = 60;
public static long startTime = -1;
+
public static int specialToChromaRGB(String special) {
- if(startTime < 0) startTime = System.currentTimeMillis();
+ if (startTime < 0) startTime = System.currentTimeMillis();
int[] d = decompose(special);
int chr = d[4];
@@ -67,14 +67,14 @@ public class SpecialColour {
float[] hsv = Color.RGBtoHSB(r, g, b, null);
- if(chr > 0) {
+ if (chr > 0) {
float seconds = getSecondsForSpeed(chr);
- hsv[0] += (System.currentTimeMillis()-startTime)/1000f/seconds;
+ hsv[0] += (System.currentTimeMillis() - startTime) / 1000f / seconds;
hsv[0] %= 1;
- if(hsv[0] < 0) hsv[0] += 1;
+ if (hsv[0] < 0) hsv[0] += 1;
}
- return (a & 0xFF) << 24 | (Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]) & 0x00FFFFFF);
+ return ((a & 0xFF) << 24 | (Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]) & 0x00FFFFFF));
}
public static int rotateHue(int argb, int degrees) {
@@ -85,11 +85,9 @@ public class SpecialColour {
float[] hsv = Color.RGBtoHSB(r, g, b, null);
- hsv[0] += degrees/360f;
+ hsv[0] += degrees / 360f;
hsv[0] %= 1;
- return (a & 0xFF) << 24 | (Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]) & 0x00FFFFFF);
+ return ((a & 0xFF) << 24 | (Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]) & 0x00FFFFFF));
}
-
-
}