Java Code Examples for net.minecraftforge.fml.relauncher.ReflectionHelper.UnableToFindMethodException

The following are top voted examples for showing how to use net.minecraftforge.fml.relauncher.ReflectionHelper.UnableToFindMethodException. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: VillagerInventory   File: ReflectionHelper.java   View source code 6 votes vote down vote up
/**
 * Obtain a Method by name from class declaringClass.
 * Simplified version of {@link net.minecraftforge.fml.relauncher.ReflectionHelper#findMethod(Class, Object, String[], Class...)}.
 */
public static final Method getDeclaredMethod(final Class<?> declaringClass, String[] methodNames, Class<?>... parameterTypes)
{
	Exception failed = null;
	for (String methodName : methodNames)
	{
		try
		{
			Method method = declaringClass.getDeclaredMethod(methodName, parameterTypes);
			method.setAccessible(true);
			return method;
		}
		catch (Exception ex)
		{
			failed = ex;
		}
	}
	throw new UnableToFindMethodException(methodNames, failed);
}
 
Example 2
Project: Halloween   File: ReflectionUtils.java   View source code 6 votes vote down vote up
/**
 * Obtain a Method by name from class declaringClass.
 * Simplified version of {@link net.minecraftforge.fml.relauncher.ReflectionHelper#findMethod(Class, Object, String[], Class...)}.
 */
public static final Method getDeclaredMethod(final Class<?> declaringClass, String[] methodNames, Class<?>... parameterTypes)
{
	Exception failed = null;
	for (String methodName : methodNames)
	{
		try
		{
			Method method = declaringClass.getDeclaredMethod(methodName, parameterTypes);
			method.setAccessible(true);
			return method;
		}
		catch (Exception ex)
		{
			failed = ex;
		}
	}
	throw new UnableToFindMethodException(methodNames, failed);
}
 
Example 3
Project: itemscroller   File: MethodHandleUtils.java   View source code 6 votes vote down vote up
public static <E> Method reflectMethod(Class<? super E> clazz, String[] methodNames, Class<?>... methodTypes)
{
    Exception failed = null;

    for (String methodName : methodNames)
    {
        try
        {
            Method m = clazz.getDeclaredMethod(methodName, methodTypes);
            m.setAccessible(true);
            return m;
        }
        catch (Exception e)
        {
            failed = e;
        }
    }

    throw new UnableToFindMethodException(methodNames, failed);
}
 
Example 4
Project: justenoughdimensions   File: MethodHandleUtils.java   View source code 6 votes vote down vote up
public static <E> Method reflectMethod(Class<? super E> clazz, String[] methodNames, Class<?>... methodTypes)
{
    Exception failed = null;

    for (String methodName : methodNames)
    {
        try
        {
            Method m = clazz.getDeclaredMethod(methodName, methodTypes);
            m.setAccessible(true);
            return m;
        }
        catch (Exception e)
        {
            failed = e;
        }
    }

    throw new UnableToFindMethodException(methodNames, failed);
}
 
Example 5
Project: multishot   File: MethodHandleUtils.java   View source code 6 votes vote down vote up
public static <E> Method reflectMethod(Class<? super E> clazz, String[] methodNames, Class<?>... methodTypes)
{
    Exception failed = null;

    for (String methodName : methodNames)
    {
        try
        {
            Method m = clazz.getDeclaredMethod(methodName, methodTypes);
            m.setAccessible(true);
            return m;
        }
        catch (Exception e)
        {
            failed = e;
        }
    }

    throw new UnableToFindMethodException(methodNames, failed);
}
 
Example 6
Project: enderutilities   File: MethodHandleUtils.java   View source code 6 votes vote down vote up
public static <E> Method reflectMethod(Class<? super E> clazz, String[] methodNames, Class<?>... methodTypes)
{
    Exception failed = null;

    for (String methodName : methodNames)
    {
        try
        {
            Method m = clazz.getDeclaredMethod(methodName, methodTypes);
            m.setAccessible(true);
            return m;
        }
        catch (Exception e)
        {
            failed = e;
        }
    }

    throw new UnableToFindMethodException(methodNames, failed);
}