Terraria ModLoader  0.11.7.7
A mod to make and play Terraria mods
Terraria.ModLoader.ModContent Class Reference

Manages content added by mods. Liasons between mod content and Terraria's arrays and oversees the Loader classes. More...

Static Public Member Functions

static int BuffType< T > ()
 Get the id (type) of a ModBuff by class. Assumes one instance per class. More...
 
static int DustType< T > ()
 Get the id (type) of a ModDust by class. Assumes one instance per class. More...
 
static bool FileExists (string name)
 Returns whether or not a file with the specified name exists. More...
 
static EquipTexture GetEquipTexture (EquipType type, int slot)
 Gets the equipment texture for the specified equipment type and ID. More...
 
static byte[] GetFileBytes (string name)
 Gets the byte representation of the file with the specified name. The name is in the format of "ModFolder/OtherFolders/FileNameWithExtension". Throws an ArgumentException if the file does not exist. More...
 
static T GetInstance< T > ()
 
static int GetModBackgroundSlot (string texture)
 Returns the slot/ID of the background texture with the given name. More...
 
static int GetModBossHeadSlot (string texture)
 Gets the index of the boss head texture corresponding to the given texture path. More...
 
static ModBuff GetModBuff (int type)
 Gets the ModBuff instance with the given type. If no ModBuff with the given type exists, returns null. More...
 
static ModDust GetModDust (int type)
 Gets the ModDust instance with the given type. Returns null if no ModDust with the given type exists. More...
 
static int GetModHeadSlot (string texture)
 Gets the index of the head texture corresponding to the given texture path. More...
 
static ModItem GetModItem (int type)
 Gets the ModItem instance corresponding to the specified type. Returns null if no modded item has the given type. More...
 
static ModMountData GetModMountData (int type)
 Gets the ModMountData instance corresponding to the given type. Returns null if no ModMountData has the given type. More...
 
static ModNPC GetModNPC (int type)
 Gets the ModNPC instance corresponding to the specified type. More...
 
static ModProjectile GetModProjectile (int type)
 Gets the ModProjectile instance corresponding to the specified type. More...
 
static ModSurfaceBgStyle GetModSurfaceBgStyle (int style)
 Returns the ModSurfaceBgStyle object with the given ID. More...
 
static ModTile GetModTile (int type)
 Gets the ModTile instance with the given type. If no ModTile with the given type exists, returns null. More...
 
static ModUgBgStyle GetModUgBgStyle (int style)
 Returns the ModUgBgStyle object with the given ID. More...
 
static ModWall GetModWall (int type)
 Gets the ModWall instance with the given type. If no ModWall with the given type exists, returns null. More...
 
static ModWaterfallStyle GetModWaterfallStyle (int style)
 Returns the ModWaterfallStyle with the given ID. More...
 
static ModWaterStyle GetModWaterStyle (int style)
 Returns the ModWaterStyle with the given ID. More...
 
static Music GetMusic (string name)
 Gets the music with the specified name. The name is in the same format as for texture names. Throws an ArgumentException if the music does not exist. Note: SoundMP3 is in the Terraria.ModLoader namespace. More...
 
static SoundEffect GetSound (string name)
 Gets the sound with the specified name. The name is in the same format as for texture names. Throws an ArgumentException if the sound does not exist. Note: SoundEffect is in the Microsoft.Xna.Framework.Audio namespace. More...
 
static Texture2D GetTexture (string name)
 Gets the texture with the specified name. The name is in the format of "ModFolder/OtherFolders/FileNameWithoutExtension". Throws an ArgumentException if the texture does not exist. If a vanilla texture is desired, the format "Terraria/FileNameWithoutExtension" will reference an image from the "terraria/Content/Images" folder. Note: Texture2D is in the Microsoft.Xna.Framework.Graphics namespace. More...
 
static int ItemType< T > ()
 Get the id (type) of a ModItem by class. Assumes one instance per class. More...
 
static int MountType< T > ()
 Get the id (type) of a ModMountData by class. Assumes one instance per class. More...
 
static bool MusicExists (string name)
 Returns whether or not a sound with the specified name exists. More...
 
static int NPCType< T > ()
 Get the id (type) of a ModNPC by class. Assumes one instance per class. More...
 
static Stream OpenRead (string assetName, bool newFileStream=false)
 
static byte PrefixType< T > ()
 Get the id (type) of a ModPrefix by class. Assumes one instance per class. More...
 
static int ProjectileType< T > ()
 Get the id (type) of a ModProjectile by class. Assumes one instance per class. More...
 
static void RefreshModLanguage (GameCulture culture)
 
static bool SoundExists (string name)
 Returns whether or not a sound with the specified name exists. More...
 
static void SplitName (string name, out string domain, out string subName)
 
static bool TextureExists (string name)
 Returns whether or not a texture with the specified name exists. More...
 
static int TileEntityType< T > ()
 Get the id (type) of a ModTileEntity by class. Assumes one instance per class. More...
 
static int TileType< T > ()
 Get the id (type) of a ModTile by class. Assumes one instance per class. More...
 
static int WallType< T > ()
 Get the id (type) of a ModWall by class. Assumes one instance per class. More...
 

Static Private Member Functions

static void CacheVanillaState ()
 
static void DisposeMusic ()
 
static void LoadModContent (CancellationToken token, Action< Mod > loadAction)
 
static void ResizeArrays (bool unloading=false)
 
static LocalizedText SetLocalizedText (Dictionary< string, LocalizedText > dict, LocalizedText value)
 
static void SetupRecipes (CancellationToken token)
 

Detailed Description

Manages content added by mods. Liasons between mod content and Terraria's arrays and oversees the Loader classes.

Definition at line 26 of file ModContent.cs.

Member Function Documentation

static int Terraria.ModLoader.ModContent.BuffType< T > ( )
static

Get the id (type) of a ModBuff by class. Assumes one instance per class.

Type Constraints
T :ModBuff 
T :GetInstance<T>() 
T :Type 
static void Terraria.ModLoader.ModContent.CacheVanillaState ( )
staticprivate

Definition at line 392 of file ModContent.cs.

392  {
393  EffectsTracker.CacheVanillaState();
394  }
static void Terraria.ModLoader.ModContent.DisposeMusic ( )
staticprivate

Definition at line 581 of file ModContent.cs.

References Terraria.ModLoader.Item.

581  {
582  foreach (var music in Main.music.OfType<MusicStreaming>())
583  music.Dispose();
584  }
static int Terraria.ModLoader.ModContent.DustType< T > ( )
static

Get the id (type) of a ModDust by class. Assumes one instance per class.

Type Constraints
T :ModDust 
T :GetInstance<T>() 
T :Type 
static bool Terraria.ModLoader.ModContent.FileExists ( string  name)
static

Returns whether or not a file with the specified name exists.

Definition at line 57 of file ModContent.cs.

References Terraria.ModLoader.Mod.FileExists(), and Terraria.ModLoader.ModLoader.GetMod().

57  {
58  if (!name.Contains('/'))
59  return false;
60 
61  string modName, subName;
62  SplitName(name, out modName, out subName);
63 
64  Mod mod = ModLoader.GetMod(modName);
65  return mod != null && mod.FileExists(subName);
66  }
static void SplitName(string name, out string domain, out string subName)
Definition: ModContent.cs:30

+ Here is the call graph for this function:

static EquipTexture Terraria.ModLoader.ModContent.GetEquipTexture ( EquipType  type,
int  slot 
)
static

Gets the equipment texture for the specified equipment type and ID.

Parameters
type
slot
Returns
static byte [] Terraria.ModLoader.ModContent.GetFileBytes ( string  name)
static

Gets the byte representation of the file with the specified name. The name is in the format of "ModFolder/OtherFolders/FileNameWithExtension". Throws an ArgumentException if the file does not exist.

Exceptions
MissingResourceExceptionMissing mod: " + name

Definition at line 43 of file ModContent.cs.

References Terraria.ModLoader.Mod.GetFileBytes(), and Terraria.ModLoader.ModLoader.GetMod().

43  {
44  string modName, subName;
45  SplitName(name, out modName, out subName);
46 
47  Mod mod = ModLoader.GetMod(modName);
48  if (mod == null)
49  throw new MissingResourceException("Missing mod: " + name);
50 
51  return mod.GetFileBytes(subName);
52  }
static void SplitName(string name, out string domain, out string subName)
Definition: ModContent.cs:30

+ Here is the call graph for this function:

static T Terraria.ModLoader.ModContent.GetInstance< T > ( )
static
Type Constraints
T :class 
T :ContentInstance<T> 
T :Instance 
static int Terraria.ModLoader.ModContent.GetModBackgroundSlot ( string  texture)
static

Returns the slot/ID of the background texture with the given name.

static int Terraria.ModLoader.ModContent.GetModBossHeadSlot ( string  texture)
static

Gets the index of the boss head texture corresponding to the given texture path.

Parameters
texture
Returns
static ModBuff Terraria.ModLoader.ModContent.GetModBuff ( int  type)
static

Gets the ModBuff instance with the given type. If no ModBuff with the given type exists, returns null.

static ModDust Terraria.ModLoader.ModContent.GetModDust ( int  type)
static

Gets the ModDust instance with the given type. Returns null if no ModDust with the given type exists.

static int Terraria.ModLoader.ModContent.GetModHeadSlot ( string  texture)
static

Gets the index of the head texture corresponding to the given texture path.

Parameters
textureRelative texture path
Returns
The index of the texture in the heads array, -1 if not found.
static ModItem Terraria.ModLoader.ModContent.GetModItem ( int  type)
static

Gets the ModItem instance corresponding to the specified type. Returns null if no modded item has the given type.

static ModMountData Terraria.ModLoader.ModContent.GetModMountData ( int  type)
static

Gets the ModMountData instance corresponding to the given type. Returns null if no ModMountData has the given type.

Parameters
typeThe type of the mount.
Returns
Null if not found, otherwise the ModMountData associated with the mount.
static ModNPC Terraria.ModLoader.ModContent.GetModNPC ( int  type)
static

Gets the ModNPC instance corresponding to the specified type.

Parameters
typeThe type of the npc
Returns
The ModNPC instance in the npcs array, null if not found.
static ModProjectile Terraria.ModLoader.ModContent.GetModProjectile ( int  type)
static

Gets the ModProjectile instance corresponding to the specified type.

Parameters
typeThe type of the projectile
Returns
The ModProjectile instance in the projectiles array, null if not found.
static ModSurfaceBgStyle Terraria.ModLoader.ModContent.GetModSurfaceBgStyle ( int  style)
static

Returns the ModSurfaceBgStyle object with the given ID.

static ModTile Terraria.ModLoader.ModContent.GetModTile ( int  type)
static

Gets the ModTile instance with the given type. If no ModTile with the given type exists, returns null.

Parameters
typeThe type of the ModTile
Returns
The ModTile instance in the tiles array, null if not found.
static ModUgBgStyle Terraria.ModLoader.ModContent.GetModUgBgStyle ( int  style)
static

Returns the ModUgBgStyle object with the given ID.

static ModWall Terraria.ModLoader.ModContent.GetModWall ( int  type)
static

Gets the ModWall instance with the given type. If no ModWall with the given type exists, returns null.

static ModWaterfallStyle Terraria.ModLoader.ModContent.GetModWaterfallStyle ( int  style)
static

Returns the ModWaterfallStyle with the given ID.

static ModWaterStyle Terraria.ModLoader.ModContent.GetModWaterStyle ( int  style)
static

Returns the ModWaterStyle with the given ID.

static Music Terraria.ModLoader.ModContent.GetMusic ( string  name)
static

Gets the music with the specified name. The name is in the same format as for texture names. Throws an ArgumentException if the music does not exist. Note: SoundMP3 is in the Terraria.ModLoader namespace.

Exceptions
MissingResourceExceptionMissing mod: " + name

Definition at line 179 of file ModContent.cs.

References Terraria.ModLoader.ModLoader.GetMod(), and Terraria.ModLoader.Mod.GetMusic().

Referenced by Terraria.ModLoader.SoundLoader.GetSoundSlot().

179  {
180  if (Main.dedServ) { return null; }
181  string modName, subName;
182  SplitName(name, out modName, out subName);
183  Mod mod = ModLoader.GetMod(modName);
184  if (mod == null) { throw new MissingResourceException("Missing mod: " + name); }
185  return mod.GetMusic(subName);
186  }
static void SplitName(string name, out string domain, out string subName)
Definition: ModContent.cs:30

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static SoundEffect Terraria.ModLoader.ModContent.GetSound ( string  name)
static

Gets the sound with the specified name. The name is in the same format as for texture names. Throws an ArgumentException if the sound does not exist. Note: SoundEffect is in the Microsoft.Xna.Framework.Audio namespace.

Exceptions
MissingResourceExceptionMissing mod: " + name

Definition at line 147 of file ModContent.cs.

References Terraria.ModLoader.ModLoader.GetMod(), and Terraria.ModLoader.Mod.GetSound().

Referenced by Terraria.ModLoader.Mod.AddSound(), and Terraria.ModLoader.SoundLoader.GetSoundSlot().

147  {
148  if (Main.dedServ)
149  return null;
150 
151  string modName, subName;
152  SplitName(name, out modName, out subName);
153 
154  Mod mod = ModLoader.GetMod(modName);
155  if (mod == null)
156  throw new MissingResourceException("Missing mod: " + name);
157 
158  return mod.GetSound(subName);
159  }
static void SplitName(string name, out string domain, out string subName)
Definition: ModContent.cs:30

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static Texture2D Terraria.ModLoader.ModContent.GetTexture ( string  name)
static

Gets the texture with the specified name. The name is in the format of "ModFolder/OtherFolders/FileNameWithoutExtension". Throws an ArgumentException if the texture does not exist. If a vanilla texture is desired, the format "Terraria/FileNameWithoutExtension" will reference an image from the "terraria/Content/Images" folder. Note: Texture2D is in the Microsoft.Xna.Framework.Graphics namespace.

Exceptions
MissingResourceExceptionMissing mod: " + name

Definition at line 72 of file ModContent.cs.

References Terraria.ModLoader.ModLoader.GetMod().

Referenced by Terraria.ModLoader.Mod.AddBackgroundTexture(), Terraria.ModLoader.Mod.AddBossHeadTexture(), Terraria.ModLoader.Mod.AddDust(), Terraria.ModLoader.Mod.AddEquipTexture(), Terraria.ModLoader.Mod.AddMount(), Terraria.ModLoader.Mod.AddNPCHeadTexture(), Terraria.ModLoader.ModProjectile.AutoStaticDefaults(), Terraria.ModLoader.ModItem.AutoStaticDefaults(), Terraria.ModLoader.ModNPC.AutoStaticDefaults(), Terraria.ModLoader.EquipLoader.GetEquipTexture(), Terraria.ModLoader.ModGore.GetGoreSlot(), and Terraria.ModLoader.Mod.LoadMusic().

72  {
73  if (Main.dedServ)
74  return null;
75 
76  string modName, subName;
77  SplitName(name, out modName, out subName);
78  if (modName == "Terraria")
79  return Main.instance.Content.Load<Texture2D>("Images" + Path.DirectorySeparatorChar + subName);
80 
81  Mod mod = ModLoader.GetMod(modName);
82  if (mod == null)
83  throw new MissingResourceException("Missing mod: " + name);
84 
85  return mod.GetTexture(subName);
86  }
static void SplitName(string name, out string domain, out string subName)
Definition: ModContent.cs:30

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int Terraria.ModLoader.ModContent.ItemType< T > ( )
static

Get the id (type) of a ModItem by class. Assumes one instance per class.

Type Constraints
T :ModItem 
T :GetInstance<T>() 
T :item.type 
static void Terraria.ModLoader.ModContent.LoadModContent ( CancellationToken  token,
Action< Mod loadAction 
)
staticprivate

Definition at line 397 of file ModContent.cs.

References Terraria.ModLoader.ModLoader.Mods.

397  {
398  MemoryTracking.Checkpoint();
399  int num = 0;
400  foreach (var mod in ModLoader.Mods) {
401  token.ThrowIfCancellationRequested();
402  Interface.loadMods.SetCurrentMod(num++, $"{mod.Name} v{mod.Version}");
403  try {
404  LoadingMod = mod;
405  loadAction(mod);
406  }
407  catch (Exception e) {
408  e.Data["mod"] = mod.Name;
409  throw;
410  }
411  finally {
412  LoadingMod = null;
413  MemoryTracking.Update(mod.Name);
414  }
415  }
416  }
static int Terraria.ModLoader.ModContent.MountType< T > ( )
static

Get the id (type) of a ModMountData by class. Assumes one instance per class.

Type Constraints
T :ModMountData 
T :GetInstance<T>() 
T :Type 
static bool Terraria.ModLoader.ModContent.MusicExists ( string  name)
static

Returns whether or not a sound with the specified name exists.

Definition at line 191 of file ModContent.cs.

References Terraria.ModLoader.BackgroundTextureLoader.GetBackgroundSlot(), Terraria.ModLoader.NPCHeadLoader.GetBossHeadSlot(), Terraria.ModLoader.BuffLoader.GetBuff(), Terraria.ModLoader.ModDust.GetDust(), Terraria.ModLoader.EquipLoader.GetEquipTexture(), Terraria.ModLoader.NPCHeadLoader.GetHeadSlot(), Terraria.ModLoader.ItemLoader.GetItem(), Terraria.ModLoader.ModLoader.GetMod(), Terraria.ModLoader.MountLoader.GetMount(), Terraria.ModLoader.NPCLoader.GetNPC(), Terraria.ModLoader.ProjectileLoader.GetProjectile(), Terraria.ModLoader.SurfaceBgStyleLoader.GetSurfaceBgStyle(), Terraria.ModLoader.TileLoader.GetTile(), Terraria.ModLoader.UgBgStyleLoader.GetUgBgStyle(), Terraria.ModLoader.WallLoader.GetWall(), Terraria.ModLoader.WaterfallStyleLoader.GetWaterfallStyle(), Terraria.ModLoader.WaterStyleLoader.GetWaterStyle(), Terraria.ModLoader.ModItem.item, Terraria.ModLoader.Mod.MusicExists(), Terraria.ModLoader.ModNPC.npc, Terraria.ModLoader.ModProjectile.projectile, Terraria.ModLoader.ModBuff.Type, Terraria.ModLoader.ModWall.Type, Terraria.ModLoader.ModTile.Type, Terraria.ModLoader.ModMountData.Type, Terraria.ModLoader.ModTileEntity.Type, Terraria.ModLoader.ModDust.Type, and Terraria.ModLoader.ModPrefix.Type.

191  {
192  if (!name.Contains('/')) { return false; }
193  string modName, subName;
194  SplitName(name, out modName, out subName);
195  Mod mod = ModLoader.GetMod(modName);
196  return mod != null && mod.MusicExists(subName);
197  }
static void SplitName(string name, out string domain, out string subName)
Definition: ModContent.cs:30

+ Here is the call graph for this function:

static int Terraria.ModLoader.ModContent.NPCType< T > ( )
static

Get the id (type) of a ModNPC by class. Assumes one instance per class.

Type Constraints
T :ModNPC 
T :GetInstance<T>() 
T :npc.type 
static Stream Terraria.ModLoader.ModContent.OpenRead ( string  assetName,
bool  newFileStream = false 
)
static

Definition at line 629 of file ModContent.cs.

References Terraria.ModLoader.Mod.GetFileStream(), and Terraria.ModLoader.ModLoader.GetMod().

Referenced by Terraria.ModLoader.Audio.MusicStreaming.EnsureLoaded().

629  {
630  if (!assetName.StartsWith("tmod:"))
631  return File.OpenRead(assetName);
632 
633  SplitName(assetName.Substring(5).Replace('\\', '/'), out var modName, out var entryPath);
634  return ModLoader.GetMod(modName).GetFileStream(entryPath, newFileStream);
635  }
static void SplitName(string name, out string domain, out string subName)
Definition: ModContent.cs:30

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static byte Terraria.ModLoader.ModContent.PrefixType< T > ( )
static

Get the id (type) of a ModPrefix by class. Assumes one instance per class.

Type Constraints
T :ModPrefix 
T :GetInstance<T>() 
T :Type 
static int Terraria.ModLoader.ModContent.ProjectileType< T > ( )
static

Get the id (type) of a ModProjectile by class. Assumes one instance per class.

Type Constraints
T :ModProjectile 
T :GetInstance<T>() 
T :projectile.type 
static void Terraria.ModLoader.ModContent.RefreshModLanguage ( GameCulture  culture)
static

Definition at line 527 of file ModContent.cs.

References Terraria.ModLoader.ModBuff.Description, Terraria.ModLoader.ModBuff.DisplayName, Terraria.ModLoader.ModNPC.DisplayName, Terraria.ModLoader.ModItem.DisplayName, Terraria.ModLoader.ModProjectile.DisplayName, Terraria.ModLoader.ModPrefix.DisplayName, Terraria.ModLoader.ModTranslation.GetTranslation(), Terraria.ModLoader.ModItem.item, Terraria.ModLoader.ModTranslation.Key, Terraria.ModLoader.ModLoader.Mods, Terraria.ModLoader.ModNPC.npc, Terraria.ModLoader.ModProjectile.projectile, Terraria.ModLoader.ModItem.Tooltip, Terraria.ModLoader.ModBuff.Type, and Terraria.ModLoader.ModPrefix.Type.

527  {
528  Dictionary<string, LocalizedText> dict = LanguageManager.Instance._localizedTexts;
529  foreach (ModItem item in ItemLoader.items) {
530  LocalizedText text = new LocalizedText(item.DisplayName.Key, item.DisplayName.GetTranslation(culture));
531  Lang._itemNameCache[item.item.type] = SetLocalizedText(dict, text);
532  text = new LocalizedText(item.Tooltip.Key, item.Tooltip.GetTranslation(culture));
533  if (text.Value != null) {
534  text = SetLocalizedText(dict, text);
535  Lang._itemTooltipCache[item.item.type] = ItemTooltip.FromLanguageKey(text.Key);
536  }
537  }
538  foreach (ModPrefix prefix in ModPrefix.prefixes) {
539  LocalizedText text = new LocalizedText(prefix.DisplayName.Key, prefix.DisplayName.GetTranslation(culture));
540  Lang.prefix[prefix.Type] = SetLocalizedText(dict, text);
541  }
542  foreach (var keyValuePair in MapLoader.tileEntries) {
543  foreach (MapEntry entry in keyValuePair.Value) {
544  if (entry.translation != null) {
545  LocalizedText text = new LocalizedText(entry.translation.Key, entry.translation.GetTranslation(culture));
546  SetLocalizedText(dict, text);
547  }
548  }
549  }
550  foreach (var keyValuePair in MapLoader.wallEntries) {
551  foreach (MapEntry entry in keyValuePair.Value) {
552  if (entry.translation != null) {
553  LocalizedText text = new LocalizedText(entry.translation.Key, entry.translation.GetTranslation(culture));
554  SetLocalizedText(dict, text);
555  }
556  }
557  }
558  foreach (ModProjectile proj in ProjectileLoader.projectiles) {
559  LocalizedText text = new LocalizedText(proj.DisplayName.Key, proj.DisplayName.GetTranslation(culture));
560  Lang._projectileNameCache[proj.projectile.type] = SetLocalizedText(dict, text);
561  }
562  foreach (ModNPC npc in NPCLoader.npcs) {
563  LocalizedText text = new LocalizedText(npc.DisplayName.Key, npc.DisplayName.GetTranslation(culture));
564  Lang._npcNameCache[npc.npc.type] = SetLocalizedText(dict, text);
565  }
566  foreach (ModBuff buff in BuffLoader.buffs) {
567  LocalizedText text = new LocalizedText(buff.DisplayName.Key, buff.DisplayName.GetTranslation(culture));
568  Lang._buffNameCache[buff.Type] = SetLocalizedText(dict, text);
569  text = new LocalizedText(buff.Description.Key, buff.Description.GetTranslation(culture));
570  Lang._buffDescriptionCache[buff.Type] = SetLocalizedText(dict, text);
571  }
572  foreach (Mod mod in ModLoader.Mods) {
573  foreach (ModTranslation translation in mod.translations.Values) {
574  LocalizedText text = new LocalizedText(translation.Key, translation.GetTranslation(culture));
575  SetLocalizedText(dict, text);
576  }
577  }
578  LanguageManager.Instance.ProcessCopyCommandsInTexts();
579  }
static LocalizedText SetLocalizedText(Dictionary< string, LocalizedText > dict, LocalizedText value)
Definition: ModContent.cs:344

+ Here is the call graph for this function:

static void Terraria.ModLoader.ModContent.ResizeArrays ( bool  unloading = false)
staticprivate

Definition at line 499 of file ModContent.cs.

499  {
500  ItemLoader.ResizeArrays(unloading);
501  EquipLoader.ResizeAndFillArrays();
502  ModPrefix.ResizeArrays();
503  Main.InitializeItemAnimations();
504  ModDust.ResizeArrays();
505  TileLoader.ResizeArrays(unloading);
506  WallLoader.ResizeArrays(unloading);
507  ProjectileLoader.ResizeArrays();
508  NPCLoader.ResizeArrays(unloading);
509  NPCHeadLoader.ResizeAndFillArrays();
510  ModGore.ResizeAndFillArrays();
511  SoundLoader.ResizeAndFillArrays();
512  MountLoader.ResizeArrays();
513  BuffLoader.ResizeArrays();
514  PlayerHooks.RebuildHooks();
515  BackgroundTextureLoader.ResizeAndFillArrays();
516  UgBgStyleLoader.ResizeAndFillArrays();
517  SurfaceBgStyleLoader.ResizeAndFillArrays();
518  GlobalBgStyleLoader.ResizeAndFillArrays(unloading);
519  WaterStyleLoader.ResizeArrays();
520  WaterfallStyleLoader.ResizeArrays();
521  WorldHooks.ResizeArrays();
522  foreach (LocalizedText text in LanguageManager.Instance._localizedTexts.Values) {
523  text.Override = null;
524  }
525  }
static LocalizedText Terraria.ModLoader.ModContent.SetLocalizedText ( Dictionary< string, LocalizedText >  dict,
LocalizedText  value 
)
staticprivate

Definition at line 344 of file ModContent.cs.

References Terraria.ModLoader.ModLoader.Mods.

344  {
345  if (dict.ContainsKey(value.Key)) {
346  dict[value.Key].SetValue(value.Value);
347  }
348  else {
349  dict[value.Key] = value;
350  }
351  return dict[value.Key];
352  }
static void Terraria.ModLoader.ModContent.SetupRecipes ( CancellationToken  token)
staticprivate

Definition at line 418 of file ModContent.cs.

References Terraria.ModLoader.Console, and Terraria.ModLoader.ModLoader.Mods.

418  {
419  Interface.loadMods.SetLoadStage("tModLoader.MSAddingRecipes");
420  for (int k = 0; k < Recipe.maxRecipes; k++) {
421  token.ThrowIfCancellationRequested();
422  Main.recipe[k] = new Recipe();
423  }
424 
425  Recipe.numRecipes = 0;
426  RecipeGroupHelper.ResetRecipeGroups();
427  RecipeHooks.setupRecipes = true;
428  Recipe.SetupRecipes();
429  RecipeHooks.setupRecipes = false;
430  }
static bool Terraria.ModLoader.ModContent.SoundExists ( string  name)
static

Returns whether or not a sound with the specified name exists.

Definition at line 164 of file ModContent.cs.

References Terraria.ModLoader.ModLoader.GetMod(), and Terraria.ModLoader.Mod.SoundExists().

164  {
165  if (!name.Contains('/'))
166  return false;
167 
168  string modName, subName;
169  SplitName(name, out modName, out subName);
170 
171  Mod mod = ModLoader.GetMod(modName);
172  return mod != null && mod.SoundExists(subName);
173  }
static void SplitName(string name, out string domain, out string subName)
Definition: ModContent.cs:30

+ Here is the call graph for this function:

static void Terraria.ModLoader.ModContent.SplitName ( string  name,
out string  domain,
out string  subName 
)
static

Definition at line 30 of file ModContent.cs.

30  {
31  int slash = name.IndexOf('/');
32  if (slash < 0)
33  throw new MissingResourceException("Missing mod qualifier: " + name);
34 
35  domain = name.Substring(0, slash);
36  subName = name.Substring(slash + 1);
37  }
static bool Terraria.ModLoader.ModContent.TextureExists ( string  name)
static

Returns whether or not a texture with the specified name exists.

Definition at line 91 of file ModContent.cs.

References Terraria.ModLoader.ModLoader.GetMod(), and Terraria.ModLoader.Mod.TextureExists().

Referenced by Terraria.ModLoader.Mod.AddEquipTexture(), Terraria.ModLoader.Mod.AddMount(), and Terraria.ModLoader.ModItem.AutoStaticDefaults().

91  {
92  if (Main.dedServ || string.IsNullOrWhiteSpace(name) || !name.Contains('/'))
93  return false;
94 
95  SplitName(name, out string modName, out string subName);
96 
97  if (modName == "Terraria")
98  return (Main.instance.Content as TMLContentManager).ImageExists(subName);
99 
100  Mod mod = ModLoader.GetMod(modName);
101 
102  return mod != null && mod.TextureExists(subName);
103  }
static void SplitName(string name, out string domain, out string subName)
Definition: ModContent.cs:30

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int Terraria.ModLoader.ModContent.TileEntityType< T > ( )
static

Get the id (type) of a ModTileEntity by class. Assumes one instance per class.

Type Constraints
T :ModTileEntity 
T :GetInstance<T>() 
T :Type 
static int Terraria.ModLoader.ModContent.TileType< T > ( )
static

Get the id (type) of a ModTile by class. Assumes one instance per class.

Type Constraints
T :ModTile 
T :GetInstance<T>() 
T :Type 
static int Terraria.ModLoader.ModContent.WallType< T > ( )
static

Get the id (type) of a ModWall by class. Assumes one instance per class.

Type Constraints
T :ModWall 
T :GetInstance<T>() 
T :Type