1using Microsoft.Xna.Framework.Audio;
 
    2using Microsoft.Xna.Framework.Graphics;
 
    6using ReLogic.Utilities;
 
    8using System.Collections.Generic;
 
   11using System.Threading.Tasks;
 
   12using Terraria.GameContent.Liquid;
 
   14using Terraria.Localization;
 
   18using Terraria.ModLoader.UI;
 
   19using Terraria.Utilities;
 
   25        internal bool loading;
 
   27        internal readonly IDictionary<string, Texture2D> textures = 
new Dictionary<string, Texture2D>();
 
   28        internal readonly IDictionary<string, SoundEffect> sounds = 
new Dictionary<string, SoundEffect>();
 
   29        internal readonly IDictionary<string, Music> musics = 
new Dictionary<string, Music>();
 
   30        internal readonly IDictionary<string, DynamicSpriteFont> fonts = 
new Dictionary<string, DynamicSpriteFont>();
 
   31        internal readonly IDictionary<string, Effect> effects = 
new Dictionary<string, Effect>();
 
   32        internal readonly IList<ModRecipe> recipes = 
new List<ModRecipe>();
 
   33        internal readonly IDictionary<string, ModItem> items = 
new Dictionary<string, ModItem>();
 
   34        internal readonly IDictionary<string, GlobalItem> globalItems = 
new Dictionary<string, GlobalItem>();
 
   35        internal readonly IDictionary<Tuple<string, EquipType>, 
EquipTexture> equipTextures = 
new Dictionary<Tuple<string, EquipType>, 
EquipTexture>();
 
   36        internal readonly IDictionary<string, ModPrefix> prefixes = 
new Dictionary<string, ModPrefix>();
 
   37        internal readonly IDictionary<string, ModDust> dusts = 
new Dictionary<string, ModDust>();
 
   38        internal readonly IDictionary<string, ModTile> tiles = 
new Dictionary<string, ModTile>();
 
   39        internal readonly IDictionary<string, GlobalTile> globalTiles = 
new Dictionary<string, GlobalTile>();
 
   40        internal readonly IDictionary<string, ModTileEntity> tileEntities = 
new Dictionary<string, ModTileEntity>();
 
   41        internal readonly IDictionary<string, ModWall> walls = 
new Dictionary<string, ModWall>();
 
   42        internal readonly IDictionary<string, GlobalWall> globalWalls = 
new Dictionary<string, GlobalWall>();
 
   43        internal readonly IDictionary<string, ModProjectile> projectiles = 
new Dictionary<string, ModProjectile>();
 
   44        internal readonly IDictionary<string, GlobalProjectile> globalProjectiles = 
new Dictionary<string, GlobalProjectile>();
 
   45        internal readonly IDictionary<string, ModNPC> npcs = 
new Dictionary<string, ModNPC>();
 
   46        internal readonly IDictionary<string, GlobalNPC> globalNPCs = 
new Dictionary<string, GlobalNPC>();
 
   47        internal readonly IDictionary<string, ModPlayer> players = 
new Dictionary<string, ModPlayer>();
 
   48        internal readonly IDictionary<string, ModMountData> mountDatas = 
new Dictionary<string, ModMountData>();
 
   49        internal readonly IDictionary<string, ModBuff> buffs = 
new Dictionary<string, ModBuff>();
 
   50        internal readonly IDictionary<string, GlobalBuff> globalBuffs = 
new Dictionary<string, GlobalBuff>();
 
   51        internal readonly IDictionary<string, ModWorld> worlds = 
new Dictionary<string, ModWorld>();
 
   52        internal readonly IDictionary<string, ModUgBgStyle> ugBgStyles = 
new Dictionary<string, ModUgBgStyle>();
 
   53        internal readonly IDictionary<string, ModSurfaceBgStyle> surfaceBgStyles = 
new Dictionary<string, ModSurfaceBgStyle>();
 
   54        internal readonly IDictionary<string, GlobalBgStyle> globalBgStyles = 
new Dictionary<string, GlobalBgStyle>();
 
   55        internal readonly IDictionary<string, ModWaterStyle> waterStyles = 
new Dictionary<string, ModWaterStyle>();
 
   56        internal readonly IDictionary<string, ModWaterfallStyle> waterfallStyles = 
new Dictionary<string, ModWaterfallStyle>();
 
   57        internal readonly IDictionary<string, GlobalRecipe> globalRecipes = 
new Dictionary<string, GlobalRecipe>();
 
   58        internal readonly IDictionary<string, ModTranslation> translations = 
new Dictionary<string, ModTranslation>();
 
   60        private void LoadTexture(
string path, Stream stream, 
bool rawimg) {
 
   67                    if (t.Exception != null)
 
   68                        throw new ResourceLoadException(
 
   69                            Language.GetTextValue(
"tModLoader.LoadErrorTextureFailedToLoad", path), t.Exception);
 
   72                    tex.Name = Name + 
"/" + path;
 
   78                throw new ResourceLoadException(Language.GetTextValue(
"tModLoader.LoadErrorTextureFailedToLoad", path), e);
 
   85        private SoundEffect 
LoadSound(Stream stream, 
int length, 
string extension) {
 
   89                        stream = 
new MemoryStream(stream.ReadBytes(length));
 
   90                    return SoundEffect.FromStream(stream);
 
   92                    using (var mp3Stream = 
new MP3Stream(stream))
 
   93                    using (var ms = 
new MemoryStream()) {
 
   95                        return new SoundEffect(ms.ToArray(), mp3Stream.Frequency, (AudioChannels)mp3Stream.ChannelCount);
 
   98                    using (var reader = 
new VorbisReader(stream, 
true)) {
 
   99                        var buffer = 
new byte[reader.TotalSamples * 2 * reader.Channels];
 
  100                        var floatBuf = 
new float[buffer.Length / 2];
 
  101                        reader.ReadSamples(floatBuf, 0, floatBuf.Length);
 
  103                        return new SoundEffect(buffer, reader.SampleRate, (AudioChannels)reader.Channels);
 
  110            path = 
"tmod:"+
Name+
'/'+path+extension;
 
  119        internal void SetupContent() {
 
  120            foreach (
ModItem item 
in items.Values) {
 
  125            foreach (
ModPrefix prefix 
in prefixes.Values) {
 
  129            foreach (
ModDust dust 
in dusts.Values) {
 
  132            foreach (
ModTile tile 
in tiles.Values) {
 
  135                if (TileID.Sets.HasOutlines[tile.
Type]) {
 
  138                if (!
string.IsNullOrEmpty(tile.
chest)) {
 
  139                    TileID.Sets.BasicChest[tile.
Type] = 
true;
 
  142            foreach (
GlobalTile globalTile 
in globalTiles.Values) {
 
  145            foreach (
ModWall wall 
in walls.Values) {
 
  149            foreach (
GlobalWall globalWall 
in globalWalls.Values) {
 
  157            foreach (
ModNPC npc 
in npcs.Values) {
 
  162            foreach (
ModMountData modMountData 
in mountDatas.Values) {
 
  164                mountData.modMountData = modMountData;
 
  166                Mount.mounts[modMountData.
Type] = mountData;
 
  168            foreach (
ModBuff buff 
in buffs.Values) {
 
  177                Main.instance.waterfallManager.waterfallTexture[waterfallStyle.
Type]
 
  182        internal void UnloadContent() {
 
  187            equipTextures.Clear();
 
  192            tileEntities.Clear();
 
  197            globalProjectiles.Clear();
 
  205            surfaceBgStyles.Clear();
 
  206            globalBgStyles.Clear();
 
  208            waterfallStyles.Clear();
 
  209            globalRecipes.Clear();
 
  210            translations.Clear();
 
  230            foreach (var tex 
in textures.Values)
 
  237        internal void Autoload() {
 
  241            Interface.loadMods.SubProgressText = Language.GetTextValue(
"tModLoader.MSFinishingResourceLoading");
 
  246            IList<Type> modGores = 
new List<Type>();
 
  247            IList<Type> modSounds = 
new List<Type>();
 
  248            foreach (Type type 
in Code.GetTypes().OrderBy(type => type.FullName, StringComparer.InvariantCulture)) {
 
  249                if (type.IsAbstract || type.GetConstructor(
new Type[0]) == 
null)
 
  253                if (type.IsSubclassOf(typeof(
ModItem))) {
 
  256                else if (type.IsSubclassOf(typeof(
GlobalItem))) {
 
  259                else if (type.IsSubclassOf(typeof(
ModPrefix))) {
 
  262                else if (type.IsSubclassOf(typeof(
ModDust))) {
 
  265                else if (type.IsSubclassOf(typeof(
ModTile))) {
 
  268                else if (type.IsSubclassOf(typeof(
GlobalTile))) {
 
  274                else if (type.IsSubclassOf(typeof(
ModWall))) {
 
  277                else if (type.IsSubclassOf(typeof(
GlobalWall))) {
 
  286                else if (type.IsSubclassOf(typeof(
ModNPC))) {
 
  289                else if (type.IsSubclassOf(typeof(
GlobalNPC))) {
 
  292                else if (type.IsSubclassOf(typeof(
ModPlayer))) {
 
  295                else if (type.IsSubclassOf(typeof(
ModBuff))) {
 
  298                else if (type.IsSubclassOf(typeof(
GlobalBuff))) {
 
  304                else if (type.IsSubclassOf(typeof(
ModGore))) {
 
  307                else if (type.IsSubclassOf(typeof(
ModSound))) {
 
  310                else if (type.IsSubclassOf(typeof(
ModWorld))) {
 
  331                else if (type.IsSubclassOf(typeof(
ModCommand))) {
 
  349            string name = type.
Name;
 
  353                if (autoloadEquip != 
null)
 
  354                    foreach (var equip 
in autoloadEquip.equipTypes)
 
  362            globalItem.mod = 
this;
 
  363            string name = type.
Name;
 
  364            if (globalItem.
Autoload(ref name)) {
 
  372            string name = type.
Name;
 
  381            string name = type.
Name;
 
  382            string texture = (type.Namespace + 
"." + type.Name).Replace(
'.', 
'/');
 
  383            if (dust.
Autoload(ref name, ref texture)) {
 
  391            string name = type.
Name;
 
  392            string texture = (type.Namespace + 
"." + type.Name).Replace(
'.', 
'/');
 
  393            if (tile.
Autoload(ref name, ref texture)) {
 
  400            globalTile.mod = 
this;
 
  401            string name = type.
Name;
 
  402            if (globalTile.
Autoload(ref name)) {
 
  409            tileEntity.mod = 
this;
 
  410            string name = type.
Name;
 
  411            if (tileEntity.
Autoload(ref name)) {
 
  419            string name = type.
Name;
 
  420            string texture = (type.Namespace + 
"." + type.Name).Replace(
'.', 
'/');
 
  421            if (wall.
Autoload(ref name, ref texture)) {
 
  428            globalWall.mod = 
this;
 
  429            string name = type.
Name;
 
  430            if (globalWall.
Autoload(ref name)) {
 
  437            projectile.mod = 
this;
 
  438            string name = type.
Name;
 
  439            if (projectile.
Autoload(ref name)) {
 
  446            globalProjectile.mod = 
this;
 
  447            string name = type.
Name;
 
  448            if (globalProjectile.
Autoload(ref name)) {
 
  456            string name = type.
Name;
 
  460                if (autoloadHead != 
null) {
 
  465                if (autoloadBossHead != 
null) {
 
  474            globalNPC.mod = 
this;
 
  475            string name = type.
Name;
 
  484            string name = type.
Name;
 
  493            string name = type.
Name;
 
  494            string texture = (type.Namespace + 
"." + type.Name).Replace(
'.', 
'/');
 
  495            if (buff.
Autoload(ref name, ref texture)) {
 
  502            globalBuff.mod = 
this;
 
  503            string name = type.
Name;
 
  504            if (globalBuff.
Autoload(ref name)) {
 
  512            string name = type.
Name;
 
  513            string texture = (type.Namespace + 
"." + type.Name).Replace(
'.', 
'/');
 
  514            var extraTextures = 
new Dictionary<MountTextureType, string>();
 
  516                extraTextures[textureType] = texture + 
"_" + textureType.ToString();
 
  518            if (mount.Autoload(ref name, ref texture, extraTextures)) {
 
  519                AddMount(name, mount, texture, extraTextures);
 
  526            string name = type.
Name;
 
  533            foreach (
string texture 
in textures.Keys.Where(t => t.StartsWith(
"Backgrounds/"))) {
 
  540            ugBgStyle.mod = 
this;
 
  541            string name = type.
Name;
 
  549            surfaceBgStyle.mod = 
this;
 
  550            string name = type.
Name;
 
  551            if (surfaceBgStyle.
Autoload(ref name)) {
 
  558            globalBgStyle.mod = 
this;
 
  559            string name = type.
Name;
 
  560            if (globalBgStyle.
Autoload(ref name)) {
 
  567            waterStyle.mod = 
this;
 
  568            string name = type.
Name;
 
  569            string texture = (type.Namespace + 
"." + type.Name).Replace(
'.', 
'/');
 
  570            string blockTexture = texture + 
"_Block";
 
  571            if (waterStyle.
Autoload(ref name, ref texture, ref blockTexture)) {
 
  578            waterfallStyle.mod = 
this;
 
  579            string name = type.
Name;
 
  580            string texture = (type.Namespace + 
"." + type.Name).Replace(
'.', 
'/');
 
  581            if (waterfallStyle.
Autoload(ref name, ref texture)) {
 
  587            var modGoreNames = modGores.ToDictionary(t => t.Namespace + 
"." + t.Name);
 
  588            foreach (var texture 
in textures.Keys.Where(t => t.StartsWith(
"Gores/"))) {
 
  591                if (modGoreNames.TryGetValue(
Name + 
"." + texture.Replace(
'/', 
'.'), out t))
 
  592                    modGore = (
ModGore)Activator.CreateInstance(t);
 
  599            var modSoundNames = modSounds.ToDictionary(t => t.Namespace + 
"." + t.Name);
 
  600            foreach (var sound 
in sounds.Keys.Where(t => t.StartsWith(
"Sounds/"))) {
 
  601                string substring = sound.Substring(
"Sounds/".Length);
 
  603                if (substring.StartsWith(
"Item/")) {
 
  606                else if (substring.StartsWith(
"NPCHit/")) {
 
  609                else if (substring.StartsWith(
"NPCKilled/")) {
 
  614                if (modSoundNames.TryGetValue((
Name + 
'/' + sound).Replace(
'/', 
'.'), out t))
 
  615                    modSound = (
ModSound)Activator.CreateInstance(t);
 
  619            foreach (var music 
in musics.Keys.Where(t => t.StartsWith(
"Sounds/"))) {
 
  620                string substring = music.Substring(
"Sounds/".Length);
 
  621                if (substring.StartsWith(
"Music/")) {
 
  629            globalRecipe.mod = 
this;
 
  630            string name = type.
Name;
 
  631            if (globalRecipe.
Autoload(ref name)) {
 
  637            var mc = (
ModCommand)Activator.CreateInstance(type);
 
  639            var name = type.Name;
 
  640            if (mc.Autoload(ref name))
 
  648            var modTranslationDictionary = 
new Dictionary<string, ModTranslation>();
 
  649            foreach (var translationFile 
in File.Where(entry => Path.GetExtension(entry.Name) == 
".lang")) {
 
  651                string translationFileContents = System.Text.Encoding.UTF8.GetString(File.GetBytes(translationFile));
 
  652                GameCulture culture = GameCulture.FromName(Path.GetFileNameWithoutExtension(translationFile.Name));
 
  654                using (StringReader reader = 
new StringReader(translationFileContents)) {
 
  656                    while ((line = reader.ReadLine()) != 
null) {
 
  657                        int split = line.IndexOf(
'=');
 
  660                        string key = line.Substring(0, split).Trim().Replace(
" ", 
"_");
 
  661                        string value = line.Substring(split + 1); 
 
  662                        if (value.Length == 0) {
 
  665                        value = value.Replace(
"\\n", 
"\n");
 
  668                        if (!modTranslationDictionary.TryGetValue(key, out 
ModTranslation mt))
 
  675            foreach (var value 
in modTranslationDictionary.Values) {
 
static void Convert(float[] floatBuf, byte[] buffer)
 
This serves as a place for you to program behaviors of equipment textures. This is useful for equipme...
 
This class serves to collect functions that operate on any kind of background style,...
 
string Name
The internal name of this global background style.
 
virtual bool Autoload(ref string name)
Allows you to automatically add a GlobalBgStyle instead of using Mod.AddGlobalBgStyle....
 
This class allows you to modify the behavior of any buff in the game.
 
virtual bool Autoload(ref string name)
Allows you to automatically load a GlobalBuff instead of using Mod.AddGlobalBuff. Return true to allo...
 
string Name
The internal name of this GlobalBuff instance.
 
This class allows you to modify and use hooks for all items, including vanilla items....
 
string Name
The name of this GlobalItem instance.
 
virtual bool Autoload(ref string name)
Allows you to automatically load a GlobalItem instead of using Mod.AddGlobalItem. Return true to allo...
 
This class allows you to modify and use hooks for all NPCs, including vanilla mobs....
 
virtual bool Autoload(ref string name)
Allows you to automatically load a GlobalNPC instead of using Mod.AddGlobalNPC. Return true to allow ...
 
string Name
The name of this GlobalNPC instance.
 
This class allows you to modify and use hooks for all projectiles, including vanilla projectiles....
 
virtual bool Autoload(ref string name)
Allows you to automatically load a GlobalProjectile instead of using Mod.AddGlobalProjectile....
 
string Name
The name of this GlobalProjectile instance.
 
This class provides hooks that control all recipes in the game.
 
virtual bool Autoload(ref string name)
Allows you to automatically load a GlobalRecipe instead of using Mod.AddGlobalRecipe....
 
string Name
The name of this GlobaRecipe.
 
This class allows you to modify the behavior of any tile in the game. Create an instance of an overri...
 
virtual bool Autoload(ref string name)
Allows you to automatically load a GlobalTile instead of using Mod.AddGlobalTile. Return true to allo...
 
virtual void SetDefaults()
Allows you to modify the properties of any tile in the game. Most properties are stored as arrays thr...
 
string Name
The name of this GlobalTile instance.
 
This class allows you to modify the behavior of any wall in the game (although admittedly walls don't...
 
string Name
The name of this GlobalWall instance.
 
virtual void SetDefaults()
Allows you to modify the properties of any wall in the game. Most properties are stored as arrays thr...
 
virtual bool Autoload(ref string name)
Allows you to automatically load a GlobalWall instead of using Mod.AddGlobalWall. Return true to allo...
 
static Task< Texture2D > RawToTexture2DAsync(GraphicsDevice graphicsDevice, BinaryReader r)
 
static Task< Texture2D > PngToTexture2DAsync(GraphicsDevice graphicsDevice, Stream stream)
 
This serves as the central class from which item-related functions are carried out....
 
This class serves as a place for you to define a new buff and how that buff behaves.
 
virtual bool Autoload(ref string name, ref string texture)
Allows you to automatically load a buff instead of using Mod.AddBuff. Return true to allow autoloadin...
 
int Type
The buff id of this buff.
 
string Name
The internal name of this type of buff.
 
virtual void SetDefaults()
This is where all buff related assignments go. For example: Main.buffName[Type] = "Display Name"; Mai...
 
This class represents a chat or console command. Use the CommandType to specify the scope of the comm...
 
Manages content added by mods. Liasons between mod content and Terraria's arrays and oversees the Loa...
 
static Texture2D GetTexture(string name)
Gets the texture with the specified name. The name is in the format of "ModFolder/OtherFolders/FileNa...
 
This class represents a type of dust that is added by a mod. Only one instance of this class will eve...
 
string Name
The internal name of this type of dust.
 
virtual bool Autoload(ref string name, ref string texture)
Allows you to automatically add a type of dust without having to use Mod.AddDust. By default returns ...
 
virtual void SetDefaults()
Allows you to set this ModDust's updateType field and modify the Terraria.GameContent....
 
This class allows you to customize the behavior of a custom gore. Create a new instance of this and p...
 
Mod is an abstract class that you will override. It serves as a central place from which the mod's co...
 
void AddGlobalTile(string name, GlobalTile globalTile)
Adds the given GlobalTile instance to this mod with the provided name.
 
void AddGlobalItem(string name, GlobalItem globalItem)
Adds the given GlobalItem instance to this mod with the provided name.
 
void AutoloadPlayer(Type type)
 
void AddGore(string texture, ModGore modGore=null)
Adds the given texture to the game as a custom gore, with the given custom gore behavior....
 
readonly Queue< Task > AsyncLoadQueue
 
void AddGlobalBgStyle(string name, GlobalBgStyle globalBgStyle)
Adds the given global background style with the given name to this mod.
 
void AutoloadGlobalNPC(Type type)
 
void AddNPCHeadTexture(int npcType, string texture)
Assigns a head texture to the given town NPC type.
 
void AddPlayer(string name, ModPlayer player)
Adds a type of ModPlayer to this mod. All ModPlayer types will be newly created and attached to each ...
 
void AutoloadGlobalRecipe(Type type)
 
void AutoloadProjectile(Type type)
 
void AutoloadBuff(Type type)
 
void AddGlobalWall(string name, GlobalWall globalWall)
Adds the given GlobalWall instance to this mod with the provided name.
 
void AddDust(string name, ModDust dust, string texture="")
Adds a type of dust to your mod with the specified name. Create an instance of ModDust normally,...
 
void AutoloadDust(Type type)
 
void AddNPC(string name, ModNPC npc)
Adds a type of NPC to the game with the specified name and texture. Also allows you to give the NPC a...
 
void AddWaterfallStyle(string name, ModWaterfallStyle waterfallStyle, string texture)
Adds the given waterfall style to the game with the given name and texture path.
 
void AddBossHeadTexture(string texture, int npcType=-1)
Assigns a head texture that can be used by NPCs on the map.
 
void AutoloadGlobalBuff(Type type)
 
void AutoloadPrefix(Type type)
 
void AutoloadWall(Type type)
 
int AddEquipTexture(ModItem item, EquipType type, string name, string texture, string armTexture="", string femaleTexture="")
Adds an equipment texture of the specified type, internal name, and associated item to your mod....
 
void AutoloadGlobalTile(Type type)
 
void AddBuff(string name, ModBuff buff, string texture)
Adds a type of buff to the game with the specified internal name and texture.
 
void AddPrefix(string name, ModPrefix prefix)
Adds a prefix to your mod with the specified internal name. This method should be called in Load....
 
void AddCommand(string name, ModCommand mc)
Manually add a Command during Load
 
void AutoloadSurfaceBgStyle(Type type)
 
ModTranslation CreateTranslation(string key)
Creates a ModTranslation object that you can use in AddTranslation.
 
void AddSound(SoundType type, string soundPath, ModSound modSound=null)
Adds the given sound file to the game as the given type of sound and with the given custom sound play...
 
void AddBackgroundTexture(string texture)
Adds a texture to the list of background textures and assigns it a background texture slot.
 
void AddTranslation(ModTranslation translation)
Adds a ModTranslation to the game so that you can use Language.GetText to get a LocalizedText.
 
void LoadTexture(string path, Stream stream, bool rawimg)
 
void AutoloadGlobalItem(Type type)
 
void AddTile(string name, ModTile tile, string texture)
Adds a type of tile to the game with the specified name and texture.
 
void AddGlobalNPC(string name, GlobalNPC globalNPC)
Adds the given GlobalNPC instance to this mod with the provided name.
 
virtual string Name
Stores the name of the mod. This name serves as the mod's identification, and also helps with saving ...
 
void AddGlobalBuff(string name, GlobalBuff globalBuff)
Adds the given GlobalBuff instance to this mod using the provided name.
 
void AutoloadLocalization()
Loads .lang files
 
void AddWall(string name, ModWall wall, string texture)
Adds a type of wall to the game with the specified name and texture.
 
void AddUgBgStyle(string name, ModUgBgStyle ugBgStyle)
Adds the given underground background style with the given name to this mod.
 
void AddMount(string name, ModMountData mount, string texture, IDictionary< MountTextureType, string > extraTextures=null)
Adds the given mount to the game with the given name and texture. The extraTextures dictionary should...
 
void AddProjectile(string name, ModProjectile projectile)
Adds a type of projectile to the game with the specified name.
 
void AutoloadCommand(Type type)
 
void AddModWorld(string name, ModWorld modWorld)
Adds a ModWorld to this mod with the given name.
 
void AutoloadGlobalBgStyle(Type type)
 
Music LoadMusic(string path, string extension)
 
void AutoloadUgBgStyle(Type type)
 
void AutoloadItem(Type type)
 
void AddTileEntity(string name, ModTileEntity entity)
Manually add a tile entity during Load.
 
void AutoloadGores(IList< Type > modGores)
 
SoundEffect LoadSound(Stream stream, int length, string extension)
 
void AddGlobalProjectile(string name, GlobalProjectile globalProjectile)
Adds the given GlobalProjectile instance to this mod with the provided name.
 
void AddGlobalRecipe(string name, GlobalRecipe globalRecipe)
Manually add a Global Recipe during Load
 
void AutoloadBackgrounds()
 
void AddWaterStyle(string name, ModWaterStyle waterStyle, string texture, string blockTexture)
Adds the given water style to the game with the given name, texture path, and block texture path.
 
void AutoloadGlobalWall(Type type)
 
void AutoloadNPC(Type type)
 
void AddItem(string name, ModItem item)
Adds a type of item to your mod with the specified internal name. This method should be called in Loa...
 
void AutoloadWaterStyle(Type type)
 
void AutoloadSounds(IList< Type > modSounds)
 
void AutoloadModWorld(Type type)
 
void AutoloadGlobalProjectile(Type type)
 
void AutoloadMountData(Type type)
 
void AutoloadWaterfallStyle(Type type)
 
Assembly Code
The assembly code this is loaded when tModLoader loads this mod.
 
void AddSurfaceBgStyle(string name, ModSurfaceBgStyle surfaceBgStyle)
Adds the given surface background style with the given name to this mod.
 
void AutoloadTileEntity(Type type)
 
void AutoloadTile(Type type)
 
virtual void Unload()
This is called whenever this mod is unloaded from the game. Use it to undo changes that you've made i...
 
This class serves as a place for you to place all your properties and hooks for each item....
 
string Name
The internal name of this ModItem.
 
virtual string Texture
The file name of this item's texture file in the mod loader's file space.
 
virtual void SetStaticDefaults()
This is where you set all your item's static properties, such as names/translations and the arrays in...
 
virtual void AutoStaticDefaults()
Automatically sets certain static defaults. Override this if you do not want the properties to be set...
 
virtual bool Autoload(ref string name)
Allows you to automatically load an item instead of using Mod.AddItem. Return true to allow autoloadi...
 
Item item
The item object that this ModItem controls.
 
This class serves as a place for you to place all your properties and hooks for each mount....
 
int Type
The index of this ModMountData in the Mount.mounts array.
 
string Name
The name of this type of mount.
 
Mount.MountData mountData
The vanilla MountData object that is controlled by this ModMountData.
 
This class serves as a place for you to place all your properties and hooks for each NPC....
 
NPC npc
The NPC object that this ModNPC controls.
 
virtual string HeadTexture
The file name of this NPC's head texture file, to be used in autoloading.
 
virtual void AutoStaticDefaults()
Automatically sets certain static defaults. Override this if you do not want the properties to be set...
 
string Name
The internal name of this NPC.
 
virtual bool Autoload(ref string name)
Allows you to automatically load an NPC instead of using Mod.AddNPC. Return true to allow autoloading...
 
virtual string BossHeadTexture
This file name of this NPC's boss head texture file, to be used in autoloading.
 
virtual void SetStaticDefaults()
Allows you to set all your NPC's static properties, such as names/translations and the arrays in NPCI...
 
A ModPlayer instance represents an extension of a Player instance. You can store fields in the ModPla...
 
string Name
The name of this ModPlayer. Used for distinguishing between multiple ModPlayers added by a single Mod...
 
virtual bool Autoload(ref string name)
Allows you to automatically add a ModPlayer instead of using Mod.AddPlayer. Return true to allow auto...
 
virtual bool Autoload(ref string name)
 
virtual void AutoDefaults()
 
virtual void SetDefaults()
Allows you to set the prefix's name/translations and to set its category.
 
This class serves as a place for you to place all your properties and hooks for each projectile....
 
virtual bool Autoload(ref string name)
Allows you to automatically load a projectile instead of using Mod.AddProjectile. Return true to allo...
 
Projectile projectile
The projectile object that this ModProjectile controls.
 
virtual void SetStaticDefaults()
Allows you to set all your projectile's static properties, such as names/translations and the arrays ...
 
virtual void AutoStaticDefaults()
Automatically sets certain static defaults. Override this if you do not want the properties to be set...
 
string Name
The internal name of this ModProjectile.
 
This class allows you to customize how a sound you add is played. To use this, pass an instance to Mo...
 
Each background style determines in its own way how exactly the background is drawn....
 
virtual bool Autoload(ref string name)
Allows you to automatically add a ModSurfaceBgStyle instead of using Mod.AddSurfaceBgStyle....
 
string Name
The internal name of this surface background style.
 
Tile Entities are Entities tightly coupled with tiles, allowing the possibility of tiles to exhibit c...
 
string Name
The internal name of this ModTileEntity.
 
virtual bool Autoload(ref string name)
Allows you to automatically load a tile entity instead of using Mod.AddTileEntity....
 
This class represents a type of tile that can be added by a mod. Only one instance of this class will...
 
ushort Type
The internal ID of this type of tile.
 
virtual bool Autoload(ref string name, ref string texture)
Allows you to modify the name and texture path of this tile when it is autoloaded....
 
string Name
The name of this type of tile.
 
virtual string HighlightTexture
The highlight texture used when this tile is selected by smart interact. Defaults to adding "_Highlig...
 
string chest
The default name of this chest that is displayed when this 2x2 chest is open. Defaults to the empty s...
 
void AddTranslation(int culture, string value)
 
Each background style determines in its own way how exactly the background is drawn....
 
string Name
The internal name of this underground background style.
 
virtual bool Autoload(ref string name)
Allows you to automatically add a ModUgBgStyle instead of using Mod.AddUgBgStyle. Return true to allo...
 
This class represents a type of wall that can be added by a mod. Only one instance of this class will...
 
virtual void SetDefaults()
Allows you to set the properties of this wall. Many properties are stored as arrays throughout Terrar...
 
string Name
The name of this type of wall.
 
ushort Type
The internal ID of this type of wall.
 
virtual bool Autoload(ref string name, ref string texture)
Allows you to modify the name and texture path of this wall when it is autoloaded....
 
Represents a style of water that gets drawn, based on factors such as the background....
 
int Type
The ID of the water style.
 
virtual bool Autoload(ref string name, ref string texture, ref string blockTexture)
Allows you to automatically add a ModWaterStyle instead of using Mod.AddWaterStyle....
 
string Name
The internal name of this water style.
 
Represents a style of waterfalls that gets drawn. This is mostly used to determine the color of the w...
 
string Name
The internal name of this waterfall style.
 
int Type
The ID of this waterfall style.
 
virtual bool Autoload(ref string name, ref string texture)
Allows you to automatically add a ModWaterfallStyle instead of using Mod.AddWaterfallStyle....
 
A ModWorld instance represents an extension of a World. You can store fields in the ModWorld classes ...
 
string Name
The name of this ModWorld. Used for distinguishing between multiple ModWorlds added by a single Mod.
 
virtual bool Autoload(ref string name)
Allows you to automatically add a ModWorld instead of using Mod.AddModWorld. Return true to allow aut...
 
This serves as the central place from which mounts are stored and mount-related functions are carried...
 
This serves as the central class from which NPC-related functions are carried out....
 
This serves as the central class from which projectile-related functions are carried out....
 
This serves as the central class from which tile-related functions are supported and carried out.
 
MountTextureType
This is an enum of all possible types of extra mount textures for custom mounts. Use these as keys in...
 
SoundType
This is an enum of the types of sound you can add to the game. This is used for determining whether a...
 
bool AutoloadSounds
Whether or not this mod will automatically add sounds in the Sounds folder to the game....
 
bool AutoloadGores
Whether or not this mod will automatically add images in the Gores folder as gores to the game,...
 
bool AutoloadBackgrounds
Whether or not this mod will automatically add images in the Backgrounds folder as background texture...