diff --git a/Source/MpMethodUtil.cs b/Source/MpMethodUtil.cs index 028f268..5b652bf 100644 --- a/Source/MpMethodUtil.cs +++ b/Source/MpMethodUtil.cs @@ -211,11 +211,16 @@ public static MethodBase GetMethod(Type type, string methodName, MethodType meth return AccessTools.DeclaredConstructor(type, args); case MethodType.StaticConstructor: - return Enumerable.FirstOrDefault(AccessTools - .GetDeclaredConstructors(type), c => c.IsStatic); - } + return AccessTools.GetDeclaredConstructors(type).FirstOrDefault(c => c.IsStatic); - return null; + case MethodType.Enumerator: + if (methodName == null) + return null; + return AccessTools.EnumeratorMoveNext(AccessTools.DeclaredMethod(type, methodName, args)); + + default: + return null; + } } /// Get the first method in the given type that matches the specified signature, return null if failed.