Terraria ModLoader  0.11.5
A framework for Terraria mods
ModContent.cs
Go to the documentation of this file.
1 using Microsoft.Xna.Framework.Audio;
2 using Microsoft.Xna.Framework.Graphics;
3 using System;
4 using System.Collections.Generic;
5 using System.IO;
6 using System.Linq;
7 using System.Threading;
8 using Terraria.GameContent.UI;
9 using Terraria.GameInput;
10 using Terraria.Localization;
12 using Terraria.ModLoader.Core;
13 using Terraria.ModLoader.Engine;
15 using Terraria.ModLoader.IO;
16 using Terraria.ModLoader.UI;
17 using Terraria.UI;
18 
19 namespace Terraria.ModLoader
20 {
25  public static class ModContent
26  {
27  public static T GetInstance<T>() where T : class => ContentInstance<T>.Instance;
28 
29  public static void SplitName(string name, out string domain, out string subName) {
30  int slash = name.IndexOf('/');
31  if (slash < 0)
32  throw new MissingResourceException("Missing mod qualifier: " + name);
33 
34  domain = name.Substring(0, slash);
35  subName = name.Substring(slash + 1);
36  }
37 
42  public static byte[] GetFileBytes(string name) {
43  string modName, subName;
44  SplitName(name, out modName, out subName);
45 
46  Mod mod = ModLoader.GetMod(modName);
47  if (mod == null)
48  throw new MissingResourceException("Missing mod: " + name);
49 
50  return mod.GetFileBytes(subName);
51  }
52 
56  public static bool FileExists(string name) {
57  if (!name.Contains('/'))
58  return false;
59 
60  string modName, subName;
61  SplitName(name, out modName, out subName);
62 
63  Mod mod = ModLoader.GetMod(modName);
64  return mod != null && mod.FileExists(subName);
65  }
66 
71  public static Texture2D GetTexture(string name) {
72  if (Main.dedServ)
73  return null;
74 
75  string modName, subName;
76  SplitName(name, out modName, out subName);
77  if (modName == "Terraria")
78  return Main.instance.Content.Load<Texture2D>("Images" + Path.DirectorySeparatorChar + subName);
79 
80  Mod mod = ModLoader.GetMod(modName);
81  if (mod == null)
82  throw new MissingResourceException("Missing mod: " + name);
83 
84  return mod.GetTexture(subName);
85  }
86 
87  private static readonly string ImagePath = "Content" + Path.DirectorySeparatorChar + "Images";
91  public static bool TextureExists(string name) {
92  if (!name.Contains('/'))
93  return false;
94 
95  string modName, subName;
96  SplitName(name, out modName, out subName);
97 
98  if (modName == "Terraria")
99  return File.Exists(ImagePath + Path.DirectorySeparatorChar + subName + ".xnb");
100 
101  Mod mod = ModLoader.GetMod(modName);
102  return mod != null && mod.TextureExists(subName);
103  }
104 
111  internal static bool TryGetTexture(string name, out Texture2D texture) {
112  if (Main.dedServ) {
113  texture = null;
114  return false;
115  }
116 
117  string modName, subName;
118  SplitName(name, out modName, out subName);
119  if (modName == "Terraria") {
120  if (File.Exists(ImagePath + Path.DirectorySeparatorChar + subName + ".xnb")) {
121  texture = Main.instance.Content.Load<Texture2D>("Images" + Path.DirectorySeparatorChar + subName);
122  return true;
123  }
124  texture = null;
125  return false;
126  }
127 
128  Mod mod = ModLoader.GetMod(modName);
129  if (mod == null) {
130  texture = null;
131  return false;
132  }
133 
134  return mod.textures.TryGetValue(subName, out texture);
135  }
136 
141  public static SoundEffect GetSound(string name) {
142  if (Main.dedServ)
143  return null;
144 
145  string modName, subName;
146  SplitName(name, out modName, out subName);
147 
148  Mod mod = ModLoader.GetMod(modName);
149  if (mod == null)
150  throw new MissingResourceException("Missing mod: " + name);
151 
152  return mod.GetSound(subName);
153  }
154 
158  public static bool SoundExists(string name) {
159  if (!name.Contains('/'))
160  return false;
161 
162  string modName, subName;
163  SplitName(name, out modName, out subName);
164 
165  Mod mod = ModLoader.GetMod(modName);
166  return mod != null && mod.SoundExists(subName);
167  }
168 
173  public static Music GetMusic(string name) {
174  if (Main.dedServ) { return null; }
175  string modName, subName;
176  SplitName(name, out modName, out subName);
177  Mod mod = ModLoader.GetMod(modName);
178  if (mod == null) { throw new MissingResourceException("Missing mod: " + name); }
179  return mod.GetMusic(subName);
180  }
181 
185  public static bool MusicExists(string name) {
186  if (!name.Contains('/')) { return false; }
187  string modName, subName;
188  SplitName(name, out modName, out subName);
189  Mod mod = ModLoader.GetMod(modName);
190  return mod != null && mod.MusicExists(subName);
191  }
192 
198  public static ModNPC GetModNPC(int type) => NPCLoader.GetNPC(type);
199 
205  public static int GetModBossHeadSlot(string texture) => NPCHeadLoader.GetBossHeadSlot(texture);
206 
212  public static int GetModHeadSlot(string texture) => NPCHeadLoader.GetHeadSlot(texture);
213 
217  public static ModItem GetModItem(int type) => ItemLoader.GetItem(type);
218 
222  public static ModDust GetModDust(int type) => ModDust.GetDust(type);
223 
229  public static ModProjectile GetModProjectile(int type) => ProjectileLoader.GetProjectile(type);
230 
234  public static ModBuff GetModBuff(int type) => BuffLoader.GetBuff(type);
235 
242  public static EquipTexture GetEquipTexture(EquipType type, int slot) => EquipLoader.GetEquipTexture(type, slot);
243 
249  public static ModMountData GetModMountData(int type) => MountLoader.GetMount(type);
250 
256  public static ModTile GetModTile(int type) => TileLoader.GetTile(type);
257 
261  public static ModWall GetModWall(int type) => WallLoader.GetWall(type);
262 
266  public static ModWaterStyle GetModWaterStyle(int style) => WaterStyleLoader.GetWaterStyle(style);
267 
271  public static ModWaterfallStyle GetModWaterfallStyle(int style) => WaterfallStyleLoader.GetWaterfallStyle(style);
272 
276  public static int GetModBackgroundSlot(string texture) => BackgroundTextureLoader.GetBackgroundSlot(texture);
277 
281  public static ModSurfaceBgStyle GetModSurfaceBgStyle(int style) => SurfaceBgStyleLoader.GetSurfaceBgStyle(style);
282 
286  public static ModUgBgStyle GetModUgBgStyle(int style) => UgBgStyleLoader.GetUgBgStyle(style);
287 
291  public static int ItemType<T>() where T : ModItem => GetInstance<T>()?.item.type ?? 0;
292 
296  public static byte PrefixType<T>() where T : ModPrefix => GetInstance<T>()?.Type ?? 0;
297 
301  public static int DustType<T>() where T : ModDust => GetInstance<T>()?.Type ?? 0;
302 
306  public static int TileType<T>() where T : ModTile => GetInstance<T>()?.Type ?? 0;
307 
311  public static int TileEntityType<T>() where T : ModTileEntity => GetInstance<T>()?.Type ?? 0;
312 
316  public static int WallType<T>() where T : ModWall => GetInstance<T>()?.Type ?? 0;
317 
321  public static int ProjectileType<T>() where T : ModProjectile => GetInstance<T>()?.projectile.type ?? 0;
322 
326  public static int NPCType<T>() where T : ModNPC => GetInstance<T>()?.npc.type ?? 0;
327 
331  public static int BuffType<T>() where T : ModBuff => GetInstance<T>()?.Type ?? 0;
332 
336  public static int MountType<T>() where T : ModMountData => GetInstance<T>()?.Type ?? 0;
337 
338  private static LocalizedText SetLocalizedText(Dictionary<string, LocalizedText> dict, LocalizedText value) {
339  if (dict.ContainsKey(value.Key)) {
340  dict[value.Key].SetValue(value.Value);
341  }
342  else {
343  dict[value.Key] = value;
344  }
345  return dict[value.Key];
346  }
347 
348  internal static void Load(CancellationToken token) {
349  CacheVanillaState();
350 
351  Interface.loadMods.SetLoadStage("tModLoader.MSIntializing", ModLoader.Mods.Length);
352  LoadModContent(token, mod => {
353  ContentInstance.Register(mod);
354  mod.loading = true;
355  mod.AutoloadConfig();
356  mod.LoadResources();
357  mod.Autoload();
358  mod.Load();
359  mod.loading = false;
360  });
361 
362  Interface.loadMods.SetLoadStage("tModLoader.MSSettingUp");
363  ResizeArrays();
364  RecipeGroupHelper.FixRecipeGroupLookups();
365 
366  Interface.loadMods.SetLoadStage("tModLoader.MSLoading", ModLoader.Mods.Length);
367  LoadModContent(token, mod => {
368  mod.SetupContent();
369  mod.PostSetupContent();
370  });
371 
372  MemoryTracking.Finish();
373 
374  if (Main.dedServ)
375  ModNet.AssignNetIDs();
376 
377  Main.player[255] = new Player(false); // setup inventory is unnecessary
378 
379  RefreshModLanguage(Language.ActiveCulture);
380  MapLoader.SetupModMap();
381  ItemSorting.SetupWhiteLists();
382  PlayerInput.reinitialize = true;
383  SetupRecipes(token);
384  }
385 
386  private static void CacheVanillaState() {
387  EffectsTracker.CacheVanillaState();
388  }
389 
390  internal static Mod LoadingMod { get; private set; }
391  private static void LoadModContent(CancellationToken token, Action<Mod> loadAction) {
392  MemoryTracking.Checkpoint();
393  int num = 0;
394  foreach (var mod in ModLoader.Mods) {
395  token.ThrowIfCancellationRequested();
396  Interface.loadMods.SetCurrentMod(num++, $"{mod.Name} v{mod.Version}");
397  try {
398  LoadingMod = mod;
399  loadAction(mod);
400  }
401  catch (Exception e) {
402  e.Data["mod"] = mod.Name;
403  throw;
404  }
405  finally {
406  LoadingMod = null;
407  MemoryTracking.Update(mod.Name);
408  }
409  }
410  }
411 
412  private static void SetupRecipes(CancellationToken token) {
413  Interface.loadMods.SetLoadStage("tModLoader.MSAddingRecipes");
414  for (int k = 0; k < Recipe.maxRecipes; k++) {
415  token.ThrowIfCancellationRequested();
416  Main.recipe[k] = new Recipe();
417  }
418 
419  Recipe.numRecipes = 0;
420  RecipeGroupHelper.ResetRecipeGroups();
421  Recipe.SetupRecipes();
422  }
423 
424  internal static void UnloadModContent() {
425  int i = 0;
426  foreach (var mod in ModLoader.Mods.Reverse()) {
427  try {
428  if (Main.dedServ)
429  Console.WriteLine($"Unloading {mod.DisplayName}...");
430  else
431  Interface.loadMods.SetCurrentMod(i++, mod.DisplayName);
432  mod.Close();
433  mod.UnloadContent();
434  }
435  catch (Exception e) {
436  e.Data["mod"] = mod.Name;
437  throw;
438  }
439  finally {
440  MonoModHooks.RemoveAll(mod);
441  }
442  }
443  }
444 
445  internal static void Unload() {
446  ContentInstance.Clear();
447  ItemLoader.Unload();
448  EquipLoader.Unload();
449  ModPrefix.Unload();
450  ModDust.Unload();
451  TileLoader.Unload();
452  ModTileEntity.Unload();
453  WallLoader.Unload();
454  ProjectileLoader.Unload();
455  NPCLoader.Unload();
456  NPCHeadLoader.Unload();
457  PlayerHooks.Unload();
458  BuffLoader.Unload();
459  MountLoader.Unload();
460  ModGore.Unload();
461  SoundLoader.Unload();
462  DisposeMusic();
463  BackgroundTextureLoader.Unload();
464  UgBgStyleLoader.Unload();
465  SurfaceBgStyleLoader.Unload();
466  GlobalBgStyleLoader.Unload();
467  WaterStyleLoader.Unload();
468  WaterfallStyleLoader.Unload();
469  WorldHooks.Unload();
470  ResizeArrays(true);
471  for (int k = 0; k < Recipe.maxRecipes; k++) {
472  Main.recipe[k] = new Recipe();
473  }
474  Recipe.numRecipes = 0;
475  RecipeGroupHelper.ResetRecipeGroups();
476  Recipe.SetupRecipes();
477  MapLoader.UnloadModMap();
478  ItemSorting.SetupWhiteLists();
479  HotKeyLoader.Unload();
480  RecipeHooks.Unload();
481  CommandManager.Unload();
482  TagSerializer.Reload();
483  ModNet.Unload();
484  Config.ConfigManager.Unload();
485  CustomCurrencyManager.Initialize();
486  EffectsTracker.RemoveModEffects();
487 
488  CleanupModReferences();
489  }
490 
491  private static void ResizeArrays(bool unloading = false) {
492  ItemLoader.ResizeArrays(unloading);
493  EquipLoader.ResizeAndFillArrays();
494  ModPrefix.ResizeArrays();
495  Main.InitializeItemAnimations();
496  ModDust.ResizeArrays();
497  TileLoader.ResizeArrays(unloading);
498  WallLoader.ResizeArrays(unloading);
499  ProjectileLoader.ResizeArrays();
500  NPCLoader.ResizeArrays(unloading);
501  NPCHeadLoader.ResizeAndFillArrays();
502  ModGore.ResizeAndFillArrays();
503  SoundLoader.ResizeAndFillArrays();
504  MountLoader.ResizeArrays();
505  BuffLoader.ResizeArrays();
506  PlayerHooks.RebuildHooks();
507  BackgroundTextureLoader.ResizeAndFillArrays();
508  UgBgStyleLoader.ResizeAndFillArrays();
509  SurfaceBgStyleLoader.ResizeAndFillArrays();
510  GlobalBgStyleLoader.ResizeAndFillArrays(unloading);
511  WaterStyleLoader.ResizeArrays();
512  WaterfallStyleLoader.ResizeArrays();
513  WorldHooks.ResizeArrays();
514  foreach (LocalizedText text in LanguageManager.Instance._localizedTexts.Values) {
515  text.Override = null;
516  }
517  }
518 
519  public static void RefreshModLanguage(GameCulture culture) {
520  Dictionary<string, LocalizedText> dict = LanguageManager.Instance._localizedTexts;
521  foreach (ModItem item in ItemLoader.items) {
522  LocalizedText text = new LocalizedText(item.DisplayName.Key, item.DisplayName.GetTranslation(culture));
523  Lang._itemNameCache[item.item.type] = SetLocalizedText(dict, text);
524  text = new LocalizedText(item.Tooltip.Key, item.Tooltip.GetTranslation(culture));
525  if (text.Value != null) {
526  text = SetLocalizedText(dict, text);
527  Lang._itemTooltipCache[item.item.type] = ItemTooltip.FromLanguageKey(text.Key);
528  }
529  }
530  foreach (ModPrefix prefix in ModPrefix.prefixes) {
531  LocalizedText text = new LocalizedText(prefix.DisplayName.Key, prefix.DisplayName.GetTranslation(culture));
532  Lang.prefix[prefix.Type] = SetLocalizedText(dict, text);
533  }
534  foreach (var keyValuePair in MapLoader.tileEntries) {
535  foreach (MapEntry entry in keyValuePair.Value) {
536  if (entry.translation != null) {
537  LocalizedText text = new LocalizedText(entry.translation.Key, entry.translation.GetTranslation(culture));
538  SetLocalizedText(dict, text);
539  }
540  }
541  }
542  foreach (var keyValuePair in MapLoader.wallEntries) {
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 (ModProjectile proj in ProjectileLoader.projectiles) {
551  LocalizedText text = new LocalizedText(proj.DisplayName.Key, proj.DisplayName.GetTranslation(culture));
552  Lang._projectileNameCache[proj.projectile.type] = SetLocalizedText(dict, text);
553  }
554  foreach (ModNPC npc in NPCLoader.npcs) {
555  LocalizedText text = new LocalizedText(npc.DisplayName.Key, npc.DisplayName.GetTranslation(culture));
556  Lang._npcNameCache[npc.npc.type] = SetLocalizedText(dict, text);
557  }
558  foreach (ModBuff buff in BuffLoader.buffs) {
559  LocalizedText text = new LocalizedText(buff.DisplayName.Key, buff.DisplayName.GetTranslation(culture));
560  Lang._buffNameCache[buff.Type] = SetLocalizedText(dict, text);
561  text = new LocalizedText(buff.Description.Key, buff.Description.GetTranslation(culture));
562  Lang._buffDescriptionCache[buff.Type] = SetLocalizedText(dict, text);
563  }
564  foreach (Mod mod in ModLoader.Mods) {
565  foreach (ModTranslation translation in mod.translations.Values) {
566  LocalizedText text = new LocalizedText(translation.Key, translation.GetTranslation(culture));
567  SetLocalizedText(dict, text);
568  }
569  }
570  LanguageManager.Instance.ProcessCopyCommandsInTexts();
571  }
572 
573  private static void DisposeMusic() {
574  foreach (var music in Main.music.OfType<MusicStreaming>())
575  music.Dispose();
576  }
577 
582  internal static void CleanupModReferences() {
583  // Clear references to ModPlayer instances
584  for (int i = 0; i < 256; i++) {
585  Main.player[i] = new Player();
586  }
587 
588  Main.clientPlayer = new Player(false);
589  Main.ActivePlayerFileData = new Terraria.IO.PlayerFileData();
590  Main._characterSelectMenu._playerList?.Clear();
591  Main.PlayerList.Clear();
592 
593  foreach (var npc in Main.npc) {
594  npc.SetDefaults(0);
595  }
596 
597  foreach (var item in Main.item) {
598  item.SetDefaults(0);
599  }
600  ItemSlot.singleSlotArray[0]?.SetDefaults(0);
601 
602  for (int i = 0; i < Main.chest.Length; i++) {
603  Main.chest[i] = new Chest();
604  }
605 
606  for (int i = 0; i < 1001; i++) {
607  Main.projectile[i] = new Projectile();
608  }
609  }
610 
611  public static Stream OpenRead(string assetName, bool newFileStream = false) {
612  if (!assetName.StartsWith("tmod:"))
613  return File.OpenRead(assetName);
614 
615  SplitName(assetName.Substring(5).Replace('\\', '/'), out var modName, out var entryPath);
616  return ModLoader.GetMod(modName).GetFileStream(entryPath, newFileStream);
617  }
618  }
619 }
static void LoadModContent(CancellationToken token, Action< Mod > loadAction)
Definition: ModContent.cs:391
static byte[] GetFileBytes(string name)
Gets the byte representation of the file with the specified name. The name is in the format of "ModFo...
Definition: ModContent.cs:42
int Type
The ID of this type of dust.
Definition: ModDust.cs:47
static ModWaterfallStyle GetWaterfallStyle(int style)
Returns the ModWaterfallStyle with the given ID.
int Type
The index of this ModMountData in the Mount.mounts array.
Definition: ModMountData.cs:32
static ModMountData GetMount(int type)
Gets the ModMountData instance corresponding to the given type. Returns null if no ModMountData has t...
Definition: MountLoader.cs:21
ModTranslation DisplayName
The translations for the display name of this NPC.
Definition: ModNPC.cs:45
This class represents a type of tile that can be added by a mod. Only one instance of this class will...
Definition: ModTile.cs:12
int Type
The numeric type used to identify this kind of tile entity.
This class serves as a place for you to place all your properties and hooks for each NPC...
Definition: ModNPC.cs:14
ModTranslation Description
The translations of this buff&#39;s description.
Definition: ModBuff.cs:43
Each background style determines in its own way how exactly the background is drawn. This class serves as a collection of functions for above-ground backgrounds.
This is the class that keeps track of all modded background textures and their slots/IDs.
static void CacheVanillaState()
Definition: ModContent.cs:386
This serves as the central class from which projectile-related functions are carried out...
static EquipTexture GetEquipTexture(EquipType type, int slot)
Gets the equipment texture for the specified equipment type and ID.
Definition: EquipLoader.cs:56
This is where all ModPlayer hooks are gathered and called.
Definition: PlayerHooks.cs:20
static Music GetMusic(string name)
Gets the music with the specified name. The name is in the same format as for texture names...
Definition: ModContent.cs:173
This is where all ModRecipe and GlobalRecipe hooks are gathered and called.
Definition: RecipeHooks.cs:9
Tile Entities are Entities tightly coupled with tiles, allowing the possibility of tiles to exhibit c...
static Texture2D GetTexture(string name)
Gets the texture with the specified name. The name is in the format of "ModFolder/OtherFolders/FileNa...
Definition: ModContent.cs:71
This serves as the central class from which ModUgBgStyle functions are supported and carried out...
static void SetupRecipes(CancellationToken token)
Definition: ModContent.cs:412
static ModWall GetWall(int type)
Gets the ModWall instance with the given type. If no ModWall with the given type exists, returns null.
Definition: WallLoader.cs:50
static LocalizedText SetLocalizedText(Dictionary< string, LocalizedText > dict, LocalizedText value)
Definition: ModContent.cs:338
ModTranslation DisplayName
Definition: ModPrefix.cs:97
This serves as a place for you to program behaviors of equipment textures. This is useful for equipme...
Definition: EquipTexture.cs:8
static ModTile GetTile(int type)
Gets the ModTile instance with the given type. If no ModTile with the given type exists, returns null.
Definition: TileLoader.cs:102
Item item
The item object that this ModItem controls.
Definition: ModItem.cs:26
This serves as the central class which loads mods. It contains many static fields and methods related...
Definition: ModLoader.cs:26
Music GetMusic(string name)
Shorthand for calling ModContent.GetMusic(this.FileName(name)).
Definition: Mod.cs:1634
This serves as the central class from which tile-related functions are supported and carried out...
Definition: TileLoader.cs:14
static ModProjectile GetProjectile(int type)
Gets the ModProjectile instance corresponding to the specified type.
This is where all ModWorld hooks are gathered and called.
Definition: WorldHooks.cs:12
ushort Type
The internal ID of this type of wall.
Definition: ModWall.cs:33
Command can be used in server console during MP.
This class allows you to customize the behavior of a custom gore. Create a new instance of this and p...
Definition: ModGore.cs:12
NPC npc
The NPC object that this ModNPC controls.
Definition: ModNPC.cs:21
static int GetBackgroundSlot(string texture)
Returns the slot/ID of the background texture with the given name.
Represents a style of water that gets drawn, based on factors such as the background. This is used to determine the color of the water, as well as other things as determined by the hooks below.
Definition: ModWaterStyle.cs:8
This class serves as a central place from which NPC head slots are stored and NPC head textures are a...
static ModItem GetItem(int type)
Gets the ModItem instance corresponding to the specified type. Returns null if no modded item has the...
Definition: ItemLoader.cs:76
static ModUgBgStyle GetUgBgStyle(int style)
Returns the ModUgBgStyle object with the given ID.
This serves as a central place to store equipment slots and their corresponding textures. You will use this to obtain the IDs for your equipment textures.
Definition: EquipLoader.cs:11
Manages content added by mods. Liasons between mod content and Terraria&#39;s arrays and oversees the Loa...
Definition: ModContent.cs:25
static bool TextureExists(string name)
Returns whether or not a texture with the specified name exists.
Definition: ModContent.cs:91
static int GetHeadSlot(string texture)
Gets the index of the head texture corresponding to the given texture path.
EquipType
This is an enum of all the types of equipment that exist. An equipment type is defined as a type or l...
Definition: EquipType.cs:6
Projectile projectile
The projectile object that this ModProjectile controls.
This class is used to keep track of and support the existence of custom sounds that have been added t...
Definition: SoundLoader.cs:11
bool FileExists(string name)
Shorthand for calling ModLoader.FileExists(this.FileName(name)). Note that file extensions are used h...
ModTranslation DisplayName
The translations for the display name of this item.
Definition: ModItem.cs:53
static Stream OpenRead(string assetName, bool newFileStream=false)
Definition: ModContent.cs:611
static ModSurfaceBgStyle GetSurfaceBgStyle(int style)
Returns the ModSurfaceBgStyle object with the given ID.
This class represents a type of wall that can be added by a mod. Only one instance of this class will...
Definition: ModWall.cs:12
This serves as the central class from which item-related functions are carried out. It also stores a list of mod items by ID.
Definition: ItemLoader.cs:21
This class serves as a place for you to place all your properties and hooks for each mount...
Definition: ModMountData.cs:9
bool SoundExists(string name)
Shorthand for calling ModLoader.SoundExists(this.FileName(name)).
ushort Type
The internal ID of this type of tile.
Definition: ModTile.cs:33
static bool MusicExists(string name)
Returns whether or not a sound with the specified name exists.
Definition: ModContent.cs:185
bool TextureExists(string name)
Shorthand for calling ModLoader.TextureExists(this.FileName(name)).
Represents a style of waterfalls that gets drawn. This is mostly used to determine the color of the w...
SoundEffect GetSound(string name)
Shorthand for calling ModContent.GetSound(this.FileName(name)).
Definition: Mod.cs:1614
This serves as the central class from which WaterStyle functions are supported and carried out...
This serves as the central class from which ModCommand functions are supported and carried out...
This class serves as a place for you to define a new buff and how that buff behaves.
Definition: ModBuff.cs:6
Stream GetFileStream(string name, bool newFileStream=false)
Retrieve contents of files within the tmod file
static ModNPC GetNPC(int type)
Gets the ModNPC instance corresponding to the specified type.
Definition: NPCLoader.cs:93
bool MusicExists(string name)
Shorthand for calling ModLoader.MusicExists(this.FileName(name)).
static SoundEffect GetSound(string name)
Gets the sound with the specified name. The name is in the same format as for texture names...
Definition: ModContent.cs:141
static ModDust GetDust(int type)
Gets the ModDust instance with the given type. Returns null if no ModDust with the given type exists...
Definition: ModDust.cs:57
static ModBuff GetBuff(int type)
Gets the ModBuff instance with the given type. If no ModBuff with the given type exists, returns null.
Definition: BuffLoader.cs:77
ModTranslation DisplayName
The translations of this buff&#39;s display name.
Definition: ModBuff.cs:35
This serves as the central class from which NPC-related functions are carried out. It also stores a list of mod NPCs by ID.
Definition: NPCLoader.cs:19
static void SplitName(string name, out string domain, out string subName)
Definition: ModContent.cs:29
This serves as the central class from which buff-related functions are supported and carried out...
Definition: BuffLoader.cs:14
This class serves as a place for you to place all your properties and hooks for each projectile...
byte[] GetFileBytes(string name)
Retrieve contents of files within the tmod file
static void RefreshModLanguage(GameCulture culture)
Definition: ModContent.cs:519
This serves as the central class from which wall-related functions are supported and carried out...
Definition: WallLoader.cs:13
Mod is an abstract class that you will override. It serves as a central place from which the mod&#39;s co...
Definition: Mod.cs:24
static void ResizeArrays(bool unloading=false)
Definition: ModContent.cs:491
static int GetBossHeadSlot(string texture)
Gets the index of the boss head texture corresponding to the given texture path.
ModTranslation DisplayName
The translations for the display name of this projectile.
static Mod GetMod(string name)
Gets the instance of the Mod with the specified name.
Definition: ModLoader.cs:86
This class serves as a place for you to place all your properties and hooks for each item...
Definition: ModItem.cs:16
ModTranslation Tooltip
The translations for the display name of this tooltip.
Definition: ModItem.cs:61
This class represents a type of dust that is added by a mod. Only one instance of this class will eve...
Definition: ModDust.cs:13
int Type
The buff id of this buff.
Definition: ModBuff.cs:27
static bool SoundExists(string name)
Returns whether or not a sound with the specified name exists.
Definition: ModContent.cs:158
string GetTranslation(int culture)
This serves as the central place from which mounts are stored and mount-related functions are carried...
Definition: MountLoader.cs:11
static ModWaterStyle GetWaterStyle(int style)
Returns the ModWaterStyle with the given ID.
Each background style determines in its own way how exactly the background is drawn. This class serves as a collection of functions for underground backgrounds.
static bool FileExists(string name)
Returns whether or not a file with the specified name exists.
Definition: ModContent.cs:56