diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core/util')
36 files changed, 4301 insertions, 3679 deletions
diff --git a/src/Java/gtPlusPlus/core/util/BaseHandler.java b/src/Java/gtPlusPlus/core/util/BaseHandler.java index 63f22f3763..e8fb919ab0 100644 --- a/src/Java/gtPlusPlus/core/util/BaseHandler.java +++ b/src/Java/gtPlusPlus/core/util/BaseHandler.java @@ -2,10 +2,10 @@ package gtPlusPlus.core.util; public abstract class BaseHandler { - public abstract void preInit(); - public abstract void init(); - + public abstract void postInit(); - + + public abstract void preInit(); + } diff --git a/src/Java/gtPlusPlus/core/util/ClassUtils.java b/src/Java/gtPlusPlus/core/util/ClassUtils.java index dfd8ec898b..e58c2f2785 100644 --- a/src/Java/gtPlusPlus/core/util/ClassUtils.java +++ b/src/Java/gtPlusPlus/core/util/ClassUtils.java @@ -4,65 +4,53 @@ import java.lang.reflect.*; public class ClassUtils { - - /*@ if (isPresent("com.optionaldependency.DependencyClass")) { - // This block will never execute when the dependency is not present - // There is therefore no more risk of code throwing NoClassDefFoundException. - executeCodeLinkingToDependency(); - }*/ - public static boolean isPresent(String className) { - try { - Class.forName(className); - return true; - } catch (Throwable ex) { - // Class or one of its dependencies is not present... - return false; - } - } - - public static Method getMethodViaReflection(Class<?> lookupClass, String methodName, boolean invoke) throws Exception{ - Class<? extends Class> lookup = lookupClass.getClass(); - Method m = lookup.getDeclaredMethod(methodName); - m.setAccessible(true);// Abracadabra - if (invoke){ + public static Method getMethodViaReflection(final Class<?> lookupClass, final String methodName, + final boolean invoke) throws Exception { + final Class<? extends Class> lookup = lookupClass.getClass(); + final Method m = lookup.getDeclaredMethod(methodName); + m.setAccessible(true);// Abracadabra + if (invoke) { m.invoke(lookup);// now its OK } return m; } - public static Class getNonPublicClass(String className){ + public static Class getNonPublicClass(final String className) { Class<?> c = null; try { c = Class.forName(className); - } catch (ClassNotFoundException e) { + } + catch (final ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } - //full package name --------^^^^^^^^^^ - //or simpler without Class.forName: - //Class<package1.A> c = package1.A.class; + // full package name --------^^^^^^^^^^ + // or simpler without Class.forName: + // Class<package1.A> c = package1.A.class; - if (null != c){ - //In our case we need to use + if (null != c) { + // In our case we need to use Constructor<?> constructor = null; try { constructor = c.getDeclaredConstructor(); - } catch (NoSuchMethodException | SecurityException e) { + } + catch (NoSuchMethodException | SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } - //note: getConstructor() can return only public constructors - //so we needed to search for any Declared constructor + // note: getConstructor() can return only public constructors + // so we needed to search for any Declared constructor - //now we need to make this constructor accessible - if (null != constructor){ - constructor.setAccessible(true);//ABRACADABRA! + // now we need to make this constructor accessible + if (null != constructor) { + constructor.setAccessible(true);// ABRACADABRA! try { - Object o = constructor.newInstance(); + final Object o = constructor.newInstance(); return (Class) o; - } catch (InstantiationException | IllegalAccessException - | IllegalArgumentException | InvocationTargetException e) { + } + catch (InstantiationException | IllegalAccessException | IllegalArgumentException + | InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } @@ -71,6 +59,21 @@ public class ClassUtils { return null; } - + /* + * @ if (isPresent("com.optionaldependency.DependencyClass")) { // This + * block will never execute when the dependency is not present // There is + * therefore no more risk of code throwing NoClassDefFoundException. + * executeCodeLinkingToDependency(); } + */ + public static boolean isPresent(final String className) { + try { + Class.forName(className); + return true; + } + catch (final Throwable ex) { + // Class or one of its dependencies is not present... + return false; + } + } } diff --git a/src/Java/gtPlusPlus/core/util/Log.java b/src/Java/gtPlusPlus/core/util/Log.java index ea7076e453..460f8598dc 100644 --- a/src/Java/gtPlusPlus/core/util/Log.java +++ b/src/Java/gtPlusPlus/core/util/Log.java @@ -3,27 +3,22 @@ package gtPlusPlus.core.util; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -public final class Log -{ - public static final Logger LOGGER = LogManager.getLogger("MiscUtils"); - - public static void warn(String msg) - { - LOGGER.warn(msg); - } - - public static void error(String msg) - { - LOGGER.error(msg); - } - - public static void info(String msg) - { - LOGGER.info(msg); - } - - public static void debug(String msg) - { - LOGGER.debug(msg); - } +public final class Log { + public static final Logger LOGGER = LogManager.getLogger("MiscUtils"); + + public static void debug(final String msg) { + Log.LOGGER.debug(msg); + } + + public static void error(final String msg) { + Log.LOGGER.error(msg); + } + + public static void info(final String msg) { + Log.LOGGER.info(msg); + } + + public static void warn(final String msg) { + Log.LOGGER.warn(msg); + } } diff --git a/src/Java/gtPlusPlus/core/util/LoggingUtils.java b/src/Java/gtPlusPlus/core/util/LoggingUtils.java index 607771bc8e..ffae71c40d 100644 --- a/src/Java/gtPlusPlus/core/util/LoggingUtils.java +++ b/src/Java/gtPlusPlus/core/util/LoggingUtils.java @@ -5,47 +5,48 @@ import java.util.Date; public class LoggingUtils { - public static void profileLog(Object o){ - try { + public static boolean logCurrentSystemTime(final String message) { + final Date date = new Date(System.currentTimeMillis()); + try { + LoggingUtils.profileLog(message + " | " + date.toString()); + return true; + } + catch (final Throwable r) { + return false; + } + + } + + public static void profileLog(final Object o) { + try { String content; - File file = new File("GregtechTimingsTC.txt"); + final File file = new File("GregtechTimingsTC.txt"); // if file doesnt exists, then create it if (!file.exists()) { file.createNewFile(); - FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); - BufferedWriter bw = new BufferedWriter(fw); + final FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); + final BufferedWriter bw = new BufferedWriter(fw); bw.write("============================================================"); bw.write(System.lineSeparator()); bw.close(); - } - if (o instanceof String){ + } + if (o instanceof String) { content = (String) o; - } - else { - content = o.toString(); - } - FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); - BufferedWriter bw = new BufferedWriter(fw); + } + else { + content = o.toString(); + } + final FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); + final BufferedWriter bw = new BufferedWriter(fw); bw.write(content); bw.write(System.lineSeparator()); bw.close(); System.out.println("Data Logged."); - } catch (IOException e) { + } + catch (final IOException e) { System.out.println("Data logging failed."); } - } - - public static boolean logCurrentSystemTime(String message){ - Date date = new Date(System.currentTimeMillis()); - try { - profileLog(message+" | "+date.toString()); - return true; - } - catch (Throwable r) { - return false; - } - } - + } diff --git a/src/Java/gtPlusPlus/core/util/Quality.java b/src/Java/gtPlusPlus/core/util/Quality.java index 1ce29c7a58..50d1b9fc90 100644 --- a/src/Java/gtPlusPlus/core/util/Quality.java +++ b/src/Java/gtPlusPlus/core/util/Quality.java @@ -4,56 +4,65 @@ import gtPlusPlus.core.util.math.MathUtils; import net.minecraft.util.EnumChatFormatting; public enum Quality { - + // Magic Blue // Rare Yellow // Set Green // Unique Gold/Purple // Trade-off Brown - - POOR("Poor", EnumChatFormatting.GRAY), - COMMON("Common", EnumChatFormatting.WHITE), - UNCOMMON("Uncommon", EnumChatFormatting.DARK_GREEN), - MAGIC("Magic", EnumChatFormatting.BLUE), - RARE("Rare", EnumChatFormatting.YELLOW), - UNIQUE("Unique", EnumChatFormatting.GOLD), - ARTIFACT("Artifact", EnumChatFormatting.AQUA), - SET("Set Piece", EnumChatFormatting.GREEN), - TRADEOFF("Trade-off", EnumChatFormatting.DARK_RED), - EPIC("Epic", EnumChatFormatting.LIGHT_PURPLE); - - private String LOOT; - private EnumChatFormatting COLOUR; - private Quality (final String lootTier, final EnumChatFormatting tooltipColour) - { + + POOR("Poor", EnumChatFormatting.GRAY), COMMON("Common", EnumChatFormatting.WHITE), UNCOMMON("Uncommon", + EnumChatFormatting.DARK_GREEN), MAGIC("Magic", EnumChatFormatting.BLUE), RARE("Rare", + EnumChatFormatting.YELLOW), UNIQUE("Unique", EnumChatFormatting.GOLD), ARTIFACT("Artifact", + EnumChatFormatting.AQUA), SET("Set Piece", EnumChatFormatting.GREEN), TRADEOFF("Trade-off", + EnumChatFormatting.DARK_RED), EPIC("Epic", EnumChatFormatting.LIGHT_PURPLE); + + public static Quality getRandomQuality() { + final int lootChance = MathUtils.randInt(0, 100); + if (lootChance <= 10) { + return Quality.POOR; + } + else if (lootChance <= 45) { + return Quality.COMMON; + } + else if (lootChance <= 65) { + return Quality.UNCOMMON; + } + else if (lootChance <= 82) { + return Quality.MAGIC; + } + else if (lootChance <= 92) { + return Quality.EPIC; + } + else if (lootChance <= 97) { + return Quality.RARE; + } + else if (lootChance <= 99) { + return Quality.ARTIFACT; + } + else { + return null; + } + } + private String LOOT; + + private EnumChatFormatting COLOUR; + + private Quality(final String lootTier, final EnumChatFormatting tooltipColour) { this.LOOT = lootTier; this.COLOUR = tooltipColour; } - public String getQuality() { - return LOOT; + public String formatted() { + return this.COLOUR + this.LOOT; } - - protected EnumChatFormatting getColour(){ - return COLOUR; - } - - public String formatted(){ - return this.COLOUR+this.LOOT; + + protected EnumChatFormatting getColour() { + return this.COLOUR; } - - public static Quality getRandomQuality(){ - int lootChance = MathUtils.randInt(0, 100); - if (lootChance <= 10){return Quality.POOR;} - else if (lootChance <= 45){return Quality.COMMON;} - else if (lootChance <= 65){return Quality.UNCOMMON;} - else if (lootChance <= 82){return Quality.MAGIC;} - else if (lootChance <= 92){return Quality.EPIC;} - else if (lootChance <= 97){return Quality.RARE;} - else if (lootChance <= 99){return Quality.ARTIFACT;} - else return null; + + public String getQuality() { + return this.LOOT; } } - - diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java index 03d3d68044..e65e0f2ea9 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -31,207 +31,274 @@ import net.minecraftforge.oredict.OreDictionary; public class Utils { - public static final int WILDCARD_VALUE = Short.MAX_VALUE; - - public static final boolean isServer(){ - return FMLCommonHandler.instance().getEffectiveSide().isServer(); - } - static class ShortTimerTask extends TimerTask { @Override public void run() { Utils.LOG_WARNING("Timer expired."); } } - - public static boolean isModUpToDate(){ - - if (CORE.MASTER_VERSION.equals(CORE.VERSION.toLowerCase())){ - return true; - } + + public static final int WILDCARD_VALUE = Short.MAX_VALUE; + + private static short cellID = 15; + + public static Integer appenedHexNotationToInteger(final int hexAsStringOrInt) { + final String hexChar = "0x"; + String result; + Utils.LOG_INFO(String.valueOf(hexAsStringOrInt)); + result = hexChar + String.valueOf(hexAsStringOrInt); + return Integer.getInteger(result); + } + + public static String appenedHexNotationToString(final Object hexAsStringOrInt) { + final String hexChar = "0x"; + String result; + if (hexAsStringOrInt.getClass() == String.class) { + + if (((String) hexAsStringOrInt).length() != 6) { + final String temp = Utils.leftPadWithZeroes((String) hexAsStringOrInt, 6); + result = temp; + } + result = hexChar + hexAsStringOrInt; + return result; + } + else if (hexAsStringOrInt.getClass() == Integer.class) { + ; + if (((String) hexAsStringOrInt).length() != 6) { + final String temp = Utils.leftPadWithZeroes((String) hexAsStringOrInt, 6); + result = temp; + } + result = hexChar + String.valueOf(hexAsStringOrInt); + return result; + } + else { + return null; + } + } + + public static String byteToHex(final byte b) { + final int i = b & 0xFF; + return Integer.toHexString(i); + } + + public static String checkCorrectMiningToolForBlock(final Block currentBlock, final World currentWorld) { + String correctTool = ""; + if (!currentWorld.isRemote) { + try { + correctTool = currentBlock.getHarvestTool(0); + Utils.LOG_WARNING(correctTool); + + } + catch (final NullPointerException e) { + + } + } + + return correctTool; + } + + public static boolean containsMatch(final boolean strict, final ItemStack[] inputs, final ItemStack... targets) { + for (final ItemStack input : inputs) { + for (final ItemStack target : targets) { + if (Utils.itemMatches(target, input, strict)) { + return true; + } + } + } return false; } - - public static TC_AspectStack getTcAspectStack (TC_Aspects aspect, long size){ - return getTcAspectStack(aspect.name(), (int) size); + + public static List<Object> convertArrayListToList(final ArrayList sourceArray) { + final List<Object> targetList = new ArrayList<Object>(Arrays.asList(sourceArray)); + return targetList; + } + + public static List<Object> convertArrayToFixedSizeList(final Object[] sourceArray) { + final List<Object> targetList = Arrays.asList(sourceArray); + return targetList; + } + + public static List<Object> convertArrayToList(final Object[] sourceArray) { + final List<Object> targetList = new ArrayList<Object>(Arrays.asList(sourceArray)); + return targetList; + } + + public static Object[] convertListToArray(final List<Object> sourceList) { + final Object[] targetArray = sourceList.toArray(new Object[sourceList.size()]); + return targetArray; + } + + public static ItemStack createInternalNameAndFluidCell(final String s) { + Utils.LOG_WARNING("1"); + final InternalName yourName = EnumHelper.addEnum(InternalName.class, s, new Class[0], new Object[0]); + Utils.LOG_WARNING("2 " + yourName.name()); + final ItemCell item = (ItemCell) Ic2Items.cell.getItem(); + Utils.LOG_WARNING("3 " + item.getUnlocalizedName()); + try { + Utils.LOG_WARNING("4"); + final Class<? extends ItemCell> clz = item.getClass(); + Utils.LOG_WARNING("5 " + clz.getSimpleName()); + final Method methode = clz.getDeclaredMethod("addCell", int.class, InternalName.class, Block[].class); + Utils.LOG_WARNING("6 " + methode.getName()); + methode.setAccessible(true); + Utils.LOG_WARNING("7 " + methode.isAccessible()); + final ItemStack temp = (ItemStack) methode.invoke(item, Utils.cellID++, yourName, new Block[0]); + Utils.LOG_INFO("Successfully created " + temp.getDisplayName() + "s."); + FluidContainerRegistry.registerFluidContainer(FluidUtils.getFluidStack(s.toLowerCase(), 0), temp.copy(), + Ic2Items.cell.copy()); + ItemUtils.addItemToOreDictionary(temp.copy(), "cell" + s); + return temp; + } + catch (final Exception e) { + e.printStackTrace(); + } + return null; + } + + public static boolean doesEntryExistAlreadyInOreDictionary(final String OreDictName) { + if (OreDictionary.getOres(OreDictName).size() != 0) { + return true; + } + return false; } - - public static TC_AspectStack getTcAspectStack (String aspect, long size){ - return getTcAspectStack(aspect, (int) size); + + public static ToolMaterial generateMaterialFromGT(final Materials gtMaterial) { + final String name = gtMaterial.name(); + final int harvestLevel = gtMaterial.mToolQuality; + final int durability = gtMaterial.mDurability; + final float damage = gtMaterial.mToolQuality; + final int efficiency = (int) gtMaterial.mToolSpeed; + final int enchantability = gtMaterial.mEnchantmentToolsLevel; + final ToolMaterial temp = EnumHelper.addToolMaterial(name, harvestLevel, durability, efficiency, damage, + enchantability); + return temp; + } - public static TC_AspectStack getTcAspectStack (TC_Aspects aspect, int size){ - return getTcAspectStack(aspect.name(), size); + /** + * Returns a Liquid Stack with given amount of IC2Steam. + */ + public static FluidStack getIC2Steam(final long aAmount) { + return FluidRegistry.getFluidStack("ic2steam", (int) aAmount); } - - public static TC_AspectStack getTcAspectStack (String aspect, int size){ + + public static TC_AspectStack getTcAspectStack(final String aspect, final int size) { TC_AspectStack returnValue = null; - if (aspect.toUpperCase() == "COGNITIO"){ - //Adds in Compat for older GT Versions which Misspell aspects. + if (aspect.toUpperCase() == "COGNITIO") { + // Adds in Compat for older GT Versions which Misspell aspects. try { - if (EnumUtils.isValidEnum(TC_Aspects.class, "COGNITIO")){ - Utils.LOG_WARNING("TC Aspect found - "+aspect); + if (EnumUtils.isValidEnum(TC_Aspects.class, "COGNITIO")) { + Utils.LOG_WARNING("TC Aspect found - " + aspect); returnValue = new TC_AspectStack(TC_Aspects.valueOf("COGNITIO"), size); } else { - Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); + Utils.LOG_INFO("Fallback TC Aspect found - " + aspect + + " - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); returnValue = new TC_AspectStack(TC_Aspects.valueOf("COGNITO"), size); - } - } catch (NoSuchFieldError r){ + } + } + catch (final NoSuchFieldError r) { Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); } } - else if (aspect.toUpperCase() == "EXANIMUS"){ - //Adds in Compat for older GT Versions which Misspell aspects. + else if (aspect.toUpperCase() == "EXANIMUS") { + // Adds in Compat for older GT Versions which Misspell aspects. try { - if (EnumUtils.isValidEnum(TC_Aspects.class, "EXANIMUS")){ - Utils.LOG_WARNING("TC Aspect found - "+aspect); + if (EnumUtils.isValidEnum(TC_Aspects.class, "EXANIMUS")) { + Utils.LOG_WARNING("TC Aspect found - " + aspect); returnValue = new TC_AspectStack(TC_Aspects.valueOf("EXANIMUS"), size); } else { - Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); + Utils.LOG_INFO("Fallback TC Aspect found - " + aspect + + " - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); returnValue = new TC_AspectStack(TC_Aspects.valueOf("EXAMINIS"), size); - } - } catch (NoSuchFieldError r){ + } + } + catch (final NoSuchFieldError r) { Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); } - - + } - else if (aspect.toUpperCase() == "PRAECANTATIO"){ - //Adds in Compat for older GT Versions which Misspell aspects. + else if (aspect.toUpperCase() == "PRAECANTATIO") { + // Adds in Compat for older GT Versions which Misspell aspects. try { - if (EnumUtils.isValidEnum(TC_Aspects.class, "PRAECANTATIO")){ - Utils.LOG_WARNING("TC Aspect found - "+aspect); + if (EnumUtils.isValidEnum(TC_Aspects.class, "PRAECANTATIO")) { + Utils.LOG_WARNING("TC Aspect found - " + aspect); returnValue = new TC_AspectStack(TC_Aspects.valueOf("PRAECANTATIO"), size); } else { - Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); + Utils.LOG_INFO("Fallback TC Aspect found - " + aspect + + " - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); returnValue = new TC_AspectStack(TC_Aspects.valueOf("PRAECANTIO"), size); - } - } catch (NoSuchFieldError r){ + } + } + catch (final NoSuchFieldError r) { Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); - } + } } else { - Utils.LOG_WARNING("TC Aspect found - "+aspect); + Utils.LOG_WARNING("TC Aspect found - " + aspect); returnValue = new TC_AspectStack(TC_Aspects.valueOf(aspect), size); } return returnValue; } - public static boolean containsMatch(boolean strict, ItemStack[] inputs, ItemStack... targets) - { - for (ItemStack input : inputs) - { - for (ItemStack target : targets) - { - if (itemMatches(target, input, strict)) - { - return true; - } - } - } - return false; - } - - public static boolean itemMatches(ItemStack target, ItemStack input, boolean strict) - { - if (input == null || target == null) - { - return false; - } - return (target.getItem() == input.getItem() && ((target.getItemDamage() == WILDCARD_VALUE && !strict) || target.getItemDamage() == input.getItemDamage())); - } - - //Non-Dev Comments - public static void LOG_INFO(String s){ - //if (CORE.DEBUG){ - FMLLog.info("GT++: "+s); - //} - } - - //Developer Comments - public static void LOG_WARNING(String s){ - if (CORE.DEBUG){ - FMLLog.warning("GT++: "+s); - } - } + /* + * 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 }); } + */ - //Errors - public static void LOG_ERROR(String s){ - if (CORE.DEBUG){ - FMLLog.severe("GT++: "+s); - } + public static TC_AspectStack getTcAspectStack(final String aspect, final long size) { + return Utils.getTcAspectStack(aspect, (int) size); } - //Developer Logger - public static void LOG_SPECIFIC_WARNING(String whatToLog, String msg, int line){ - if (CORE.DEBUG){ - FMLLog.warning("GT++ |"+line+"| "+whatToLog+" | "+msg); - } + public static TC_AspectStack getTcAspectStack(final TC_Aspects aspect, final int size) { + return Utils.getTcAspectStack(aspect.name(), size); } - public static void paintBox(Graphics g, int MinA, int MinB, int MaxA, int MaxB){ - g.drawRect (MinA, MinB, MaxA, MaxB); + public static TC_AspectStack getTcAspectStack(final TC_Aspects aspect, final long size) { + return Utils.getTcAspectStack(aspect.name(), (int) size); } /** - * Returns if that Liquid is IC2Steam. + * + * @param colourInt + * e.g. 0XFFFFFF + * @return Colour */ - public static boolean isIC2Steam(FluidStack aFluid) { - if (aFluid == null) return false; - return aFluid.isFluidEqual(getIC2Steam(1)); + public static Color hex2Rgb(final int colourInt) { + return Color.decode(String.valueOf(colourInt)); } /** - * Returns a Liquid Stack with given amount of IC2Steam. + * + * @param colourStr + * e.g. "#FFFFFF" + * @return */ - public static FluidStack getIC2Steam(long aAmount) { - 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), - 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){ - |
