diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core/util')
-rw-r--r-- | src/Java/gtPlusPlus/core/util/Utils.java | 16 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java | 74 |
2 files changed, 37 insertions, 53 deletions
diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java index 234b54d2d2..72b13b3067 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -935,22 +935,6 @@ public class Utils { return false; } - public static ItemList getValueOfItemList(String string, ItemList aOther) { - ItemList[] aListValues = ItemList.class.getEnumConstants(); - for (ItemList aItem : aListValues) { - if (aItem != null) { - if (aItem.name().equals(string) || aItem.name().toLowerCase().equals(string.toLowerCase())) { - return aItem; - } - } - } - Logger.INFO("Tried to obtain '"+string+"' from the GT ItemList, however it does not exist."); - if (aOther != null) { - Logger.INFO("Using fallback option instead - "+aOther.name()); - } - return aOther; - } - public static long getMillisSince(long aStartTime, long aCurrentTime) { return (aCurrentTime - aStartTime); } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index d7d611a1e4..cd5b98557b 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -42,7 +42,6 @@ import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_DustGeneration; import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentData; -import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; @@ -1220,7 +1219,6 @@ public class ItemUtils { return GT_Values.NI; } - public static ItemStack depleteStack(ItemStack aStack) { return depleteStack(aStack, 1); } @@ -1235,41 +1233,6 @@ public class ItemUtils { } return getNullStack(); } - - public static ItemStack getItemListObject(String aObjectFromExperimentalName, String aReplacementName, int aAmount) { - ItemList aItemListObject = getItemListObject(aObjectFromExperimentalName, aReplacementName); - if (aItemListObject == ItemList.NULL || aItemListObject == null) { - return null; - } - else { - return aItemListObject.get(aAmount); - } - } - - public static ItemStack getItemListObject(ItemList aItemListObject, int aAmount) { - if (aItemListObject == ItemList.NULL || aItemListObject == null) { - return null; - } - else { - return aItemListObject.get(aAmount); - } - } - - public static ItemList getItemListObject(String aObjectFromExperimentalName, String aReplacementName) { - ItemList aVal = ItemList.valueOf(aObjectFromExperimentalName); - if (aVal != null) { - return aVal; - } - else { - aVal = ItemList.valueOf(aReplacementName); - if (aVal != null) { - return aVal; - } - else { - return ItemList.NULL; - } - } - } public static boolean isControlCircuit(ItemStack aStack) { if (aStack != null) { @@ -1313,5 +1276,42 @@ public class ItemUtils { public static String getLocalizedNameOfBlock(Block aBlock, int aMeta) { return LangUtils.getLocalizedNameOfBlock(aBlock, aMeta); } + + + + public static ItemList getValueOfItemList(String string, ItemList aOther) { + ItemList[] aListValues = ItemList.class.getEnumConstants(); + for (ItemList aItem : aListValues) { + if (aItem != null) { + if (aItem.name().equals(string) || aItem.name().toLowerCase().equals(string.toLowerCase())) { + return aItem; + } + } + } + Logger.INFO("Tried to obtain '"+string+"' from the GT ItemList, however it does not exist."); + if (aOther != null) { + Logger.INFO("Using fallback option instead - "+aOther.name()); + } + return aOther; + } + public static ItemStack getValueOfItemList(String string, int aAmount, ItemList aOther) { + return getValueOfItemList(string, aOther).get(aAmount); + } + + public static ItemStack getValueOfItemList(String string, int aAmount, ItemStack aOther) { + ItemList[] aListValues = ItemList.class.getEnumConstants(); + for (ItemList aItem : aListValues) { + if (aItem != null) { + if (aItem.name().equals(string) || aItem.name().toLowerCase().equals(string.toLowerCase())) { + return aItem.get(aAmount); + } + } + } + Logger.INFO("Tried to obtain '"+string+"' from the GT ItemList, however it does not exist."); + if (aOther != null) { + Logger.INFO("Using fallback option instead - "+ItemUtils.getItemName(aOther)); + } + return aOther; + } } |