2 using System.Collections.Generic;
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++)
47 NetWorlds[i] =
ModNet.
GetMod(r.ReadInt16()).GetModWorld(r.ReadString());
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) {
static void ModifyHardmodeTasks(List< GenPass > passes)
static void TileCountsAvailable(int[] tileCounts)
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...
static void ModifyWorldGenTasks(List< GenPass > passes, ref float totalWeight)
virtual void PostUpdate()
Use this method to have things happen in the world. In vanilla Terraria, a good example of code suita...
virtual void PreUpdate()
Use this method to have things happen in the world. In vanilla Terraria, a good example of code suita...
virtual void ResetNearbyTileEffects()
Use this to reset any fields you set in any of your ModTile.NearbyEffects hooks back to their default...
This serves as the central class which loads mods. It contains many static fields and methods related...
virtual void PostWorldGen()
Use this method to place tiles in the world after world generation is complete.
This is where all ModWorld hooks are gathered and called.
virtual void ChooseWaterStyle(ref int style)
Allows you to change the water style (determines water color) that is currently being used...
static void PostDrawTiles()
virtual void Initialize()
Called whenever the world is loaded. This can be used to initialize data structures, etc.
virtual void PostDrawTiles()
Called after drawing Tiles. Can be used for drawing a tile overlay akin to wires. Note that spritebat...
static Mod GetMod(int netID)
static void PreWorldGen()
virtual void TileCountsAvailable(int[] tileCounts)
Allows you to store information about how many of each tile is nearby the player. This is useful for ...
A ModWorld instance represents an extension of a World. You can store fields in the ModWorld classes ...
virtual void PreWorldGen()
Allows a mod to run code before a world is generated.
static void PostWorldGen()
virtual void ModifyHardmodeTasks(List< GenPass > list)
Similar to ModifyWorldGenTasks, but occurs in-game when Hardmode starts. Can be used to modify which ...
static void ChooseWaterStyle(ref int style)
static void ResetNearbyTileEffects()