From 75888b6ab5d30424df01d22000b6c8cb381dab3b Mon Sep 17 00:00:00 2001 From: Mian Date: Thu, 11 Jun 2026 02:05:01 -0700 Subject: [PATCH] Added hotfixability to classes (just as a way to easily hotfix all methods in one class) --- api/attributes/HotfixableAttribute.cs | 2 +- utils/ModReloadUtils.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/api/attributes/HotfixableAttribute.cs b/api/attributes/HotfixableAttribute.cs index 7e7abdc4..23c0b9b8 100644 --- a/api/attributes/HotfixableAttribute.cs +++ b/api/attributes/HotfixableAttribute.cs @@ -2,7 +2,7 @@ namespace NeoModLoader.api.attributes; /// /// If a method has this attribute and its mod main class implements , the method will be hotfixed when the mod is reloaded. /// -[AttributeUsage(AttributeTargets.Method)] +[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)] public class HotfixableAttribute : Attribute { diff --git a/utils/ModReloadUtils.cs b/utils/ModReloadUtils.cs index 4d20b546..2f69d47d 100644 --- a/utils/ModReloadUtils.cs +++ b/utils/ModReloadUtils.cs @@ -125,7 +125,8 @@ private static IEnumerable EnumerateTypesRecursive(IEnumerable attribute.AttributeType.FullName == typeof(HotfixableAttribute).FullName + attribute => attribute.AttributeType.FullName == typeof(HotfixableAttribute).FullName + || methodDefinition.DeclaringType.CustomAttributes.Any(attribute => attribute.AttributeType.FullName == typeof(HotfixableAttribute).FullName) ); }