Terraria ModLoader
A mod to make and play Terraria mods
Go to the documentation of this file.
1 using System.Collections.Generic;
2 using System.IO;
3 using Terraria.ModLoader.IO;
4 using Terraria.World.Generation;
6 namespace Terraria.ModLoader
7 {
11  public class ModWorld
12  {
16  public Mod mod {
17  get;
18  internal set;
19  }
24  public string Name {
25  get;
26  internal set;
27  }
32  public virtual bool Autoload(ref string name) {
33  return mod.Properties.Autoload;
34  }
39  public virtual void Initialize() {
40  }
45  public virtual TagCompound Save() {
46  return null;
47  }
52  public virtual void Load(TagCompound tag) {
53  }
58  public virtual void LoadLegacy(BinaryReader reader) {
59  }
64  public virtual void NetSend(BinaryWriter writer) {
65  }
70  public virtual void NetReceive(BinaryReader reader) {
71  }
76  public virtual void PreWorldGen() {
77  }
82  public virtual void ModifyWorldGenTasks(List<GenPass> tasks, ref float totalWeight) {
83  }
88  public virtual void PostWorldGen() {
89  }
94  public virtual void ResetNearbyTileEffects() {
95  }
100  public virtual void PreUpdate() {
101  }
106  public virtual void PostUpdate() {
107  }
112  public virtual void TileCountsAvailable(int[] tileCounts) {
113  }
118  public virtual void ChooseWaterStyle(ref int style) {
119  }
124  public virtual void ModifyHardmodeTasks(List<GenPass> list) {
125  }
130  public virtual void PostDrawTiles() {
131  }
132  }
133 }
virtual void NetSend(BinaryWriter writer)
Allows you to send custom data between clients and server. This is useful for syncing information suc...
Definition: ModWorld.cs:64
virtual void NetReceive(BinaryReader reader)
Allows you to do things with custom data that is received between clients and server.
Definition: ModWorld.cs:70
virtual void ModifyWorldGenTasks(List< GenPass > tasks, ref float totalWeight)
A more advanced option to PostWorldGen, this method allows you modify the list of Generation Passes b...
Definition: ModWorld.cs:82
virtual void PostUpdate()
Use this method to have things happen in the world. In vanilla Terraria, a good example of code suita...
Definition: ModWorld.cs:106
virtual void PreUpdate()
Use this method to have things happen in the world. In vanilla Terraria, a good example of code suita...
Definition: ModWorld.cs:100
virtual void ResetNearbyTileEffects()
Use this to reset any fields you set in any of your ModTile.NearbyEffects hooks back to their default...
Definition: ModWorld.cs:94
virtual void PostWorldGen()
Use this method to place tiles in the world after world generation is complete.
Definition: ModWorld.cs:88
virtual void ChooseWaterStyle(ref int style)
Allows you to change the water style (determines water color) that is currently being used...
Definition: ModWorld.cs:118
virtual TagCompound Save()
Allows you to save custom data for this world. Useful for things like saving world specific flags...
Definition: ModWorld.cs:45
virtual bool Autoload(ref string name)
Allows you to automatically add a ModWorld instead of using Mod.AddModWorld. Return true to allow aut...
Definition: ModWorld.cs:32
virtual void Initialize()
Called whenever the world is loaded. This can be used to initialize data structures, etc.
Definition: ModWorld.cs:39
virtual void PostDrawTiles()
Called after drawing Tiles. Can be used for drawing a tile overlay akin to wires. Note that spritebat...
Definition: ModWorld.cs:130
virtual void TileCountsAvailable(int[] tileCounts)
Allows you to store information about how many of each tile is nearby the player. This is useful for ...
Definition: ModWorld.cs:112
virtual void Load(TagCompound tag)
Allows you to load custom data you have saved for this world.
Definition: ModWorld.cs:52
A ModWorld instance represents an extension of a World. You can store fields in the ModWorld classes ...
Definition: ModWorld.cs:11
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
virtual void PreWorldGen()
Allows a mod to run code before a world is generated.
Definition: ModWorld.cs:76
virtual void ModifyHardmodeTasks(List< GenPass > list)
Similar to ModifyWorldGenTasks, but occurs in-game when Hardmode starts. Can be used to modify which ...
Definition: ModWorld.cs:124
virtual void LoadLegacy(BinaryReader reader)
Allows you to load pre-v0.9 custom data you have saved for this world.
Definition: ModWorld.cs:58