aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/core/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/core/util')
-rw-r--r--src/main/java/gtPlusPlus/core/util/minecraft/ItemUtils.java60
-rw-r--r--src/main/java/gtPlusPlus/core/util/minecraft/MaterialUtils.java13
-rw-r--r--src/main/java/gtPlusPlus/core/util/reflect/ProxyFinder.java54
3 files changed, 2 insertions, 125 deletions
diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/ItemUtils.java
index 6806e06315..ab1f940057 100644
--- a/src/main/java/gtPlusPlus/core/util/minecraft/ItemUtils.java
+++ b/src/main/java/gtPlusPlus/core/util/minecraft/ItemUtils.java
@@ -1442,64 +1442,4 @@ public class ItemUtils {
}
return false;
}
-
- public static String getLocalizedNameOfBlock(Block aBlock, int aMeta) {
- return LangUtils.getLocalizedNameOfBlock(aBlock, aMeta);
- }
-
- public static boolean doesItemListEntryExist(String string) {
- ItemList[] aListValues = ItemList.class.getEnumConstants();
- for (ItemList aItem : aListValues) {
- if (aItem != null) {
- if (aItem.name().equals(string) || aItem.name().toLowerCase().equals(string.toLowerCase())) {
- return true;
- }
- }
- }
- 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 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;
- }
-
- public static boolean areItemsEqual(ItemStack aStack1, ItemStack aStack2) {
- return areItemsEqual(aStack1, aStack2, true);
- }
-
- public static boolean areItemsEqual(ItemStack aStack1, ItemStack aStack2, boolean aIgnoreNBT) {
- return GT_Utility.areStacksEqual(aStack1, aStack2, aIgnoreNBT);
- }
}
diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/MaterialUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/MaterialUtils.java
index 8c2b98b712..66e92e3eda 100644
--- a/src/main/java/gtPlusPlus/core/util/minecraft/MaterialUtils.java
+++ b/src/main/java/gtPlusPlus/core/util/minecraft/MaterialUtils.java
@@ -331,8 +331,8 @@ public class MaterialUtils {
}
public static Materials getMaterial(String aMaterialName) {
- Materials m = gtPlusPlus.xmod.gregtech.common.StaticFields59.getMaterial(aMaterialName);
- if (m == null) {
+ Materials m = Materials.get(aMaterialName);
+ if (m == Materials._NULL) {
m = getMaterialByName(aMaterialName);
}
if (m == null) {
@@ -431,15 +431,6 @@ public class MaterialUtils {
}
}
- public static boolean doesMaterialExist(String aMatName) {
- for (Materials m : Materials.values()) {
- if (m.name().toLowerCase().equals(aMatName.toLowerCase())) {
- return true;
- }
- }
- return false;
- }
-
public static boolean isNullGregtechMaterial(Materials aGregtechMaterial) {
if (aGregtechMaterial == Materials._NULL || aGregtechMaterial.equals(Materials._NULL)
|| aGregtechMaterial.name().equals(Materials._NULL.name())) {
diff --git a/src/main/java/gtPlusPlus/core/util/reflect/ProxyFinder.java b/src/main/java/gtPlusPlus/core/util/reflect/ProxyFinder.java
deleted file mode 100644
index 6752153bec..0000000000
--- a/src/main/java/gtPlusPlus/core/util/reflect/ProxyFinder.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package gtPlusPlus.core.util.reflect;
-
-import java.lang.reflect.Field;
-
-import cpw.mods.fml.common.SidedProxy;
-
-public class ProxyFinder {
-
- public static Object getServerProxy(final Object modInstance) throws ReflectiveOperationException {
- for (final Field field : modInstance.getClass().getDeclaredFields()) {
- if (field.isAnnotationPresent(SidedProxy.class)) {
- final SidedProxy sidedProxy = field.getAnnotation(SidedProxy.class);
- final Object fieldValue = field.get(modInstance);
- try {
- final Class<?> serverSideClass = ReflectionUtils.getClass(sidedProxy.serverSide());
- if (serverSideClass.isAssignableFrom(fieldValue.getClass())) {
- final Object serverProxy = serverSideClass.cast(fieldValue);
- // do what you want with server proxy instance
- return serverProxy;
- }
-
- } catch (final NoClassDefFoundError err) {
- // its client side
- return null;
- }
- break;
- }
- }
- return null;
- }
-
- public static Object getClientProxy(final Object modInstance) throws ReflectiveOperationException {
- for (final Field field : modInstance.getClass().getDeclaredFields()) {
- if (field.isAnnotationPresent(SidedProxy.class)) {
- final SidedProxy sidedProxy = field.getAnnotation(SidedProxy.class);
- final Object fieldValue = field.get(modInstance);
- try {
- final Class<?> clientSideClass = ReflectionUtils.getClass(sidedProxy.clientSide());
- if (clientSideClass.isAssignableFrom(fieldValue.getClass())) {
- final Object clientProxy = clientSideClass.cast(fieldValue);
- // do what you want with client proxy instance
- return clientProxy;
- }
-
- } catch (final NoClassDefFoundError err) {
- // its server side
- return null;
- }
- break;
- }
- }
- return null;
- }
-}