From ad4a2b9dec0e470d1eb000a712b2b56d0b7ae930 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Mon, 29 Apr 2019 10:30:44 +1000 Subject: $ Fixed lots of minor issues with recipes. % Adjusted cost of Air Intake Hatch mildly. --- src/Java/gtPlusPlus/core/util/Utils.java | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 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 3b3ba88e88..919d2f13f3 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -928,24 +928,17 @@ public class Utils { return false; } - public static ItemList getValueOfItemList(String string, ItemList aOther) { - try { - Method method = ItemList.class.getDeclaredMethod("values"); - Object obj = method.invoke(null); - String y = Arrays.toString((Object[]) obj); - String[] aCurrentItemsInList = y.split(","); - boolean found = false; - for (String g : aCurrentItemsInList) { - if (g.equals(string)) { - found = true; - break; + public static ItemList getValueOfItemList(String string, ItemList aOther) { + ItemList[] aListValues = ItemList.class.getEnumConstants(); + for (ItemList aItem : aListValues) { + if (aItem != null) { + if (aItem.name().toLowerCase().equals(string)) { + return aItem; } } - if (found) { - return ItemList.valueOf(string); - } } - catch (Throwable t) {} + Logger.INFO("Tried to obtain '"+string+"' from the GT ItemList, however it does not exist."); + Logger.INFO("Using fallback option instead - "+aOther.name()); return aOther; } -- cgit From f2f00bdaf83738740f004b46126ffe48e0b1cbc9 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Mon, 29 Apr 2019 11:11:40 +1000 Subject: $ Fixed Powder Barrel not being set correctly in .08. $ Fixed issue with string comparisons. --- src/Java/gtPlusPlus/core/util/Utils.java | 6 ++++-- 1 file changed, 4 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 919d2f13f3..bb1d9064e8 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -932,13 +932,15 @@ public class Utils { ItemList[] aListValues = ItemList.class.getEnumConstants(); for (ItemList aItem : aListValues) { if (aItem != null) { - if (aItem.name().toLowerCase().equals(string)) { + 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."); - Logger.INFO("Using fallback option instead - "+aOther.name()); + if (aOther != null) { + Logger.INFO("Using fallback option instead - "+aOther.name()); + } return aOther; } -- cgit