Terraria ModLoader  0.11.1
A framework for 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...

+ Collaboration diagram for Terraria.ModLoader.ModContent:

Static Public Member Functions

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 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 bool MusicExists (string name)
 Returns whether or not a sound with the specified name exists. More...
 
static Stream OpenRead (string assetName, bool newFileStream=false)
 
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 Private Member Functions

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

Static Private Attributes

static readonly string ImagePath = "Content" + Path.DirectorySeparatorChar + "Images"
 

Detailed Description

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

Definition at line 22 of file ModContent.cs.

Member Function Documentation

◆ CacheVanillaState()

static void Terraria.ModLoader.ModContent.CacheVanillaState ( )
staticprivate

Definition at line 339 of file ModContent.cs.

339  {
340  EffectsTracker.CacheVanillaState();
341  }

◆ DisposeMusic()

static void Terraria.ModLoader.ModContent.DisposeMusic ( )
staticprivate

Definition at line 517 of file ModContent.cs.

References Terraria.ModLoader.ModItem.item, and Terraria.ModLoader.ModNPC.npc.

517  {
518  foreach (var music in Main.music.OfType<MusicStreaming>())
519  music.Dispose();
520  }

◆ FileExists()

static bool Terraria.ModLoader.ModContent.FileExists ( string  name)
static

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

Definition at line 55 of file ModContent.cs.

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

55  {
56  if (!name.Contains('/'))
57  return false;
58 
59  string modName, subName;
60  SplitName(name, out modName, out subName);
61 
62  Mod mod = ModLoader.GetMod(modName);
63  return mod != null && mod.FileExists(subName);
64  }
static void SplitName(string name, out string domain, out string subName)
Definition: ModContent.cs:28
+ Here is the call graph for this function:

◆ GetEquipTexture()

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

◆ GetFileBytes()

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 41 of file ModContent.cs.

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

41  {
42  string modName, subName;
43  SplitName(name, out modName, out subName);
44 
45  Mod mod = ModLoader.GetMod(modName);
46  if (mod == null)
47  throw new MissingResourceException("Missing mod: " + name);
48 
49  return mod.GetFileBytes(subName);
50  }
static void SplitName(string name, out string domain, out string subName)
Definition: ModContent.cs:28
+ Here is the call graph for this function:

◆ GetModBackgroundSlot()

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

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

◆ GetModBossHeadSlot()

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

◆ GetModBuff()

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.

◆ GetModDust()

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.

◆ GetModHeadSlot()

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.

◆ GetModItem()

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.

◆ GetModMountData()

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.

◆ GetModNPC()

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.

◆ GetModProjectile()

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.

◆ GetModSurfaceBgStyle()

static ModSurfaceBgStyle Terraria.ModLoader.ModContent.GetModSurfaceBgStyle ( int  style)
static

Returns the ModSurfaceBgStyle object with the given ID.

◆ GetModTile()

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.

◆ GetModUgBgStyle()

static ModUgBgStyle Terraria.ModLoader.ModContent.GetModUgBgStyle ( int  style)
static

Returns the ModUgBgStyle object with the given ID.

◆ GetModWall()

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.

◆ GetModWaterfallStyle()

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

Returns the ModWaterfallStyle with the given ID.

◆ GetModWaterStyle()

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

Returns the ModWaterStyle with the given ID.

◆ GetMusic()

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 171 of file ModContent.cs.

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

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

171  {
172  if (Main.dedServ) { return null; }
173  string modName, subName;
174  SplitName(name, out modName, out subName);
175  Mod mod = ModLoader.GetMod(modName);
176  if (mod == null) { throw new MissingResourceException("Missing mod: " + name); }
177  return mod.GetMusic(subName);
178  }
static void SplitName(string name, out string domain, out string subName)
Definition: ModContent.cs:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSound()

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 139 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().

139  {
140  if (Main.dedServ)
141  return null;
142 
143  string modName, subName;
144  SplitName(name, out modName, out subName);
145 
146  Mod mod = ModLoader.GetMod(modName);
147  if (mod == null)
148  throw new MissingResourceException("Missing mod: " + name);
149 
150  return mod.GetSound(subName);
151  }
static void SplitName(string name, out string domain, out string subName)
Definition: ModContent.cs:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetTexture()

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 70 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().

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

◆ LoadModContent()

static void Terraria.ModLoader.ModContent.LoadModContent ( Action< Mod loadAction)
staticprivate

Definition at line 344 of file ModContent.cs.

References Terraria.ModLoader.ModLoader.Mods.

344  {
345  MemoryTracking.Checkpoint();
346  int num = 0;
347  foreach (var mod in ModLoader.Mods) {
348  Interface.loadMods.SetCurrentMod(num++, $"{mod.Name} v{mod.Version}");
349  try {
350  LoadingMod = mod;
351  loadAction(mod);
352  }
353  catch (Exception e) {
354  e.Data["mod"] = mod.Name;
355  throw;
356  }
357  finally {
358  LoadingMod = null;
359  MemoryTracking.Update(mod.Name);
360  }
361  }
362  }

◆ MusicExists()

◆ OpenRead()

static Stream Terraria.ModLoader.ModContent.OpenRead ( string  assetName,
bool  newFileStream = false 
)
static

Definition at line 551 of file ModContent.cs.

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

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

551  {
552  if (!assetName.StartsWith("tmod:"))
553  return File.OpenRead(assetName);
554 
555  SplitName(assetName.Substring(5).Replace('\\', '/'), out var modName, out var entryPath);
556  return ModLoader.GetMod(modName).GetFileStream(entryPath, newFileStream);
557  }
static void SplitName(string name, out string domain, out string subName)
Definition: ModContent.cs:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RefreshModLanguage()

static void Terraria.ModLoader.ModContent.RefreshModLanguage ( GameCulture  culture)
static

Definition at line 463 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.

463  {
464  Dictionary<string, LocalizedText> dict = LanguageManager.Instance._localizedTexts;
465  foreach (ModItem item in ItemLoader.items) {
466  LocalizedText text = new LocalizedText(item.DisplayName.Key, item.DisplayName.GetTranslation(culture));
467  Lang._itemNameCache[item.item.type] = SetLocalizedText(dict, text);
468  text = new LocalizedText(item.Tooltip.Key, item.Tooltip.GetTranslation(culture));
469  if (text.Value != null) {
470  text = SetLocalizedText(dict, text);
471  Lang._itemTooltipCache[item.item.type] = ItemTooltip.FromLanguageKey(text.Key);
472  }
473  }
474  foreach (ModPrefix prefix in ModPrefix.prefixes) {
475  LocalizedText text = new LocalizedText(prefix.DisplayName.Key, prefix.DisplayName.GetTranslation(culture));
476  Lang.prefix[prefix.Type] = SetLocalizedText(dict, text);
477  }
478  foreach (var keyValuePair in MapLoader.tileEntries) {
479  foreach (MapEntry entry in keyValuePair.Value) {
480  if (entry.translation != null) {
481  LocalizedText text = new LocalizedText(entry.translation.Key, entry.translation.GetTranslation(culture));
482  SetLocalizedText(dict, text);
483  }
484  }
485  }
486  foreach (var keyValuePair in MapLoader.wallEntries) {
487  foreach (MapEntry entry in keyValuePair.Value) {
488  if (entry.translation != null) {
489  LocalizedText text = new LocalizedText(entry.translation.Key, entry.translation.GetTranslation(culture));
490  SetLocalizedText(dict, text);
491  }
492  }
493  }
494  foreach (ModProjectile proj in ProjectileLoader.projectiles) {
495  LocalizedText text = new LocalizedText(proj.DisplayName.Key, proj.DisplayName.GetTranslation(culture));
496  Lang._projectileNameCache[proj.projectile.type] = SetLocalizedText(dict, text);
497  }
498  foreach (ModNPC npc in NPCLoader.npcs) {
499  LocalizedText text = new LocalizedText(npc.DisplayName.Key, npc.DisplayName.GetTranslation(culture));
500  Lang._npcNameCache[npc.npc.type] = SetLocalizedText(dict, text);
501  }
502  foreach (ModBuff buff in BuffLoader.buffs) {
503  LocalizedText text = new LocalizedText(buff.DisplayName.Key, buff.DisplayName.GetTranslation(culture));
504  Lang._buffNameCache[buff.Type] = SetLocalizedText(dict, text);
505  text = new LocalizedText(buff.Description.Key, buff.Description.GetTranslation(culture));
506  Lang._buffDescriptionCache[buff.Type] = SetLocalizedText(dict, text);
507  }
508  foreach (Mod mod in ModLoader.Mods) {
509  foreach (ModTranslation translation in mod.translations.Values) {
510  LocalizedText text = new LocalizedText(translation.Key, translation.GetTranslation(culture));
511  SetLocalizedText(dict, text);
512  }
513  }
514  LanguageManager.Instance.ProcessCopyCommandsInTexts();
515  }
static LocalizedText SetLocalizedText(Dictionary< string, LocalizedText > dict, LocalizedText value)
Definition: ModContent.cs:286
+ Here is the call graph for this function:

◆ ResizeArrays()

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

Definition at line 435 of file ModContent.cs.

435  {
436  ItemLoader.ResizeArrays(unloading);
437  EquipLoader.ResizeAndFillArrays();
438  ModPrefix.ResizeArrays();
439  Main.InitializeItemAnimations();
440  ModDust.ResizeArrays();
441  TileLoader.ResizeArrays(unloading);
442  WallLoader.ResizeArrays(unloading);
443  ProjectileLoader.ResizeArrays();
444  NPCLoader.ResizeArrays(unloading);
445  NPCHeadLoader.ResizeAndFillArrays();
446  ModGore.ResizeAndFillArrays();
447  SoundLoader.ResizeAndFillArrays();
448  MountLoader.ResizeArrays();
449  BuffLoader.ResizeArrays();
450  PlayerHooks.RebuildHooks();
451  BackgroundTextureLoader.ResizeAndFillArrays();
452  UgBgStyleLoader.ResizeAndFillArrays();
453  SurfaceBgStyleLoader.ResizeAndFillArrays();
454  GlobalBgStyleLoader.ResizeAndFillArrays(unloading);
455  WaterStyleLoader.ResizeArrays();
456  WaterfallStyleLoader.ResizeArrays();
457  WorldHooks.ResizeArrays();
458  foreach (LocalizedText text in LanguageManager.Instance._localizedTexts.Values) {
459  text.Override = null;
460  }
461  }

◆ SetLocalizedText()

static LocalizedText Terraria.ModLoader.ModContent.SetLocalizedText ( Dictionary< string, LocalizedText >  dict,
LocalizedText  value 
)
staticprivate

Definition at line 286 of file ModContent.cs.

References Terraria.ModLoader.Mod.Load(), Terraria.ModLoader.Mod.LoadResources(), Terraria.ModLoader.ModLoader.Mods, Terraria.ModLoader.Mod.Name, and Terraria.ModLoader.Mod.PostSetupContent().

286  {
287  if (dict.ContainsKey(value.Key)) {
288  dict[value.Key].SetValue(value.Value);
289  }
290  else {
291  dict[value.Key] = value;
292  }
293  return dict[value.Key];
294  }
+ Here is the call graph for this function:

◆ SetupRecipes()

static void Terraria.ModLoader.ModContent.SetupRecipes ( )
staticprivate

Definition at line 364 of file ModContent.cs.

References Terraria.ModLoader.ModLoader.Mods.

364  {
365  Interface.loadMods.SetLoadStage("tModLoader.MSAddingRecipes");
366  for (int k = 0; k < Recipe.maxRecipes; k++)
367  Main.recipe[k] = new Recipe();
368 
369  Recipe.numRecipes = 0;
370  RecipeGroupHelper.ResetRecipeGroups();
371  Recipe.SetupRecipes();
372  }

◆ SoundExists()

static bool Terraria.ModLoader.ModContent.SoundExists ( string  name)
static

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

Definition at line 156 of file ModContent.cs.

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

156  {
157  if (!name.Contains('/'))
158  return false;
159 
160  string modName, subName;
161  SplitName(name, out modName, out subName);
162 
163  Mod mod = ModLoader.GetMod(modName);
164  return mod != null && mod.SoundExists(subName);
165  }
static void SplitName(string name, out string domain, out string subName)
Definition: ModContent.cs:28
+ Here is the call graph for this function:

◆ SplitName()

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

Definition at line 28 of file ModContent.cs.

28  {
29  int slash = name.IndexOf('/');
30  if (slash < 0)
31  throw new MissingResourceException("Missing mod qualifier: " + name);
32 
33  domain = name.Substring(0, slash);
34  subName = name.Substring(slash + 1);
35  }

◆ TextureExists()

static bool Terraria.ModLoader.ModContent.TextureExists ( string  name)
static

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

Definition at line 89 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().

89  {
90  if (!name.Contains('/'))
91  return false;
92 
93  string modName, subName;
94  SplitName(name, out modName, out subName);
95 
96  if (modName == "Terraria")
97  return File.Exists(ImagePath + Path.DirectorySeparatorChar + subName + ".xnb");
98 
99  Mod mod = ModLoader.GetMod(modName);
100  return mod != null && mod.TextureExists(subName);
101  }
static void SplitName(string name, out string domain, out string subName)
Definition: ModContent.cs:28
static readonly string ImagePath
Definition: ModContent.cs:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ ImagePath

readonly string Terraria.ModLoader.ModContent.ImagePath = "Content" + Path.DirectorySeparatorChar + "Images"
staticprivate

Definition at line 24 of file ModContent.cs.