diff options
author | Alkalus <draknyte1@hotmail.com> | 2016-09-19 20:08:42 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-19 20:08:42 +1000 |
commit | 9f386c3c2914ba786ece2afddb8eaa6df80a1adc (patch) | |
tree | a46fe4cc2ccd26ff83f3de8eeba7d3abb7aea58c /src/Java/gtPlusPlus/core/util/Utils.java | |
parent | 6c74b062034508a0ef00a68c5b4c164b3f155fc4 (diff) | |
parent | 2c4e3716a4b72f67be3bde170096394a39c80480 (diff) | |
download | GT5-Unofficial-9f386c3c2914ba786ece2afddb8eaa6df80a1adc.tar.gz GT5-Unofficial-9f386c3c2914ba786ece2afddb8eaa6df80a1adc.tar.bz2 GT5-Unofficial-9f386c3c2914ba786ece2afddb8eaa6df80a1adc.zip |
Merge pull request #13 from draknyte1/NewMatSystem
New Back-end systems for dynamic Material (Alloys) and Tool generation.
Also fixes a few issues with other things, which were noticed during development of the new systems.
Diffstat (limited to 'src/Java/gtPlusPlus/core/util/Utils.java')
-rw-r--r-- | src/Java/gtPlusPlus/core/util/Utils.java | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java index 72c4632df2..42d6dc4ad4 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -213,10 +213,10 @@ public class Utils { /** * - * @param colorStr e.g. "#FFFFFF" + * @param colourStr e.g. "#FFFFFF" * @return String - formatted "rgb(0,0,0)" */ - public static String hex2Rgb(String hexString) { + public static String hex2RgbFormatted(String hexString) { Color c = new Color( Integer.valueOf(hexString.substring(1, 3), 16), Integer.valueOf(hexString.substring(3, 5), 16), @@ -232,6 +232,38 @@ public class Utils { sb.append(")"); return sb.toString(); } + + /** + * + * @param colourStr e.g. "#FFFFFF" + * @return + */ + public static Color hex2Rgb(String colorStr) { + return new Color( + Integer.valueOf( colorStr.substring( 1, 3 ), 16 ), + Integer.valueOf( colorStr.substring( 3, 5 ), 16 ), + Integer.valueOf( colorStr.substring( 5, 7 ), 16 ) ); + } + + /** + * + * @param colourInt e.g. 0XFFFFFF + * @return Colour + */ + public static Color hex2Rgb(int colourInt) { + return Color.decode(String.valueOf(colourInt)); + } + + /** + * + * @param colourInt e.g. 0XFFFFFF + * @return short[] + */ + public static short[] hex2RgbShort(int colourInt) { + Color rgb = Color.decode(String.valueOf(colourInt)); + short[] rgba = {(short) rgb.getRed(), (short) rgb.getGreen(), (short) rgb.getBlue(), (short) rgb.getAlpha()}; + return rgba; + } public static Timer ShortTimer(int seconds) { Timer timer; @@ -259,6 +291,11 @@ public class Utils { List<Object> targetList = new ArrayList<Object>(Arrays.asList(sourceArray)); return targetList; } + + public static List<Object> convertArrayListToList(ArrayList sourceArray) { + List<Object> targetList = new ArrayList<Object>(Arrays.asList(sourceArray)); + return targetList; + } public static EntityPlayer getPlayerOnServerFromUUID(UUID parUUID){ if (parUUID == null) @@ -524,6 +561,7 @@ public class Utils { temp = temp.replace("}", ""); temp = temp.replace("[", ""); temp = temp.replace("]", ""); + temp = temp.replace(" ", ""); output = temp; return output; |