From 91e18f54e4733c695ac023d87adfcef9e8dbbb4a Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Wed, 14 Sep 2016 01:10:02 +1000 Subject: Attempting to Rewrite the entire material system for future use (Also makes life easier if I do something similar in 1.10) --- src/Java/gtPlusPlus/core/util/Utils.java | 42 ++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) (limited to 'src/Java/gtPlusPlus/core/util/Utils.java') 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 targetList = new ArrayList(Arrays.asList(sourceArray)); return targetList; } + + public static List convertArrayListToList(ArrayList sourceArray) { + List targetList = new ArrayList(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; -- cgit