diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-05-23 08:03:30 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-05-23 08:03:30 +1000 |
commit | b1c08c2131c5c58e81ba9a6ae10e3738ae7025b4 (patch) | |
tree | 47315845db808283079231d3d86be32800de3fc1 /src/Java/miscutil/core/util | |
parent | dce34f9ba22f173b7bf5d7c9669cf29120f14e3a (diff) | |
download | GT5-Unofficial-b1c08c2131c5c58e81ba9a6ae10e3738ae7025b4.tar.gz GT5-Unofficial-b1c08c2131c5c58e81ba9a6ae10e3738ae7025b4.tar.bz2 GT5-Unofficial-b1c08c2131c5c58e81ba9a6ae10e3738ae7025b4.zip |
Forgot to Commit before the weekend.. Not sure what I change, but making this as a rollback point/changelog.
Diffstat (limited to 'src/Java/miscutil/core/util')
-rw-r--r-- | src/Java/miscutil/core/util/Utils.java | 56 |
1 files changed, 36 insertions, 20 deletions
diff --git a/src/Java/miscutil/core/util/Utils.java b/src/Java/miscutil/core/util/Utils.java index c79a69b791..4e303c8e39 100644 --- a/src/Java/miscutil/core/util/Utils.java +++ b/src/Java/miscutil/core/util/Utils.java @@ -130,7 +130,7 @@ public class Utils { return FluidRegistry.getFluidStack("ic2steam", (int)aAmount); } - + /*public static void recipeBuilderBlock(ItemStack slot_1, ItemStack slot_2, ItemStack slot_3, ItemStack slot_4, ItemStack slot_5, ItemStack slot_6, ItemStack slot_7, ItemStack slot_8, ItemStack slot_9, Block resultBlock){ GameRegistry.addRecipe(new ItemStack(resultBlock), @@ -155,26 +155,42 @@ public class Utils { return correctTool; } - + /** - * - * @param colorStr e.g. "#FFFFFF" - * @return String - formatted "rgb(0,0,0)" - */ + * + * @param colorStr e.g. "#FFFFFF" + * @return String - formatted "rgb(0,0,0)" + */ public static String hex2Rgb(String hexString) { - Color c = new Color( - Integer.valueOf(hexString.substring(1, 3), 16), - Integer.valueOf(hexString.substring(3, 5), 16), - Integer.valueOf(hexString.substring(5, 7), 16)); - - StringBuffer sb = new StringBuffer(); - sb.append("rgb("); - sb.append(c.getRed()); - sb.append(","); - sb.append(c.getGreen()); - sb.append(","); - sb.append(c.getBlue()); - sb.append(")"); - return sb.toString(); + Color c = new Color( + Integer.valueOf(hexString.substring(1, 3), 16), + Integer.valueOf(hexString.substring(3, 5), 16), + Integer.valueOf(hexString.substring(5, 7), 16)); + + StringBuffer sb = new StringBuffer(); + sb.append("rgb("); + sb.append(c.getRed()); + sb.append(","); + sb.append(c.getGreen()); + sb.append(","); + sb.append(c.getBlue()); + sb.append(")"); + return sb.toString(); + } + + //Smooth Rounding Function + public static double decimalRounding(double d) { + return Math.round(d * 2) / 2.0; + } + + //Smooth Rounding Function (Nearest 5) + public static double decimalRoundingToWholes(double d) { + return 5*(Math.round(d/5)); + } + + //Converts temps for GT machines, then rounds for ease of use. + public static float celsiusToKelvin(int i){ + double f = i + 273.15F; + return (int)decimalRoundingToWholes(f); } } |