blob: af6cfa926ae357a388bf2bfa3886c671cfdc7eff [file] [log] [blame] [raw]
package rebelkeithy.mods.metallurgy.api;
import java.lang.reflect.Field;
public class MetallurgyAPI
{
// Values for name: "base", "precious", "nether", "fantasy", "ender",
// "utility", "vanilla"
public static IMetalSet getMetalSet(String name)
{
try
{
String className = "rebelkeithy.mods.metallurgy.metals.MetallurgyMetals";
if (name.equals("vanilla"))
{
className = "rebelkeithy.mods.metallurgy.vanilla.MetallurgyVanilla";
}
final Class<?> metallurgyMetals = Class.forName(className);
final Field set = metallurgyMetals.getField(name + "Set");
return (IMetalSet) set.get(null);
} catch (final NoSuchFieldException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (final SecurityException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (final ClassNotFoundException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (final IllegalArgumentException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (final IllegalAccessException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
public static String[] getMetalSetNames()
{
// TODO maybe put something to get runtime list here
final String[] names =
{ "base", "precious", "nether", "fantasy", "ender", "utility", "vanilla" };
return names;
}
}