TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ AddContent()

bool Terraria.ModLoader.Mod.AddContent ( ILoadable instance)
inlineinherited

Call this to manually add the given content instance to the game.

Parameters
instanceThe content instance to add
Returns
true if the instance was successfully added

Definition at line 180 of file Mod.cs.

181 {
182 if (!loading)
183 {
184 throw new Exception(Language.GetTextValue("tModLoader.LoadErrorNotLoading"));
185 }
186 if (!instance.IsLoadingEnabled(this))
187 {
188 return false;
189 }
190 instance.Load(this);
191 content.Add(instance);
192 ContentInstance.Register(instance);
193 return true;
194 }
static string GetTextValue(string key)
Retrieves the text value for a specified localization key. The text returned will be for the currentl...
Definition Language.cs:35
Contains methods to access or retrieve localization values. The Localization Guideteaches more about ...
Definition Language.cs:12
readonly IList< ILoadable > content
Definition Mod.cs:41

References Terraria.ModLoader.Mod.content, Terraria.Localization.Language.GetTextValue(), Terraria.ModLoader.ILoadable.IsLoadingEnabled(), Terraria.ModLoader.ILoadable.Load(), Terraria.ModLoader.Mod.loading, and Terraria.ModLoader.ContentInstance< T >.Register().

Referenced by Terraria.ModLoader.Mod.AddContent< T >(), and Terraria.ModLoader.Mod.Autoload().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: