tModLoader v0.11.8.9
A mod to make and play Terraria mods
ModWorld.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using System.IO;
4using Terraria.World.Generation;
5
6namespace Terraria.ModLoader
7{
11 public class ModWorld
12 {
16 public Mod mod {
17 get;
18 internal set;
19 }
20
24 public string Name {
25 get;
26 internal set;
27 }
28
32 public virtual bool Autoload(ref string name) {
33 return mod.Properties.Autoload;
34 }
35
39 public virtual void Initialize() {
40 }
41
45 public virtual TagCompound Save() {
46 return null;
47 }
48
52 public virtual void Load(TagCompound tag) {
53 }
54
58 public virtual void LoadLegacy(BinaryReader reader) {
59 }
60
64 public virtual void NetSend(BinaryWriter writer) {
65 }
66
70 public virtual void NetReceive(BinaryReader reader) {
71 }
72
76 public virtual void PreWorldGen() {
77 }
78
82 public virtual void ModifyWorldGenTasks(List<GenPass> tasks, ref float totalWeight) {
83 }
84
88 public virtual void PostWorldGen() {
89 }
90
94 public virtual void ResetNearbyTileEffects() {
95 }
96
100 public virtual void PreUpdate() {
101 }
102
106 public virtual void PostUpdate() {
107 }
108
112 public virtual void TileCountsAvailable(int[] tileCounts) {
113 }
114
118 public virtual void ChooseWaterStyle(ref int style) {
119 }
120
124 public virtual void ModifyHardmodeTasks(List<GenPass> list) {
125 }
126
130 public virtual void PostDrawTiles() {
131 }
132 }
133}
Mod is an abstract class that you will override. It serves as a central place from which the mod's co...
Definition: Mod.cs:25
ModProperties Properties
Definition: Mod.cs:52
A ModWorld instance represents an extension of a World. You can store fields in the ModWorld classes ...
Definition: ModWorld.cs:12
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
string Name
The name of this ModWorld. Used for distinguishing between multiple ModWorlds added by a single Mod.
Definition: ModWorld.cs:24
virtual void Load(TagCompound tag)
Allows you to load custom data you have saved for this world.
Definition: ModWorld.cs:52
Mod mod
The mod that added this type of ModWorld.
Definition: ModWorld.cs:16
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 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 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 PostWorldGen()
Use this method to place tiles in the world after world generation is complete.
Definition: ModWorld.cs:88
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 PreWorldGen()
Allows a mod to run code before a world is generated.
Definition: ModWorld.cs:76
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 NetReceive(BinaryReader reader)
Allows you to do things with custom data that is received between clients and server.
Definition: ModWorld.cs:70
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 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 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 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,...
Definition: ModWorld.cs:39
virtual void LoadLegacy(BinaryReader reader)
Allows you to load pre-v0.9 custom data you have saved for this world.
Definition: ModWorld.cs:58
virtual TagCompound Save()
Allows you to save custom data for this world. Useful for things like saving world specific flags....
Definition: ModWorld.cs:45
bool Autoload
Whether or not this mod will autoload content by default. Autoloading content means you do not need t...