tModLoader v0.11.8.9
A mod to make and play Terraria mods
|
A ModWorld instance represents an extension of a World. You can store fields in the ModWorld classes to keep track of mod-specific information on the world. It also contains hooks to insert your code into the world generation process. More...
Public Member Functions | |
virtual bool | Autoload (ref string name) |
Allows you to automatically add a ModWorld instead of using Mod.AddModWorld. 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 ModWorld. More... | |
virtual void | ChooseWaterStyle (ref int style) |
Allows you to change the water style (determines water color) that is currently being used. More... | |
virtual void | Initialize () |
Called whenever the world is loaded. This can be used to initialize data structures, etc. More... | |
virtual void | Load (TagCompound tag) |
Allows you to load custom data you have saved for this world. More... | |
virtual void | LoadLegacy (BinaryReader reader) |
Allows you to load pre-v0.9 custom data you have saved for this world. More... | |
virtual void | ModifyHardmodeTasks (List< GenPass > list) |
Similar to ModifyWorldGenTasks, but occurs in-game when Hardmode starts. Can be used to modify which tasks should be done and/or add custom tasks. By default the list will only contain 4 items, the vanilla hardmode tasks called "Hardmode Good", "Hardmode Evil", "Hardmode Walls", and "Hardmode Announcment" More... | |
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 before a new world begins to be generated. For example, removing the "Planting Trees" pass will cause a world to generate without trees. Placing a new Generation Pass before the "Dungeon" pass will prevent the the mod's pass from cutting into the dungeon. More... | |
virtual void | NetReceive (BinaryReader reader) |
Allows you to do things with custom data that is received between clients and server. More... | |
virtual void | NetSend (BinaryWriter writer) |
Allows you to send custom data between clients and server. This is useful for syncing information such as bosses that have been defeated. More... | |
virtual void | PostDrawTiles () |
Called after drawing Tiles. Can be used for drawing a tile overlay akin to wires. Note that spritebatch should be begun and ended within this method. More... | |
virtual void | PostUpdate () |
Use this method to have things happen in the world. In vanilla Terraria, a good example of code suitable for this hook is how Falling Stars fall to the ground during the night. This hook is called every frame. More... | |
virtual void | PostWorldGen () |
Use this method to place tiles in the world after world generation is complete. More... | |
virtual void | PreUpdate () |
Use this method to have things happen in the world. In vanilla Terraria, a good example of code suitable for this hook is how Falling Stars fall to the ground during the night. This hook is called every frame. More... | |
virtual void | PreWorldGen () |
Allows a mod to run code before a world is generated. More... | |
virtual void | ResetNearbyTileEffects () |
Use this to reset any fields you set in any of your ModTile.NearbyEffects hooks back to their default values. More... | |
virtual TagCompound | Save () |
Allows you to save custom data for this world. Useful for things like saving world specific flags. For example, if your mod adds a boss and you want certain NPC to only spawn once it has been defeated, this is where you would store the information that that boss has been defeated in this world. Returns null by default. More... | |
virtual void | TileCountsAvailable (int[] tileCounts) |
Allows you to store information about how many of each tile is nearby the player. This is useful for counting how many tiles of a certain custom biome there are. The tileCounts parameter stores the tile count indexed by tile type. More... | |
Properties | |
Mod | mod [get, set] |
The mod that added this type of ModWorld. More... | |
string | Name [get, set] |
The name of this ModWorld. Used for distinguishing between multiple ModWorlds added by a single Mod. More... | |
A ModWorld instance represents an extension of a World. You can store fields in the ModWorld classes to keep track of mod-specific information on the world. It also contains hooks to insert your code into the world generation process.
Definition at line 11 of file ModWorld.cs.
|
virtual |
Allows you to automatically add a ModWorld instead of using Mod.AddModWorld. 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 ModWorld.
Definition at line 32 of file ModWorld.cs.
References Terraria.ModLoader.ModProperties.Autoload, Terraria.ModLoader.ModWorld.mod, and Terraria.ModLoader.Mod.Properties.
Referenced by Terraria.ModLoader.Mod.AutoloadModWorld().
|
virtual |
Allows you to change the water style (determines water color) that is currently being used.
Definition at line 118 of file ModWorld.cs.
Referenced by Terraria.ModLoader.WorldHooks.ChooseWaterStyle().
|
virtual |
Called whenever the world is loaded. This can be used to initialize data structures, etc.
Definition at line 39 of file ModWorld.cs.
|
virtual |
Allows you to load custom data you have saved for this world.
Definition at line 52 of file ModWorld.cs.
|
virtual |
Allows you to load pre-v0.9 custom data you have saved for this world.
Definition at line 58 of file ModWorld.cs.
|
virtual |
Similar to ModifyWorldGenTasks, but occurs in-game when Hardmode starts. Can be used to modify which tasks should be done and/or add custom tasks. By default the list will only contain 4 items, the vanilla hardmode tasks called "Hardmode Good", "Hardmode Evil", "Hardmode Walls", and "Hardmode Announcment"
Definition at line 124 of file ModWorld.cs.
Referenced by Terraria.ModLoader.WorldHooks.ModifyHardmodeTasks().
|
virtual |
A more advanced option to PostWorldGen, this method allows you modify the list of Generation Passes before a new world begins to be generated. For example, removing the "Planting Trees" pass will cause a world to generate without trees. Placing a new Generation Pass before the "Dungeon" pass will prevent the the mod's pass from cutting into the dungeon.
Definition at line 82 of file ModWorld.cs.
Referenced by Terraria.ModLoader.WorldHooks.ModifyWorldGenTasks().
|
virtual |
Allows you to do things with custom data that is received between clients and server.
Definition at line 70 of file ModWorld.cs.
|
virtual |
Allows you to send custom data between clients and server. This is useful for syncing information such as bosses that have been defeated.
Definition at line 64 of file ModWorld.cs.
|
virtual |
Called after drawing Tiles. Can be used for drawing a tile overlay akin to wires. Note that spritebatch should be begun and ended within this method.
Definition at line 130 of file ModWorld.cs.
Referenced by Terraria.ModLoader.WorldHooks.PostDrawTiles().
|
virtual |
Use this method to have things happen in the world. In vanilla Terraria, a good example of code suitable for this hook is how Falling Stars fall to the ground during the night. This hook is called every frame.
Definition at line 106 of file ModWorld.cs.
Referenced by Terraria.ModLoader.WorldHooks.PostUpdate().
|
virtual |
Use this method to place tiles in the world after world generation is complete.
Definition at line 88 of file ModWorld.cs.
Referenced by Terraria.ModLoader.WorldHooks.PostWorldGen().
|
virtual |
Use this method to have things happen in the world. In vanilla Terraria, a good example of code suitable for this hook is how Falling Stars fall to the ground during the night. This hook is called every frame.
Definition at line 100 of file ModWorld.cs.
Referenced by Terraria.ModLoader.WorldHooks.PreUpdate().
|
virtual |
Allows a mod to run code before a world is generated.
Definition at line 76 of file ModWorld.cs.
Referenced by Terraria.ModLoader.WorldHooks.PreWorldGen().
|
virtual |
Use this to reset any fields you set in any of your ModTile.NearbyEffects hooks back to their default values.
Definition at line 94 of file ModWorld.cs.
Referenced by Terraria.ModLoader.WorldHooks.ResetNearbyTileEffects().
|
virtual |
Allows you to save custom data for this world. Useful for things like saving world specific flags. For example, if your mod adds a boss and you want certain NPC to only spawn once it has been defeated, this is where you would store the information that that boss has been defeated in this world. Returns null by default.
Definition at line 45 of file ModWorld.cs.
|
virtual |
Allows you to store information about how many of each tile is nearby the player. This is useful for counting how many tiles of a certain custom biome there are. The tileCounts parameter stores the tile count indexed by tile type.
Definition at line 112 of file ModWorld.cs.
Referenced by Terraria.ModLoader.WorldHooks.TileCountsAvailable().
|
getset |
The mod that added this type of ModWorld.
Definition at line 16 of file ModWorld.cs.
Referenced by Terraria.ModLoader.ModWorld.Autoload().
|
getset |
The name of this ModWorld. Used for distinguishing between multiple ModWorlds added by a single Mod.
Definition at line 24 of file ModWorld.cs.
Referenced by Terraria.ModLoader.Mod.AutoloadModWorld().