diff --git a/src/ContentLib.Core/ContentDefinition.cs b/src/ContentLib.Core/ContentDefinition.cs index fd5582c..4d14f35 100644 --- a/src/ContentLib.Core/ContentDefinition.cs +++ b/src/ContentLib.Core/ContentDefinition.cs @@ -47,18 +47,20 @@ public virtual (bool isValid, string? message) Validate() $"The `{nameof(ModDefinition)} {nameof(Mod)}` of this ContentDefinition exists but isn't registered! " + "Please create your ModDefinition through intended methods."); } - - return result; } - - if (!TryGetModDefinitionFromCallingAssembly(out ModDefinition? modDefinition)) + else if (TryGetModDefinitionFromCallingAssembly(out ModDefinition? modDefinition)) + Mod = modDefinition; + else { MarkAsInvalid(ref result, $"Tried getting {nameof(BepInPlugin)} Attribute from CallingAssembly, but the attribute was not found! " + "Make sure to call ContentLib from a valid BepInEx Plugin assembly."); + + return result; } - Mod = modDefinition; + if (!Mod.Content.Contains(this)) + Mod.Content.Add(this); return result; }