Terraria ModLoader  0.11.1
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 Terraria.GameContent.UI;
8 using Terraria.GameInput;
9 using Terraria.Localization;
11 using Terraria.ModLoader.Core;
13 using Terraria.ModLoader.IO;
14 using Terraria.UI;
15 
16 namespace Terraria.ModLoader
17 {
22  public class ModContent
23  {
24  private static readonly string ImagePath = "Content" + Path.DirectorySeparatorChar + "Images";
25 
26  internal static readonly IDictionary<string, ModHotKey> modHotKeys = new Dictionary<string, ModHotKey>();
27 
28  public static void SplitName(string name, out string domain, out string subName) {
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  }
36 
41  public static byte[] GetFileBytes(string name) {
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  }
51 
55  public static bool FileExists(string name) {
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  }
65 
70  public static Texture2D GetTexture(string name) {
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  }
85 
89  public static bool TextureExists(string name) {
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  }
102 
109  internal static bool TryGetTexture(string name, out Texture2D texture) {
110  if (Main.dedServ) {
111  texture = null;
112  return false;
113  }
114 
115  string modName, subName;
116  SplitName(name, out modName, out subName);
117  if (modName == "Terraria") {
118  if (File.Exists(ImagePath + Path.DirectorySeparatorChar + subName + ".xnb")) {
119  texture = Main.instance.Content.Load<Texture2D>("Images" + Path.DirectorySeparatorChar + subName);
120  return true;
121  }
122  texture = null;
123  return false;
124  }
125 
126  Mod mod = ModLoader.GetMod(modName);
127  if (mod == null) {
128  texture = null;
129  return false;
130  }
131 
132  return mod.textures.TryGetValue(subName, out texture);
133  }
134 
139  public static SoundEffect GetSound(string name) {
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  }
152 
156  public static bool SoundExists(string name) {
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  }
166 
171  public static Music GetMusic(string name) {
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  }
179 
183  public static bool MusicExists(string name) {
184  if (!name.Contains('/')) { return false; }
185  string modName, subName;
186  SplitName(name, out modName, out subName);
187  Mod mod = ModLoader.GetMod(modName);
188  return mod != null && mod.MusicExists(subName);
189  }
190 
196  public static ModNPC GetModNPC(int type) => NPCLoader.GetNPC(type);
197 
203  public static int GetModBossHeadSlot(string texture) => NPCHeadLoader.GetBossHeadSlot(texture);
204 
210  public static int GetModHeadSlot(string texture) => NPCHeadLoader.GetHeadSlot(texture);
211 
215  public static ModItem GetModItem(int type) => ItemLoader.GetItem(type);
216 
220  public static ModDust GetModDust(int type) => ModDust.GetDust(type);
221 
227  public static ModProjectile GetModProjectile(int type) => ProjectileLoader.GetProjectile(type);
228 
232  public static ModBuff GetModBuff(int type) => BuffLoader.GetBuff(type);
233 
240  public static EquipTexture GetEquipTexture(EquipType type, int slot) => EquipLoader.GetEquipTexture(type, slot);
241 
247  public static ModMountData GetModMountData(int type) => MountLoader.GetMount(type);
248 
254  public static ModTile GetModTile(int type) => TileLoader.GetTile(type);
255 
259  public static ModWall GetModWall(int type) => WallLoader.GetWall(type);
260 
264  public static ModWaterStyle GetModWaterStyle(int style) => WaterStyleLoader.GetWaterStyle(style);
265 
269  public static ModWaterfallStyle GetModWaterfallStyle(int style) => WaterfallStyleLoader.GetWaterfallStyle(style);
270 
274  public static int GetModBackgroundSlot(string texture) => BackgroundTextureLoader.GetBackgroundSlot(texture);
275 
279  public static ModSurfaceBgStyle GetModSurfaceBgStyle(int style) => SurfaceBgStyleLoader.GetSurfaceBgStyle(style);
280 
284  public static ModUgBgStyle GetModUgBgStyle(int style) => UgBgStyleLoader.GetUgBgStyle(style);
285 
286  private static LocalizedText SetLocalizedText(Dictionary<string, LocalizedText> dict, LocalizedText value) {
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  }
295 
296  internal static ModHotKey RegisterHotKey(Mod mod, string name, string defaultKey) {
297  string key = mod.Name + ": " + name;
298  modHotKeys[key] = new ModHotKey(mod, name, defaultKey);
299  return modHotKeys[key];
300  }
301 
302  internal static void Load() {
303  CacheVanillaState();
304 
305  Interface.loadMods.SetLoadStage("tModLoader.MSIntializing", ModLoader.Mods.Length);
306  LoadModContent(mod => {
307  mod.loading = true;
308  mod.AutoloadConfig();
309  mod.LoadResources();
310  mod.Autoload();
311  mod.Load();
312  mod.loading = false;
313  });
314 
315  Interface.loadMods.SetLoadStage("tModLoader.MSSettingUp");
316  ResizeArrays();
317  RecipeGroupHelper.FixRecipeGroupLookups();
318 
319  Interface.loadMods.SetLoadStage("tModLoader.MSLoading", ModLoader.Mods.Length);
320  LoadModContent(mod => {
321  mod.SetupContent();
322  mod.PostSetupContent();
323  });
324 
325  MemoryTracking.Finish();
326 
327  if (Main.dedServ)
328  ModNet.AssignNetIDs();
329 
330  Main.player[255] = new Player(false); // setup inventory is unnecessary
331 
332  RefreshModLanguage(Language.ActiveCulture);
333  MapLoader.SetupModMap();
334  ItemSorting.SetupWhiteLists();
335  PlayerInput.reinitialize = true;
336  SetupRecipes();
337  }
338 
339  private static void CacheVanillaState() {
340  EffectsTracker.CacheVanillaState();
341  }
342 
343  internal static Mod LoadingMod { get; private set; }
344  private static void LoadModContent(Action<Mod> loadAction) {
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  }
363 
364  private static void SetupRecipes() {
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  }
373 
374  internal static void UnloadModContent() {
375  foreach (var mod in ModLoader.Mods.Reverse()) {
376  try {
377  mod.Close();
378  mod.UnloadContent();
379  }
380  catch (Exception e) {
381  e.Data["mod"] = mod.Name;
382  throw;
383  }
384  finally {
385  MonoModHooks.RemoveAll(mod);
386  }
387  }
388  }
389 
390  internal static void Unload() {
391  ItemLoader.Unload();
392  EquipLoader.Unload();
393  ModPrefix.Unload();
394  ModDust.Unload();
395  TileLoader.Unload();
396  ModTileEntity.Unload();
397  WallLoader.Unload();
398  ProjectileLoader.Unload();
399  NPCLoader.Unload();
400  NPCHeadLoader.Unload();
401  PlayerHooks.Unload();
402  BuffLoader.Unload();
403  MountLoader.Unload();
404  ModGore.Unload();
405  SoundLoader.Unload();
406  DisposeMusic();
407  BackgroundTextureLoader.Unload();
408  UgBgStyleLoader.Unload();
409  SurfaceBgStyleLoader.Unload();
410  GlobalBgStyleLoader.Unload();
411  WaterStyleLoader.Unload();
412  WaterfallStyleLoader.Unload();
413  WorldHooks.Unload();
414  ResizeArrays(true);
415  for (int k = 0; k < Recipe.maxRecipes; k++) {
416  Main.recipe[k] = new Recipe();
417  }
418  Recipe.numRecipes = 0;
419  RecipeGroupHelper.ResetRecipeGroups();
420  Recipe.SetupRecipes();
421  MapLoader.UnloadModMap();
422  ItemSorting.SetupWhiteLists();
423  modHotKeys.Clear();
424  RecipeHooks.Unload();
425  CommandManager.Unload();
426  TagSerializer.Reload();
427  ModNet.Unload();
428  Config.ConfigManager.Unload();
429  CustomCurrencyManager.Initialize();
430  EffectsTracker.RemoveModEffects();
431 
432  CleanupModReferences();
433  }
434 
435  private static void ResizeArrays(bool unloading = false) {
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  }
462 
463  public static void RefreshModLanguage(GameCulture culture) {
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  }
516 
517  private static void DisposeMusic() {
518  foreach (var music in Main.music.OfType<MusicStreaming>())
519  music.Dispose();
520  }
521 
526  internal static void CleanupModReferences() {
527  // Clear references to ModPlayer instances
528  for (int i = 0; i < 256; i++) {
529  Main.player[i] = new Player();
530  }
531 
532  Main.clientPlayer = new Player(false);
533  Main.ActivePlayerFileData = new Terraria.IO.PlayerFileData();
534  Main._characterSelectMenu._playerList?.Clear();
535  Main.PlayerList.Clear();
536 
537  foreach (var npc in Main.npc) {
538  npc.SetDefaults(0);
539  }
540 
541  foreach (var item in Main.item) {
542  item.SetDefaults(0);
543  }
544  ItemSlot.singleSlotArray[0]?.SetDefaults(0);
545 
546  for (int i = 0; i < Main.chest.Length; i++) {
547  Main.chest[i] = new Chest();
548  }
549  }
550 
551  public static Stream OpenRead(string assetName, bool newFileStream = false) {
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  }
558  }
559 }
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:41
static ModWaterfallStyle GetWaterfallStyle(int style)
Returns the ModWaterfallStyle with the given ID.
virtual void LoadResources()
Definition: Mod.cs:103
Represents a loaded hotkey. It is suggested to access the hotkey status only in ModPlayer.ProcessTriggers.
Definition: ModHotkey.cs:11
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
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:339
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:171
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:70
This serves as the central class from which ModUgBgStyle functions are supported and carried out...
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:286
virtual void PostSetupContent()
Allows you to load things in your mod after its content has been setup (arrays have been resized to f...
Definition: Mod.cs:76
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:24
Music GetMusic(string name)
Shorthand for calling ModContent.GetMusic(this.FileName(name)).
Definition: Mod.cs:1569
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
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:22
static bool TextureExists(string name)
Returns whether or not a texture with the specified name exists.
Definition: ModContent.cs:89
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:551
static ModSurfaceBgStyle GetSurfaceBgStyle(int style)
Returns the ModSurfaceBgStyle object with the given ID.
virtual void Load()
Override this method to add most of your content to your mod. Here you will call other methods such a...
Definition: Mod.cs:70
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)).
static bool MusicExists(string name)
Returns whether or not a sound with the specified name exists.
Definition: ModContent.cs:183
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:1549
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 void LoadModContent(Action< Mod > loadAction)
Definition: ModContent.cs:344
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:139
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:75
virtual string Name
Stores the name of the mod. This name serves as the mod&#39;s identification, and also helps with saving ...
Definition: Mod.cs:41
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:28
This serves as the central class from which buff-related functions are supported and carried out...
Definition: BuffLoader.cs:13
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:463
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:23
static void ResizeArrays(bool unloading=false)
Definition: ModContent.cs:435
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:80
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:156
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:55