aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/util/SpecialColour.java
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-10-16 15:50:41 -0400
committerGitHub <noreply@github.com>2021-10-16 15:50:41 -0400
commit7c00af18febf6c0b833c7633b4fb60a9a1bb93af (patch)
treef02de145362d6a1399651ade4a130d565d7f0ba3 /src/main/java/io/github/moulberry/notenoughupdates/util/SpecialColour.java
parentb11742988dec635b5c5da7c2363803cbfafb37b1 (diff)
downloadnotenoughupdates-7c00af18febf6c0b833c7633b4fb60a9a1bb93af.tar.gz
notenoughupdates-7c00af18febf6c0b833c7633b4fb60a9a1bb93af.tar.bz2
notenoughupdates-7c00af18febf6c0b833c7633b4fb60a9a1bb93af.zip
Code Clean Up (#2)
* intellij code clean up * optimize imports * format * intellij suggestions * fix empty catch issues
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/SpecialColour.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/SpecialColour.java19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/SpecialColour.java b/src/main/java/io/github/moulberry/notenoughupdates/util/SpecialColour.java
index 5bcd23c3..50f22382 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/SpecialColour.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/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;
}
@@ -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,11 +67,11 @@ 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);
@@ -85,11 +85,10 @@ 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);
}
-
}