summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-05-21 22:21:24 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-05-21 22:21:24 -0400
commit7fdc3a2ab2361145693cfbf0957ecdb7564ffaa1 (patch)
treed444c4c967052d93d24908e84465bdc25adb5bdf /src/SMAPI/Framework
parentf8e0600672952fa211b118df27f359581ee4b1f1 (diff)
downloadSMAPI-7fdc3a2ab2361145693cfbf0957ecdb7564ffaa1.tar.gz
SMAPI-7fdc3a2ab2361145693cfbf0957ecdb7564ffaa1.tar.bz2
SMAPI-7fdc3a2ab2361145693cfbf0957ecdb7564ffaa1.zip
fix AccessTools facade constructor logic (#711)
Diffstat (limited to 'src/SMAPI/Framework')
-rw-r--r--src/SMAPI/Framework/ModLoading/RewriteFacades/AccessToolsMethods.cs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/SMAPI/Framework/ModLoading/RewriteFacades/AccessToolsMethods.cs b/src/SMAPI/Framework/ModLoading/RewriteFacades/AccessToolsMethods.cs
index ea35fec9..08857129 100644
--- a/src/SMAPI/Framework/ModLoading/RewriteFacades/AccessToolsMethods.cs
+++ b/src/SMAPI/Framework/ModLoading/RewriteFacades/AccessToolsMethods.cs
@@ -16,17 +16,26 @@ namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades
*********/
public static ConstructorInfo DeclaredConstructor(Type type, Type[] parameters = null)
{
- return AccessTools.DeclaredConstructor(type, parameters, searchForStatic: true);
+ // Harmony 1.x matched both static and instance constructors
+ return
+ AccessTools.DeclaredConstructor(type, parameters, searchForStatic: false)
+ ?? AccessTools.DeclaredConstructor(type, parameters, searchForStatic: true);
}
public static ConstructorInfo Constructor(Type type, Type[] parameters = null)
{
- return AccessTools.Constructor(type, parameters, searchForStatic: true);
+ // Harmony 1.x matched both static and instance constructors
+ return
+ AccessTools.Constructor(type, parameters, searchForStatic: false)
+ ?? AccessTools.Constructor(type, parameters, searchForStatic: true);
}
public static List<ConstructorInfo> GetDeclaredConstructors(Type type)
{
- return AccessTools.GetDeclaredConstructors(type, searchForStatic: true);
+ // Harmony 1.x matched both static and instance constructors
+ return
+ AccessTools.GetDeclaredConstructors(type, searchForStatic: false)
+ ?? AccessTools.GetDeclaredConstructors(type, searchForStatic: true);
}
}
}