1 using Microsoft.Xna.Framework.Audio;
2 using Microsoft.Xna.Framework.Graphics;
5 using ReLogic.Graphics;
6 using ReLogic.Utilities;
8 using System.Collections.Generic;
11 using System.Threading.Tasks;
25 internal bool loading;
26 private readonly Queue<Task> AsyncLoadQueue =
new Queue<Task>();
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) {
66 AsyncLoadQueue.Enqueue(texTask.ContinueWith(t => {
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");
242 while (AsyncLoadQueue.Count > 0)
243 AsyncLoadQueue.Dequeue().Wait();
245 AutoloadLocalization();
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))) {
257 AutoloadGlobalItem(type);
259 else if (type.IsSubclassOf(typeof(
ModPrefix))) {
260 AutoloadPrefix(type);
262 else if (type.IsSubclassOf(typeof(
ModDust))) {
265 else if (type.IsSubclassOf(typeof(
ModTile))) {
268 else if (type.IsSubclassOf(typeof(
GlobalTile))) {
269 AutoloadGlobalTile(type);
272 AutoloadTileEntity(type);
274 else if (type.IsSubclassOf(typeof(
ModWall))) {
277 else if (type.IsSubclassOf(typeof(
GlobalWall))) {
278 AutoloadGlobalWall(type);
281 AutoloadProjectile(type);
284 AutoloadGlobalProjectile(type);
286 else if (type.IsSubclassOf(typeof(
ModNPC))) {
289 else if (type.IsSubclassOf(typeof(
GlobalNPC))) {
290 AutoloadGlobalNPC(type);
292 else if (type.IsSubclassOf(typeof(
ModPlayer))) {
293 AutoloadPlayer(type);
295 else if (type.IsSubclassOf(typeof(
ModBuff))) {
298 else if (type.IsSubclassOf(typeof(
GlobalBuff))) {
299 AutoloadGlobalBuff(type);
302 AutoloadMountData(type);
304 else if (type.IsSubclassOf(typeof(
ModGore))) {
307 else if (type.IsSubclassOf(typeof(
ModSound))) {
310 else if (type.IsSubclassOf(typeof(
ModWorld))) {
311 AutoloadModWorld(type);
314 AutoloadUgBgStyle(type);
317 AutoloadSurfaceBgStyle(type);
320 AutoloadGlobalBgStyle(type);
323 AutoloadWaterStyle(type);
326 AutoloadWaterfallStyle(type);
329 AutoloadGlobalRecipe(type);
331 else if (type.IsSubclassOf(typeof(
ModCommand))) {
332 AutoloadCommand(type);
335 if (Properties.AutoloadGores) {
336 AutoloadGores(modGores);
338 if (Properties.AutoloadSounds) {
339 AutoloadSounds(modSounds);
341 if (Properties.AutoloadBackgrounds) {
342 AutoloadBackgrounds();
349 string name = type.
Name;
353 if (autoloadEquip != null)
354 foreach (var equip
in autoloadEquip.equipTypes)
355 AddEquipTexture(item, equip, item.
Name, item.
Texture +
'_' + equip,
362 globalItem.
mod =
this;
363 string name = type.
Name;
364 if (globalItem.
Autoload(ref name)) {
365 AddGlobalItem(name, globalItem);
372 string name = type.
Name;
374 AddPrefix(name, prefix);
381 string name = type.
Name;
382 string texture = (type.Namespace +
"." + type.Name).Replace(
'.',
'/');
383 if (dust.
Autoload(ref name, ref texture)) {
384 AddDust(name, dust, texture);
391 string name = type.
Name;
392 string texture = (type.Namespace +
"." + type.Name).Replace(
'.',
'/');
393 if (tile.
Autoload(ref name, ref texture)) {
394 AddTile(name, tile, texture);
400 globalTile.
mod =
this;
401 string name = type.
Name;
402 if (globalTile.
Autoload(ref name)) {
403 AddGlobalTile(name, globalTile);
409 tileEntity.
mod =
this;
410 string name = type.
Name;
411 if (tileEntity.
Autoload(ref name)) {
412 AddTileEntity(name, tileEntity);
419 string name = type.
Name;
420 string texture = (type.Namespace +
"." + type.Name).Replace(
'.',
'/');
421 if (wall.
Autoload(ref name, ref texture)) {
422 AddWall(name, wall, texture);
428 globalWall.
mod =
this;
429 string name = type.
Name;
430 if (globalWall.
Autoload(ref name)) {
431 AddGlobalWall(name, globalWall);
437 projectile.
mod =
this;
438 string name = type.
Name;
439 if (projectile.
Autoload(ref name)) {
440 AddProjectile(name, projectile);
446 globalProjectile.
mod =
this;
447 string name = type.
Name;
448 if (globalProjectile.
Autoload(ref name)) {
449 AddGlobalProjectile(name, globalProjectile);
456 string name = type.
Name;
460 if (autoloadHead != null) {
462 AddNPCHeadTexture(npc.
npc.type, headTexture);
465 if (autoloadBossHead != null) {
467 AddBossHeadTexture(headTexture, npc.
npc.type);
474 globalNPC.
mod =
this;
475 string name = type.
Name;
477 AddGlobalNPC(name, globalNPC);
484 string name = type.
Name;
486 AddPlayer(name, player);
493 string name = type.
Name;
494 string texture = (type.Namespace +
"." + type.Name).Replace(
'.',
'/');
495 if (buff.
Autoload(ref name, ref texture)) {
496 AddBuff(name, buff, texture);
502 globalBuff.
mod =
this;
503 string name = type.
Name;
504 if (globalBuff.
Autoload(ref name)) {
505 AddGlobalBuff(name, globalBuff);
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;
528 AddModWorld(name, modWorld);
533 foreach (
string texture
in textures.Keys.Where(t => t.StartsWith(
"Backgrounds/"))) {
534 AddBackgroundTexture(Name +
'/' + texture);
540 ugBgStyle.
mod =
this;
541 string name = type.
Name;
543 AddUgBgStyle(name, ugBgStyle);
549 surfaceBgStyle.
mod =
this;
550 string name = type.
Name;
551 if (surfaceBgStyle.
Autoload(ref name)) {
552 AddSurfaceBgStyle(name, surfaceBgStyle);
558 globalBgStyle.
mod =
this;
559 string name = type.
Name;
560 if (globalBgStyle.
Autoload(ref name)) {
561 AddGlobalBgStyle(name, globalBgStyle);
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)) {
572 AddWaterStyle(name, waterStyle, texture, 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)) {
582 AddWaterfallStyle(name, waterfallStyle, 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);
594 AddGore(Name +
'/' + texture, modGore);
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);
617 AddSound(soundType, Name +
'/' + sound, modSound);
619 foreach (var music
in musics.Keys.Where(t => t.StartsWith(
"Sounds/"))) {
620 string substring = music.Substring(
"Sounds/".Length);
621 if (substring.StartsWith(
"Music/")) {
622 AddSound(
SoundType.Music, Name +
'/' + music);
629 globalRecipe.
mod =
this;
630 string name = type.
Name;
631 if (globalRecipe.
Autoload(ref name)) {
632 AddGlobalRecipe(name, globalRecipe);
637 var mc = (
ModCommand)Activator.CreateInstance(type);
639 var name = type.Name;
640 if (mc.Autoload(ref name))
641 AddCommand(name, mc);
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))
669 modTranslationDictionary[key] = mt = CreateTranslation(key);
670 mt.AddTranslation(culture, value);
675 foreach (var value
in modTranslationDictionary.Values) {
676 AddTranslation(value);
void AutoloadGlobalBuff(Type type)
int Type
The index of this ModMountData in the Mount.mounts array.
virtual void AutoStaticDefaults()
Automatically sets certain static defaults. Override this if you do not want the properties to be set...
virtual void SetStaticDefaults()
This is where you set all your item's static properties, such as names/translations and the arrays in...
A ModPlayer instance represents an extension of a Player instance. You can store fields in the ModPla...
This class represents a type of tile that can be added by a mod. Only one instance of this class will...
virtual bool Autoload(ref string name)
Allows you to automatically load a GlobalBuff instead of using Mod.AddGlobalBuff. Return true to allo...
This class serves as a place for you to place all your properties and hooks for each NPC...
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.
void AutoloadTile(Type type)
Mod mod
The mod which has added this type of ModTile.
void AutoloadTileEntity(Type type)
This serves as the central class from which projectile-related functions are carried out...
Mod mod
The mod that added this style of waterfall.
SoundEffect LoadSound(Stream stream, int length, string extension)
Mod mod
The mod to which this GlobalWall belongs.
Tile Entities are Entities tightly coupled with tiles, allowing the possibility of tiles to exhibit c...
void AutoloadGlobalItem(Type type)
static Texture2D GetTexture(string name)
Gets the texture with the specified name. The name is in the format of "ModFolder/OtherFolders/FileNa...
void AutoloadSounds(IList< Type > modSounds)
Mod mod
That mod that added this global background style.
void AutoloadGlobalTile(Type type)
void AutoloadGlobalWall(Type type)
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, ref string texture)
Allows you to automatically add a type of dust without having to use Mod.AddDust. By default returns ...
void AutoloadItem(Type type)
virtual bool Autoload(ref string name, ref string texture, ref string blockTexture)
Allows you to automatically add a ModWaterStyle instead of using Mod.AddWaterStyle. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name, and texture is initialized to the namespace and overriding class name with periods replaced with slashes. BlockTexture is initialized to texture with "_Block" added at the end. Use this to either force or stop an autoload, change the name that identifies this type of ModWaterStyle, and/or change the texture paths used by this ModWaterStyle.
virtual string HeadTexture
The file name of this NPC's head texture file, to be used in autoloading.
void AutoloadNPC(Type type)
Mod mod
The mod that added this ModBuff.
void AutoloadGlobalProjectile(Type type)
Mod mod
The mod that added this ModNPC.
virtual bool Autoload(ref string name)
This serves as a place for you to program behaviors of equipment textures. This is useful for equipme...
void LoadTexture(string path, Stream stream, bool rawimg)
Mod mod
The mod to which this GlobalTile belongs to.
virtual void SetDefaults()
Allows you to set this ModDust's updateType field and modify the Terraria.GameContent.ChildSafety.SafeDust array.
Item item
The item object that this ModItem controls.
virtual bool Autoload(ref string name)
Allows you to automatically add a ModUgBgStyle instead of using Mod.AddUgBgStyle. Return true to allo...
void AutoloadModWorld(Type type)
void AutoloadWaterStyle(Type type)
virtual string HighlightTexture
The highlight texture used when this tile is selected by smart interact. Defaults to adding "_Highlig...
virtual bool Autoload(ref string name)
Allows you to automatically load a GlobalNPC instead of using Mod.AddGlobalNPC. Return true to allow ...
void AutoloadSurfaceBgStyle(Type type)
void AutoloadCommand(Type type)
This serves as the central class from which tile-related functions are supported and carried out...
virtual void AutoStaticDefaults()
Automatically sets certain static defaults. Override this if you do not want the properties to be set...
Mod mod
The mod to which this GlobalItem belongs.
virtual void SetDefaults()
Allows you to set the prefix's name/translations and to set its category.
virtual bool Autoload(ref string name)
Allows you to automatically add a GlobalBgStyle instead of using Mod.AddGlobalBgStyle. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name. Use this to either force or stop an autoload, or change the name that identifies this type of GlobalBgStyle.
virtual void SetDefaults()
This is where all buff related assignments go. For example: Main.buffName[Type] = "Display Name"; Mai...
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...
Mod mod
The mod that added this type of dust.
virtual void SetDefaults()
Allows you to modify the properties of any tile in the game. Most properties are stored as arrays thr...
ushort Type
The internal ID of this type of wall.
This class allows you to customize the behavior of a custom gore. Create a new instance of this and p...
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. Return true to autoload this wall. When a wall is autoloaded, that means you do not need to manually call Mod.AddWall. By default returns the mod's autoload property.
Music LoadMusic(string path, string extension)
NPC npc
The NPC object that this ModNPC controls.
Mod mod
The mod which has added this ModMountData.
void AutoloadWaterfallStyle(Type type)
This class serves to collect functions that operate on any kind of background style, without being specific to one single background style.
virtual bool Autoload(ref string name)
Allows you to automatically add a ModWorld instead of using Mod.AddModWorld. Return true to allow aut...
Mod mod
The mod that added this type of ModPlayer.
void AutoloadDust(Type type)
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.
Mod mod
The mod that added this style of water.
Manages content added by mods. Liasons between mod content and Terraria's arrays and oversees the Loa...
Mod mod
The mod which has added this type of ModWall.
Projectile projectile
The projectile object that this ModProjectile controls.
This class allows you to modify the behavior of any wall in the game (although admittedly walls don't...
Mod mod
The mod object that this ModProjectile originates from.
This class allows you to modify and use hooks for all items, including vanilla items. Create an instance of an overriding class then call Mod.AddGlobalItem to use this.
virtual void SetStaticDefaults()
Allows you to set all your NPC's static properties, such as names/translations and the arrays in NPCI...
This class allows you to customize how a sound you add is played. To use this, pass an instance to Mo...
virtual bool Autoload(ref string name)
Allows you to automatically add a ModSurfaceBgStyle instead of using Mod.AddSurfaceBgStyle. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name. Use this to either force or stop an autoload, or change the name that identifies this type of ModSurfaceBgStyle.
static Task< Texture2D > RawToTexture2DAsync(GraphicsDevice graphicsDevice, BinaryReader r)
virtual bool Autoload(ref string name)
Allows you to automatically load an item instead of using Mod.AddItem. Return true to allow autoloadi...
void AutoloadGlobalNPC(Type type)
virtual bool Autoload(ref string name)
Allows you to automatically load an NPC instead of using Mod.AddNPC. Return true to allow autoloading...
void AutoloadMountData(Type type)
Mod mod
The mod to which this GlobalNPC belongs.
This class represents a type of wall that can be added by a mod. Only one instance of this class will...
This serves as the central class from which item-related functions are carried out. It also stores a list of mod items by ID.
virtual string Texture
The file name of this item's texture file in the mod loader's file space.
virtual bool Autoload(ref string name)
Allows you to automatically load a GlobalRecipe instead of using Mod.AddGlobalRecipe. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name. Use this method to either force or stop an autoload, and to change the default internal name.
virtual void SetDefaults()
Allows you to modify the properties of any wall in the game. Most properties are stored as arrays thr...
This class serves as a place for you to place all your properties and hooks for each mount...
This class allows you to modify and use hooks for all NPCs, including vanilla mobs. Create an instance of an overriding class then call Mod.AddGlobalNPC to use this.
ushort Type
The internal ID of this type of tile.
virtual bool Autoload(ref string name)
Allows you to automatically load a GlobalWall instead of using Mod.AddGlobalWall. Return true to allo...
Represents a style of waterfalls that gets drawn. This is mostly used to determine the color of the w...
virtual string BossHeadTexture
This file name of this NPC's boss head texture file, to be used in autoloading.
void AutoloadGlobalBgStyle(Type type)
int Type
The ID of this waterfall style.
MountTextureType
This is an enum of all possible types of extra mount textures for custom mounts. Use these as keys in...
This class serves as a place for you to define a new buff and how that buff behaves.
void AutoloadGores(IList< Type > modGores)
SoundType
This is an enum of the types of sound you can add to the game. This is used for determining whether a...
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)
Allows you to automatically load a projectile instead of using Mod.AddProjectile. Return true to allo...
void AutoloadProjectile(Type type)
void AutoloadLocalization()
Loads .lang files
void AutoloadUgBgStyle(Type type)
virtual bool Autoload(ref string name)
Allows you to automatically load a GlobalItem instead of using Mod.AddGlobalItem. Return true to allo...
void AutoloadBuff(Type type)
virtual string Name
Stores the name of the mod. This name serves as the mod's identification, and also helps with saving ...
This serves as the central class from which NPC-related functions are carried out. It also stores a list of mod NPCs by ID.
Mod mod
The mod that added this type of ModWorld.
This class serves as a place for you to place all your properties and hooks for each projectile...
string chest
The default name of this chest that is displayed when this 2x2 chest is open. Defaults to the empty s...
A ModWorld instance represents an extension of a World. You can store fields in the ModWorld classes ...
Mount.MountData mountData
The vanilla MountData object that is controlled by this ModMountData.
Mod mod
The mod to which this GlobalProjectile belongs.
This class represents a chat or console command. Use the CommandType to specify the scope of the comm...
This class allows you to modify the behavior of any buff in the game.
virtual bool Autoload(ref string name, ref string texture)
Allows you to automatically add a ModWaterfallStyle instead of using Mod.AddWaterfallStyle. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name, and texture is initialized to the namespace and overriding class name with periods replaced with slashes. Use this to either force or stop an autoload, change the name that identifies this type of ModWaterStyle, or change the texture path used by this ModWaterfallStyle.
virtual void AutoStaticDefaults()
Automatically sets certain static defaults. Override this if you do not want the properties to be set...
void AutoloadBackgrounds()
This class provides hooks that control all recipes in the game.
This class serves as a place for you to place all your properties and hooks for each item...
void AutoloadPlayer(Type type)
virtual bool Autoload(ref string name)
Allows you to automatically load a tile entity instead of using Mod.AddTileEntity. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name. Use this method to either force or stop an autoload, or change the default display name.
This class represents a type of dust that is added by a mod. Only one instance of this class will eve...
void AutoloadGlobalRecipe(Type type)
Mod mod
The mod which added this GlobalRecipe.
virtual void SetDefaults()
Allows you to set the properties of this wall. Many properties are stored as arrays throughout Terrar...
int Type
The buff id of this buff.
Mod mod
The mod that added this ModTileEntity.
virtual bool Autoload(ref string name)
Allows you to automatically load a GlobalProjectile instead of using Mod.AddGlobalProjectile. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name. Use this method to either force or stop an autoload or to control the internal name.
Mod mod
The mod that added this surface background style.
Mod mod
The mod that added this underground background style.
void AutoloadWall(Type type)
virtual void SetStaticDefaults()
Allows you to set all your projectile's static properties, such as names/translations and the arrays ...
virtual void AutoDefaults()
This class allows you to modify and use hooks for all projectiles, including vanilla projectiles...
string Name
The internal name of this ModItem.
This serves as the central place from which mounts are stored and mount-related functions are carried...
Mod mod
The mod to which this GlobalBuff belongs.
int Type
The ID of the water style.
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.
void AutoloadPrefix(Type type)
virtual bool Autoload(ref string name)
Allows you to automatically load a GlobalTile instead of using Mod.AddGlobalTile. Return true to allo...
static Task< Texture2D > PngToTexture2DAsync(GraphicsDevice graphicsDevice, Stream stream)
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. Return true to autoload this tile. When a tile is autoloaded, that means you do not need to manually call Mod.AddTile. By default returns the mod's autoload property.
static void Convert(float[] floatBuf, byte[] buffer)