2using System.Collections.Generic;
4using Terraria.World.Generation;
14 internal static readonly IList<ModWorld> worlds =
new List<ModWorld>();
15 internal static ModWorld[] NetWorlds;
17 internal static void Add(
ModWorld modWorld) {
21 internal static void ResizeArrays() {
22 NetWorlds =
ModLoader.BuildGlobalHook<
ModWorld, Action<BinaryWriter>>(worlds, w => w.NetSend);
25 internal static void Unload() {
29 internal static void SetupWorld() {
35 internal static void WriteNetWorldOrder(
BinaryWriter w) {
36 w.Write((
short)NetWorlds.Length);
37 foreach (var netWorld
in NetWorlds) {
38 w.Write(netWorld.mod.netID);
39 w.Write(netWorld.Name);
44 short n = r.ReadInt16();
46 for (
short i = 0; i < n; i++)
51 foreach (
ModWorld modWorld
in worlds) {
57 foreach (
ModWorld modWorld
in worlds) {
63 foreach (
ModWorld modWorld
in worlds) {
69 foreach (
ModWorld modWorld
in worlds) {
75 foreach (
ModWorld modWorld
in worlds) {
81 foreach (
ModWorld modWorld
in worlds) {
87 foreach (
ModWorld modWorld
in worlds) {
93 foreach (
ModWorld modWorld
in worlds) {
99 foreach (
ModWorld modWorld
in worlds) {
105 foreach (
ModWorld modWorld
in worlds) {
ModWorld GetModWorld(string name)
Gets the ModWorld instance with the given name from this mod.
This serves as the central class which loads mods. It contains many static fields and methods related...
static Mod GetMod(int netID)
A ModWorld instance represents an extension of a World. You can store fields in the ModWorld classes ...
virtual void ChooseWaterStyle(ref int style)
Allows you to change the water style (determines water color) that is currently being used.
virtual void TileCountsAvailable(int[] tileCounts)
Allows you to store information about how many of each tile is nearby the player. This is useful for ...
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...
virtual void PostWorldGen()
Use this method to place tiles in the world after world generation is complete.
virtual void PostUpdate()
Use this method to have things happen in the world. In vanilla Terraria, a good example of code suita...
virtual void PreWorldGen()
Allows a mod to run code before a world is generated.
virtual void ResetNearbyTileEffects()
Use this to reset any fields you set in any of your ModTile.NearbyEffects hooks back to their default...
virtual void PostDrawTiles()
Called after drawing Tiles. Can be used for drawing a tile overlay akin to wires. Note that spritebat...
virtual void PreUpdate()
Use this method to have things happen in the world. In vanilla Terraria, a good example of code suita...
virtual void ModifyHardmodeTasks(List< GenPass > list)
Similar to ModifyWorldGenTasks, but occurs in-game when Hardmode starts. Can be used to modify which ...
virtual void Initialize()
Called whenever the world is loaded. This can be used to initialize data structures,...
This is where all ModWorld hooks are gathered and called.
static void ModifyHardmodeTasks(List< GenPass > passes)
static void PreWorldGen()
static void PostWorldGen()
static void PostDrawTiles()
static void ChooseWaterStyle(ref int style)
static void ModifyWorldGenTasks(List< GenPass > passes, ref float totalWeight)
static void ResetNearbyTileEffects()
static void TileCountsAvailable(int[] tileCounts)