aboutsummaryrefslogtreecommitdiff
path: root/src/Java/miscutil/core/util/Utils.java
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2016-04-03 18:14:21 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2016-04-03 18:14:21 +1000
commit915139115434ff5797df6f82a63578e938864016 (patch)
tree5e8f655e8e9cc8b1af2db2ae3fdbbedfb942ec39 /src/Java/miscutil/core/util/Utils.java
parent6e2d7b787d2338fd6e35532f91e6ff6a48eed682 (diff)
downloadGT5-Unofficial-915139115434ff5797df6f82a63578e938864016.tar.gz
GT5-Unofficial-915139115434ff5797df6f82a63578e938864016.tar.bz2
GT5-Unofficial-915139115434ff5797df6f82a63578e938864016.zip
Finally, Got everything working how I want. Only thing left to do is the anti-grief block.
Fixed Buffer Cores, now there is 10 tiers, all with a unique colour and recipe. Energy Buffers have had their recipes revised, due to new recipes for the cores. Steam condenser may need tweaking, but for now, I'll let it slide and players test it. Updated a few graphics too, the Staballoy Axe and Pickaxe, the Buffer Core and the New Hammer Tool all received visual updates. Compiled build and Dev. build will be up shortly.
Diffstat (limited to 'src/Java/miscutil/core/util/Utils.java')
-rw-r--r--src/Java/miscutil/core/util/Utils.java60
1 files changed, 41 insertions, 19 deletions
diff --git a/src/Java/miscutil/core/util/Utils.java b/src/Java/miscutil/core/util/Utils.java
index 10375f3f8e..a4b75d87d7 100644
--- a/src/Java/miscutil/core/util/Utils.java
+++ b/src/Java/miscutil/core/util/Utils.java
@@ -2,6 +2,7 @@ package miscutil.core.util;
import static gregtech.api.enums.GT_Values.F;
+import java.awt.Color;
import java.awt.Graphics;
import java.util.Random;
@@ -138,6 +139,12 @@ public class Utils {
return GameRegistry.findItem(fqrnSplit[0], fqrnSplit[1]);
}
+ public static ItemStack getItemStack(String fqrn, int Size) // fqrn = fully qualified resource name
+ {
+ String[] fqrnSplit = fqrn.split(":");
+ return GameRegistry.findItemStack(fqrnSplit[0], fqrnSplit[1], Size);
+ }
+
public static Item getItemInPlayersHand(){
Minecraft mc = Minecraft.getMinecraft();
Item heldItem = null;
@@ -146,28 +153,21 @@ public class Utils {
}catch(NullPointerException e){return null;}
if (heldItem != null){
- return heldItem;
- }
+ return heldItem;
+ }
return null;
- }
-
- 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),
- slot_1, slot_2, slot_3,
- slot_4, slot_5, slot_6,
- slot_7, slot_8, slot_9);
}
-
- public static void recipeBuilderItem(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, Item resultItem){
- GameRegistry.addRecipe(
- new ItemStack(resultItem),
- slot_1, slot_2, slot_3,
- slot_4, slot_5, slot_6,
- slot_7, slot_8, slot_9);
- }
-
+
+ /*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),
+ new Object[] {"ABC", "DEF", "GHI",
+ 'A',slot_1,'B',slot_2,'C',slot_3,
+ 'D',slot_4,'E',slot_5,'F',slot_6,
+ 'G',slot_7,'H',slot_8,'I',slot_9
+ });
+ }*/
+
public static String checkCorrectMiningToolForBlock(Block currentBlock, World currentWorld){
String correctTool = "";
if (!currentWorld.isRemote){
@@ -182,4 +182,26 @@ public class Utils {
return correctTool;
}
+
+ /**
+ *
+ * @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();
+ }
}