Terraria ModLoader  0.11.7.4
A mod to make and play 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 
90  public static bool TextureExists(string name) {
91  if (!name.Contains('/'))
92  return false;
93 
94  string modName, subName;
95  SplitName(name, out modName, out subName);
96 
97  if (modName == "Terraria")
98  return !Main.dedServ && (Main.instance.Content as TMLContentManager).ImageExists(subName);
99 
100  Mod mod = ModLoader.GetMod(modName);
101  return mod != null && mod.TextureExists(subName);
102  }
103 
110  internal static bool TryGetTexture(string name, out Texture2D texture) {
111  if (Main.dedServ) {
112  texture = null;
113  return false;
114  }
115 
116  string modName, subName;
117  SplitName(name, out modName, out subName);
118  if (modName == "Terraria") {
119  if((Main.instance.Content as TMLContentManager).ImageExists(subName)) {
120  texture = Main.instance.Content.Load<Texture2D>("Images" + Path.DirectorySeparatorChar + subName);
121  return true;
122  }
123  texture = null;
124  return false;
125  }
126 
127  Mod mod = ModLoader.GetMod(modName);
128  if (mod == null) {
129  texture = null;
130  return false;
131  }
132 
133  return mod.textures.TryGetValue(subName, out texture);
134  }
135 
140  public static SoundEffect GetSound(string name) {
141  if (Main.dedServ)
142  return null;
143 
144  string modName, subName;
145  SplitName(name, out modName, out subName);
146 
147  Mod mod = ModLoader.GetMod(modName);
148  if (mod == null)
149  throw new MissingResourceException("Missing mod: " + name);
150 
151  return mod.GetSound(subName);
152  }
153 
157  public static bool SoundExists(string name) {
158  if (!name.Contains('/'))
159  return false;
160 
161  string modName, subName;
162  SplitName(name, out modName, out subName);
163 
164  Mod mod = ModLoader.GetMod(modName);
165  return mod != null && mod.SoundExists(subName);
166  }
167 
172  public static Music GetMusic(string name) {
173  if (Main.dedServ) { return null; }
174  string modName, subName;
175  SplitName(name, out modName, out subName);
176  Mod mod = ModLoader.GetMod(modName);
177  if (mod == null) { throw new MissingResourceException("Missing mod: " + name); }
178  return mod.GetMusic(subName);
179  }
180 
184  public static bool MusicExists(string name) {
185  if (!name.Contains('/')) { return false; }
186  string modName, subName;
187  SplitName(name, out modName, out subName);
188  Mod mod = ModLoader.GetMod(modName);
189  return mod != null && mod.MusicExists(subName);
190  }
191 
197  public static ModNPC GetModNPC(int type) => NPCLoader.GetNPC(type);
198 
204  public static int GetModBossHeadSlot(string texture) => NPCHeadLoader.GetBossHeadSlot(texture);
205 
211  public static int GetModHeadSlot(string texture) => NPCHeadLoader.GetHeadSlot(texture);
212 
216  public static ModItem GetModItem(int type) => ItemLoader.GetItem(type);
217 
221  public static ModDust GetModDust(int type) => ModDust.GetDust(type);
222 
228  public static ModProjectile GetModProjectile(int type) => ProjectileLoader.GetProjectile(type);
229 
233  public static ModBuff GetModBuff(int type) => BuffLoader.GetBuff(type);
234 
241  public static EquipTexture GetEquipTexture(EquipType type, int slot) => EquipLoader.GetEquipTexture(type, slot);
242 
248  public static ModMountData GetModMountData(int type) => MountLoader.GetMount(type);
249 
255  public static ModTile GetModTile(int type) => TileLoader.GetTile(type);
256 
260  public static ModWall GetModWall(int type) => WallLoader.GetWall(type);
261 
265  public static ModWaterStyle GetModWaterStyle(int style) => WaterStyleLoader.GetWaterStyle(style);
266 
270  public static ModWaterfallStyle GetModWaterfallStyle(int style) => WaterfallStyleLoader.GetWaterfallStyle(style);
271 
275  public static int GetModBackgroundSlot(string texture) => BackgroundTextureLoader.GetBackgroundSlot(texture);
276 
280  public static ModSurfaceBgStyle GetModSurfaceBgStyle(int style) => SurfaceBgStyleLoader.GetSurfaceBgStyle(style);
281 
285  public static ModUgBgStyle GetModUgBgStyle(int style) => UgBgStyleLoader.GetUgBgStyle(style);
286 
290  public static int ItemType<T>() where T : ModItem => GetInstance<T>()?.item.type ?? 0;
291 
295  public static byte PrefixType<T>() where T : ModPrefix => GetInstance<T>()?.Type ?? 0;
296 
300  public static int DustType<T>() where T : ModDust => GetInstance<T>()?.Type ?? 0;
301 
305  public static int TileType<T>() where T : ModTile => GetInstance<T>()?.Type ?? 0;
306 
310  public static int TileEntityType<T>() where T : ModTileEntity => GetInstance<T>()?.Type ?? 0;
311 
315  public static int WallType<T>() where T : ModWall => GetInstance<T>()?.Type ?? 0;
316 
320  public static int ProjectileType<T>() where T : ModProjectile => GetInstance<T>()?.projectile.type ?? 0;
321 
325  public static int NPCType<T>() where T : ModNPC => GetInstance<T>()?.npc.type ?? 0;
326 
330  public static int BuffType<T>() where T : ModBuff => GetInstance<T>()?.Type ?? 0;
331 
335  public static int MountType<T>() where T : ModMountData => GetInstance<T>()?.Type ?? 0;
336 
337  private static LocalizedText SetLocalizedText(Dictionary<string, LocalizedText> dict, LocalizedText value) {
338  if (dict.ContainsKey(value.Key)) {
339  dict[value.Key].SetValue(value.Value);
340  }
341  else {
342  dict[value.Key] = value;
343  }
344  return dict[value.Key];
345  }
346 
347  internal static void Load(CancellationToken token) {
348  CacheVanillaState();
349 
350  Interface.loadMods.SetLoadStage("tModLoader.MSIntializing", ModLoader.Mods.Length);
351  LoadModContent(token, mod => {
352  ContentInstance.Register(mod);
353  mod.loading = true;
354  mod.AutoloadConfig();
355  mod.LoadResources();
356  mod.Autoload();
357  mod.Load();
358  mod.loading = false;
359  });
360 
361  Interface.loadMods.SetLoadStage("tModLoader.MSSettingUp");
362  ResizeArrays();
363  RecipeGroupHelper.FixRecipeGroupLookups();
364 
365  Interface.loadMods.SetLoadStage("tModLoader.MSLoading", ModLoader.Mods.Length);
366  LoadModContent(token, mod => {
367  mod.SetupContent();
368  mod.PostSetupContent();
369  });
370 
371  MemoryTracking.Finish();
372 
373  if (Main.dedServ)
374  ModNet.AssignNetIDs();
375 
376  Main.player[255] = new Player(false); // setup inventory is unnecessary
377 
378  RefreshModLanguage(Language.ActiveCulture);
379  MapLoader.SetupModMap();
380  ItemSorting.SetupWhiteLists();
381  PlayerInput.reinitialize = true;
382  SetupRecipes(token);
383  }
384 
385  private static void CacheVanillaState() {
386  EffectsTracker.CacheVanillaState();
387  }
388 
389  internal static Mod LoadingMod { get; private set; }
390  private static void LoadModContent(CancellationToken token, Action<Mod> loadAction) {
391  MemoryTracking.Checkpoint();
392  int num = 0;
393  foreach (var mod in ModLoader.Mods) {
394  token.ThrowIfCancellationRequested();
395  Interface.loadMods.SetCurrentMod(num++, $"{mod.Name} v{mod.Version}");
396  try {
397  LoadingMod = mod;
398  loadAction(mod);
399  }
400  catch (Exception e) {
401  e.Data["mod"] = mod.Name;
402  throw;
403  }
404  finally {
405  LoadingMod = null;
406  MemoryTracking.Update(mod.Name);
407  }
408  }
409  }
410 
411  private static void SetupRecipes(CancellationToken token) {
412  Interface.loadMods.SetLoadStage("tModLoader.MSAddingRecipes");
413  for (int k = 0; k < Recipe.maxRecipes; k++) {
414  token.ThrowIfCancellationRequested();
415  Main.recipe[k] = new Recipe();
416  }
417 
418  Recipe.numRecipes = 0;
419  RecipeGroupHelper.ResetRecipeGroups();
420  Recipe.SetupRecipes();
421  }
422 
423  internal static void UnloadModContent() {
424  int i = 0;
425  foreach (var mod in ModLoader.Mods.Reverse()) {
426  try {
427  if (Main.dedServ)
428  Console.WriteLine($"Unloading {mod.DisplayName}...");
429  else
430  Interface.loadMods.SetCurrentMod(i++, mod.DisplayName);
431  mod.Close();
432  mod.UnloadContent();
433  }
434  catch (Exception e) {
435  e.Data["mod"] = mod.Name;
436  throw;
437  }
438  finally {
439  MonoModHooks.RemoveAll(mod);
440  }
441  }
442  }
443 
444  internal static void Unload() {
445  ContentInstance.Clear();
446  ItemLoader.Unload();
447  EquipLoader.Unload();
448  ModPrefix.Unload();
449  ModDust.Unload();
450  TileLoader.Unload();
451  ModTileEntity.Unload();
452  WallLoader.Unload();
453  ProjectileLoader.Unload();
454  NPCLoader.Unload();
455  NPCHeadLoader.Unload();
456  PlayerHooks.Unload();
457  BuffLoader.Unload();
458  MountLoader.Unload();
459  ModGore.Unload();
460  SoundLoader.Unload();
461  DisposeMusic();
462  BackgroundTextureLoader.Unload();
463  UgBgStyleLoader.Unload();
464  SurfaceBgStyleLoader.Unload();
465  GlobalBgStyleLoader.Unload();
466  WaterStyleLoader.Unload();
467  WaterfallStyleLoader.Unload();
468  WorldHooks.Unload();
469  ResizeArrays(true);
470  for (int k = 0; k < Recipe.maxRecipes; k++) {
471  Main.recipe[k] = new Recipe();
472  }
473  Recipe.numRecipes = 0;
474  RecipeGroupHelper.ResetRecipeGroups();
475  Recipe.SetupRecipes();
476  MapLoader.UnloadModMap();
477  ItemSorting.SetupWhiteLists();
478  HotKeyLoader.Unload();
479  RecipeHooks.Unload();
480  CommandManager.Unload();
481  TagSerializer.Reload();
482  ModNet.Unload();
483  Config.ConfigManager.Unload();
484  CustomCurrencyManager.Initialize();
485  EffectsTracker.RemoveModEffects();
486 
487  CleanupModReferences();
488  }
489 
490  private static void ResizeArrays(bool unloading = false) {
491  ItemLoader.ResizeArrays(unloading);
492  EquipLoader.ResizeAndFillArrays();
493  ModPrefix.ResizeArrays();
494  Main.InitializeItemAnimations();
495  ModDust.ResizeArrays();
496  TileLoader.ResizeArrays(unloading);
497  WallLoader.ResizeArrays(unloading);
498  ProjectileLoader.ResizeArrays();
499  NPCLoader.ResizeArrays(unloading);
500  NPCHeadLoader.ResizeAndFillArrays();
501  ModGore.ResizeAndFillArrays();
502  SoundLoader.ResizeAndFillArrays();
503  MountLoader.ResizeArrays();
504  BuffLoader.ResizeArrays();
505  PlayerHooks.RebuildHooks();
506  BackgroundTextureLoader.ResizeAndFillArrays();
507  UgBgStyleLoader.ResizeAndFillArrays();
508  SurfaceBgStyleLoader.ResizeAndFillArrays();
509  GlobalBgStyleLoader.ResizeAndFillArrays(unloading);
510  WaterStyleLoader.ResizeArrays();
511  WaterfallStyleLoader.ResizeArrays();
512  WorldHooks.ResizeArrays();
513  foreach (LocalizedText text in LanguageManager.Instance._localizedTexts.Values) {
514  text.Override = null;
515  }
516  }
517 
518  public static void RefreshModLanguage(GameCulture culture) {
519  Dictionary<string, LocalizedText> dict = LanguageManager.Instance._localizedTexts;
520  foreach (ModItem item in ItemLoader.items) {
521  LocalizedText text = new LocalizedText(item.DisplayName.Key, item.DisplayName.GetTranslation(culture));
522  Lang._itemNameCache[item.item.type] = SetLocalizedText(dict, text);
523  text = new LocalizedText(item.Tooltip.Key, item.Tooltip.GetTranslation(culture));
524  if (text.Value != null) {
525  text = SetLocalizedText(dict, text);
526  Lang._itemTooltipCache[item.item.type] = ItemTooltip.FromLanguageKey(text.Key);
527  }
528  }
529  foreach (ModPrefix prefix in ModPrefix.prefixes) {
530  LocalizedText text = new LocalizedText(prefix.DisplayName.Key, prefix.DisplayName.GetTranslation(culture));
531  Lang.prefix[prefix.Type] = SetLocalizedText(dict, text);
532  }
533  foreach (var keyValuePair in MapLoader.tileEntries) {
534  foreach (MapEntry entry in keyValuePair.Value) {
535  if (entry.translation != null) {
536  LocalizedText text = new LocalizedText(entry.translation.Key, entry.translation.GetTranslation(culture));
537  SetLocalizedText(dict, text);
538  }
539  }
540  }
541  foreach (var keyValuePair in MapLoader.wallEntries) {
542  foreach (MapEntry entry in keyValuePair.Value) {
543  if (entry.translation != null) {
544  LocalizedText text = new LocalizedText(entry.translation.Key, entry.translation.GetTranslation(culture));
545  SetLocalizedText(dict, text);
546  }
547  }
548  }
549  foreach (ModProjectile proj in ProjectileLoader.projectiles) {
550  LocalizedText text = new LocalizedText(proj.DisplayName.Key, proj.DisplayName.GetTranslation(culture));
551  Lang._projectileNameCache[proj.projectile.type] = SetLocalizedText(dict, text);
552  }
553  foreach (ModNPC npc in NPCLoader.npcs) {
554  LocalizedText text = new LocalizedText(npc.DisplayName.Key, npc.DisplayName.GetTranslation(culture));
555  Lang._npcNameCache[npc.npc.type] = SetLocalizedText(dict, text);
556  }
557  foreach (ModBuff buff in BuffLoader.buffs) {
558  LocalizedText text = new LocalizedText(buff.DisplayName.Key, buff.DisplayName.GetTranslation(culture));
559  Lang._buffNameCache[buff.Type] = SetLocalizedText(dict, text);
560  text = new LocalizedText(buff.Description.Key, buff.Description.GetTranslation(culture));
561  Lang._buffDescriptionCache[buff.Type] = SetLocalizedText(dict, text);
562  }
563  foreach (Mod mod in ModLoader.Mods) {
564  foreach (ModTranslation translation in mod.translations.Values) {
565  LocalizedText text = new LocalizedText(translation.Key, translation.GetTranslation(culture));
566  SetLocalizedText(dict, text);
567  }
568  }
569  LanguageManager.Instance.ProcessCopyCommandsInTexts();
570  }
571 
572  private static void DisposeMusic() {
573  foreach (var music in Main.music.OfType<MusicStreaming>())
574  music.Dispose();
575  }
576 
581  internal static void CleanupModReferences()
582  {
583  // Clear references to ModPlayer instances
584  for (int i = 0; i < Main.player.Length; i++) {
585  Main.player[i] = new Player();
586  // player.whoAmI is only set for active players
587  }
588 
589  Main.clientPlayer = new Player(false);
590  Main.ActivePlayerFileData = new Terraria.IO.PlayerFileData();
591  Main._characterSelectMenu._playerList?.Clear();
592  Main.PlayerList.Clear();
593 
594  for (int i = 0; i < Main.npc.Length; i++) {
595  Main.npc[i] = new NPC();
596  Main.npc[i].whoAmI = i;
597  }
598 
599  for (int i = 0; i < Main.item.Length; i++) {
600  Main.item[i] = new Item();
601  // item.whoAmI is never used
602  }
603 
604  if (ItemSlot.singleSlotArray[0] != null) {
605  ItemSlot.singleSlotArray[0] = new Item();
606  }
607 
608  for (int i = 0; i < Main.chest.Length; i++) {
609  Main.chest[i] = new Chest();
610  }
611 
612  for (int i = 0; i < Main.projectile.Length; i++) {
613  Main.projectile[i] = new Projectile();
614  // projectile.whoAmI is only set for active projectiles
615  }
616  }
617 
618  public static Stream OpenRead(string assetName, bool newFileStream = false) {
619  if (!assetName.StartsWith("tmod:"))
620  return File.OpenRead(assetName);
621 
622  SplitName(assetName.Substring(5).Replace('\\', '/'), out var modName, out var entryPath);
623  return ModLoader.GetMod(modName).GetFileStream(entryPath, newFileStream);
624  }
625  }
626 }
static void LoadModContent(CancellationToken token, Action< Mod > loadAction)
Definition: ModContent.cs:390
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:37
static ModMountData GetMount(int type)
Gets the ModMountData instance corresponding to the given type. Returns null if no ModMountData has t...
Definition: MountLoader.cs:23
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:385
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:172
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:411
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:337
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:28
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:90
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:618
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:14
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:184
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:140
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:518
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:490
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:90
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:157
string GetTranslation(int culture)
This serves as the central place from which mounts are stored and mount-related functions are carried...
Definition: MountLoader.cs:13
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