Standalone [1.3] tModLoader - A Modding API

The error tells you the line number. That parameter is the tileid, remember that we get mod tile tileid by calling mod.TileType("name"), right?

I did that but now I get this error
c:\Users\Julian Romero\Documents\My Games\Terraria\ModLoader\Mod Sources\EpicnessMod\EpicnessWorld.cs(69,202) : error CS0120: An object reference is required for the non-static field, method, or property 'Terraria.ModLoader.ModWorld.mod.get'

c:\Users\Julian Romero\Documents\My Games\Terraria\ModLoader\Mod Sources\EpicnessMod\EpicnessWorld.cs(69,5) : error CS1502: The best overloaded method match for 'Terraria.WorldGen.OreRunner(int, int, double, int, ushort)' has some invalid arguments

c:\Users\Julian Romero\Documents\My Games\Terraria\ModLoader\Mod Sources\EpicnessMod\EpicnessWorld.cs(69,202) : error CS1503: Argument 5: cannot convert from 'int' to 'ushort'

Here is the code
Code:
using System.IO;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.World.Generation;
using Microsoft.Xna.Framework;
using System;

namespace EpicnessMod
{
    public class EpicnessWorld : ModWorld
    {
        private const int saveVersion = 0;
        public static bool downedDarkNebula = false;
        public static int DarkNebulaDefeated;
        public const int MSG_BLESS = 1;   
        //public struct EpicnessMsgs
//{
public static string[] misc = {"Your world has been infected with Corrupt Ore!"};
//}

        public override void Initialize()
        {
            downedDarkNebula = false;
        }

        public override void SaveCustomData(BinaryWriter writer)
        {
            writer.Write(saveVersion);
            byte flags = 0;
            writer.Write(DarkNebulaDefeated);
            if (downedDarkNebula)
            {
                flags |= 1;
            }
            writer.Write(flags);
        }

        public override void LoadCustomData(BinaryReader reader)
        {
            reader.ReadInt32();
            DarkNebulaDefeated = reader.ReadInt32();
            byte flags = reader.ReadByte();
            downedDarkNebula = ((flags & 1) == 1);
        }
#region Bless() : void [STATIC]
public static void Bless()
{
    if (Main.netMode == 1) return;
    DarkNebulaDefeated++;
    int amount = 0;
    double num5;
    num5 = Main.rockLayer;
    int xloc = -100 + Main.maxTilesX - 100;
    int yloc = -(int)num5 + Main.maxTilesY - 200;
    int sum = xloc * yloc;
    amount = (int)(sum / 10000) * 10;
    if (DarkNebulaDefeated == 1)
    {
        if (DarkNebulaDefeated == 1)
        {
            for(int zz = 0; zz < amount; zz++)
            {
                int i2 = WorldGen.genRand.Next(100, Main.maxTilesX - 100);
                double num6;
                num6 = Main.rockLayer;
                int j2 = WorldGen.genRand.Next((int)num6, Main.maxTilesY - 200);
                WorldGen.OreRunner(i2, j2, (double)WorldGen.genRand.Next(WorldGen.genRand.Next(2, 4), WorldGen.genRand.Next(4, 7)), WorldGen.genRand.Next(WorldGen.genRand.Next(3, 5), WorldGen.genRand.Next(4, 8)), mod.TileType ("CorruptOre"));
            }
             if (Main.netMode == 0)
                Main.NewText(EpicnessWorld.misc[1], 80, 65, 130);
             else if (Main.netMode == 2)
                NetMessage.SendData(25, -1, -1, EpicnessWorld.misc[1], 255, 80f, 65f, 130f, 0);
        }
    }
}
#endregion
    }
}
 
I did that but now I get this error
c:\Users\Julian Romero\Documents\My Games\Terraria\ModLoader\Mod Sources\EpicnessMod\EpicnessWorld.cs(69,202) : error CS0120: An object reference is required for the non-static field, method, or property 'Terraria.ModLoader.ModWorld.mod.get'

c:\Users\Julian Romero\Documents\My Games\Terraria\ModLoader\Mod Sources\EpicnessMod\EpicnessWorld.cs(69,5) : error CS1502: The best overloaded method match for 'Terraria.WorldGen.OreRunner(int, int, double, int, ushort)' has some invalid arguments

c:\Users\Julian Romero\Documents\My Games\Terraria\ModLoader\Mod Sources\EpicnessMod\EpicnessWorld.cs(69,202) : error CS1503: Argument 5: cannot convert from 'int' to 'ushort'

Here is the code
Code:
using System.IO;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.World.Generation;
using Microsoft.Xna.Framework;
using System;

namespace EpicnessMod
{
    public class EpicnessWorld : ModWorld
    {
        private const int saveVersion = 0;
        public static bool downedDarkNebula = false;
        public static int DarkNebulaDefeated;
        public const int MSG_BLESS = 1;  
        //public struct EpicnessMsgs
//{
public static string[] misc = {"Your world has been infected with Corrupt Ore!"};
//}

        public override void Initialize()
        {
            downedDarkNebula = false;
        }

        public override void SaveCustomData(BinaryWriter writer)
        {
            writer.Write(saveVersion);
            byte flags = 0;
            writer.Write(DarkNebulaDefeated);
            if (downedDarkNebula)
            {
                flags |= 1;
            }
            writer.Write(flags);
        }

        public override void LoadCustomData(BinaryReader reader)
        {
            reader.ReadInt32();
            DarkNebulaDefeated = reader.ReadInt32();
            byte flags = reader.ReadByte();
            downedDarkNebula = ((flags & 1) == 1);
        }
#region Bless() : void [STATIC]
public static void Bless()
{
    if (Main.netMode == 1) return;
    DarkNebulaDefeated++;
    int amount = 0;
    double num5;
    num5 = Main.rockLayer;
    int xloc = -100 + Main.maxTilesX - 100;
    int yloc = -(int)num5 + Main.maxTilesY - 200;
    int sum = xloc * yloc;
    amount = (int)(sum / 10000) * 10;
    if (DarkNebulaDefeated == 1)
    {
        if (DarkNebulaDefeated == 1)
        {
            for(int zz = 0; zz < amount; zz++)
            {
                int i2 = WorldGen.genRand.Next(100, Main.maxTilesX - 100);
                double num6;
                num6 = Main.rockLayer;
                int j2 = WorldGen.genRand.Next((int)num6, Main.maxTilesY - 200);
                WorldGen.OreRunner(i2, j2, (double)WorldGen.genRand.Next(WorldGen.genRand.Next(2, 4), WorldGen.genRand.Next(4, 7)), WorldGen.genRand.Next(WorldGen.genRand.Next(3, 5), WorldGen.genRand.Next(4, 8)), mod.TileType ("CorruptOre"));
            }
             if (Main.netMode == 0)
                Main.NewText(EpicnessWorld.misc[1], 80, 65, 130);
             else if (Main.netMode == 2)
                NetMessage.SendData(25, -1, -1, EpicnessWorld.misc[1], 255, 80f, 65f, 130f, 0);
        }
    }
}
#endregion
    }
}
K, well, I think I'll just tell you to look up static and casting. The mod variable isn't available because it's a static method, and the tileid is expected to be a ushort but an int is returned by TileType.
 
Exception of type 'System.OutOfMemoryException' was thrown.
at Terraria.WorldGen.clearWorld()
at Terraria.WorldGen.do_worldGenCallBack(Object threadContext)
at Terraria.WorldGen.worldGenCallBack(Object threadContext)

Help me please i don't know what to do. Started happening this morning and i don't know what i did. The game was working perfectly fine until this morning
 
Can someone please tell me how to start up a tmodloader server, my friend and i have been trying for a while and we've been using the tmodloaderserver file but once it says the server is started we don't know what to do from there.
You'll need to connect via IP. And you'll need to know what IP address to connect to. If you are on the same PC as your server, use 127.0.0.1. If you are on the same local area network, type in the IP address of the PC running the server. If you don't know what that is, open command prompt and type 'ipconfig'. it will be listed after 'IPv4 Address...'. If you are connecting through the internet, use an online tool to find out what your external IP address is and give it to your friends. They can use this same tool to check if your port is open.
 
The total on the mod browser?
Well, if you really want the total across all versions...
10,576 from Mediafire and 4,012 from the mod browser.

How would I make a consumable potion/food? There is no example in the example mod. Or at least I don't think there is.
To make food, you would set item.consumable to true and set item.buffType to the buff ID of well-fed.
To make a potion, you would set item.consumable to true, item.potion to true for the potion sickness debuff, and item.healLife to whatever you want.
 
For some reason a lot of mods on the mod browser link me here. This happens when I click visit this mod's homepage for more information.
 
For some reason a lot of mods on the mod browser link me here. This happens when I click visit this mod's homepage for more information.
If I had to take a guess, most of the "build.txt" files in those mods are copied/pasted and edited from the Example Mod and left the website link to the tModLoader page.
 
You'll need to connect via IP. And you'll need to know what IP address to connect to. If you are on the same PC as your server, use 127.0.0.1. If you are on the same local area network, type in the IP address of the PC running the server. If you don't know what that is, open command prompt and type 'ipconfig'. it will be listed after 'IPv4 Address...'. If you are connecting through the internet, use an online tool to find out what your external IP address is and give it to your friends. They can use this same tool to check if your port is open.
You are a true hero
 
Hi how do i do that when i kill boss monster new enemies ill apear? And how to make that enemies will spawn only in caverns??? I will be really happy IF someone tell me this :D
 
i could really use help because there are some cool mods that use the mod browser to install however when i use the bod browser i comes up with nothing i have tried reloading it and restarting terraria but it does not help do you know any fixes
 
So i tried to join my friends server like i was told and we used an ip address using hamachi but it still wont work, we have the tmodloader server program opened and everything
 
Back
Top Bottom