diff --git a/src/SMAPI/Framework/ModLoading/RewriteFacades/EnumMethods.cs b/src/SMAPI/Framework/ModLoading/RewriteFacades/EnumMethods.cs index cd03229b..8ed17e6b 100644 --- a/src/SMAPI/Framework/ModLoading/RewriteFacades/EnumMethods.cs +++ b/src/SMAPI/Framework/ModLoading/RewriteFacades/EnumMethods.cs @@ -4,6 +4,12 @@ namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades; public static class EnumMethods { + public static string[] GetNames() where TEnum : struct, Enum + { + Type enumType = typeof(TEnum); + return Enum.GetNames(enumType); + } + public static bool IsDefined(TEnum value) where TEnum : struct, Enum { Type enumType = typeof(TEnum); diff --git a/src/SMAPI/Metadata/InstructionMetadata.cs b/src/SMAPI/Metadata/InstructionMetadata.cs index f019868c..b2315e9d 100644 --- a/src/SMAPI/Metadata/InstructionMetadata.cs +++ b/src/SMAPI/Metadata/InstructionMetadata.cs @@ -119,6 +119,7 @@ namespace StardewModdingAPI.Metadata yield return new MethodToAnotherStaticMethodRewriter(typeof(ISoundBank), (method) => method.Name == nameof(SoundBankMethods.GetCueDefinition), typeof(SoundBankMethods), "GetCueDefinition"); yield return new MethodToAnotherStaticMethodRewriter(typeof(Enum), (method) => method.Name == nameof(EnumMethods.IsDefined) && method.Parameters.Count == 1, typeof(EnumMethods), "IsDefined"); + yield return new MethodToAnotherStaticMethodRewriter(typeof(Enum), (method) => method.Name == nameof(EnumMethods.GetNames) && method.Parameters.Count == 0, typeof(EnumMethods), "GetNames"); //Constructor Rewrites yield return new MethodParentRewriter(typeof(MapPage), typeof(MapPageMethods));