Standalone [1.3] tModLoader - A Modding API

Discussion in 'Works-in-Progress' started by blushiemagic, Jul 7, 2015.

  1. Jofairden

    Jofairden Golem

    Your example is unnecessarily complex.
    Yes, you will be able to get any property you add to your config. (What's the point of it if you couldn't?)
    Example config:
  2. Quethed

    Quethed Terrarian

    I personally hate when your code is unnecessarily complex. just saying.
  3. Jofairden

    Jofairden Golem

    What are you trying to say?
  4. Quethed

    Quethed Terrarian

    Nothing important, just an opinion (NOT towards the person)
  5. Quethed

    Quethed Terrarian

    How do you make a block get placed facing the player, without using "TileObjectData" because the game wants to divide by 0
  6. Horcrux

    Horcrux Terrarian

    the most unstable thing I have ever seen, but still; its amazing. Its the reason I have like 200 hours THIS MONTH on terraria
  7. Zwip-Zwap Zapony

    Zwip-Zwap Zapony Terrarian

    Is there a tutorial/guide for custom multiplayer synchronization?

    When I try to compile a mod that I'm working on, tModLoader says "...\RegenFromBosses_NetSynch.cs(21,21) : error CS0120: An object reference is required for the non-static field, method, or property 'Mod.GetPacket(int)' ", however when I compile ExampleMod (which also has custom synchronization), no such error occurs, which means that the error is on my part somehow.

    This is the current RegenFromBosses_NetSynch.cs file, minus two methods to keep the post shorter:
    using System.IO;
    using System.Linq; //For C#6 compiling
    using Terraria;
    using Terraria.ID;
    using Terraria.ModLoader;
    using Terraria.ModLoader.IO;
    //This file is all about synchronizing the regenLife variable in multiplayer
    //It has a function that sends regenLife from the server to all clients (NetSendRegen()),
    //and a function that lets clients ask the server to do the above (NetGetRegen())
    //Note that despite what this file is for, this mod's multiplayer synchronization compatibility is still completely unknown at the time
    namespace RegenFromBosses
        public partial class RegenFromBosses : Mod
            public static void NetSendRegen() //Send the current life regeneration value from the server to all clients
                if (Main.netMode==NetmodeID.Server) //If hosting the server...
    /*ERROR*/       ModPacket packet=GetPacket(); //...create a new network packet...
                    packet.Write((byte)PacketType.ServerSendRegenToClient); //...write what the packet is for...
                    packet.Write(regenLife); //...write the current life regeneration value...
                    packet.Send(); //...and send the packet
            //public static void NetGetRegen() { ... } //Ask the server to transmit the current life regeneration value
            //public override void HandlePacket(BinaryReader reader,int whoAmI) { ... } //Do stuff with network packets
        enum PacketType : byte //Multiplayer synchronization network packet types
            ServerSendRegenToClient,     //Used when the server sends the current life regeneration value to a client
            ClientRequestRegenFromServer //Used when a client requests the current life regeneration value from the server

    Again, ExampleMod doesn't have this issue. Even if I actually copy some similar synchronization code that works in ExampleMod (or other open-source tModLoader mods) and paste it in this place, along with all of the "using" directives, it still errors when compiling.

    What annoys me and made me make this post isn't that I get an error, but that I get an error when doing the exact same thing as something else that does not get an error.
  8. jopojelly

    jopojelly Retinazer

    That method is static, it can't call GetPacket because GetPacket is not a static method
  9. Deathend

    Deathend Terrarian

    if you are using calamity + overhaul they lately dont go well in world creation, if you want to create a world with calamity remove overhaul for the world creation and add it later, also i think spirit mod is having some incompatibilities too
    worldgen previewer also crashes with calamity world gen, and since calamity makes worlds a little bigger i recomend using large world enabler to remove some issues like hell side of map being distorted
  10. Noodle Cult

    Noodle Cult Terrarian

    I've downloaded the Windows version but the application in my files is called 'tModLoaderMac' and wont run on my PC. When I troubleshoot it says its an incompatible version. So how do I get the Windows version?
  11. jopojelly

    jopojelly Retinazer

    tModLoaderMac is a file in the ModCompile folder within the downloaded zip file. You don't run that file, you run Terraria.exe from the zip. Read the readme.txt.
    Gokaiji likes this.
  12. Gokaiji

    Gokaiji Terrarian

    in the new version i have 2 problems with 2 mods ,the thorium and calamity with this mods when i select a character the terraria just crash ,and i cant play alone ,anyone can help me pls?
  13. lukebytes

    lukebytes Terrarian

    how do i update to Tmodloader 1.5? i've tried everything i could think of.
  14. Zwip-Zwap Zapony

    Zwip-Zwap Zapony Terrarian

    Is it possible to override Terraria.Main.checkHalloween() and Terraria.Main.checkXMas()? (If not, I'd like to request that to be possible.) I can't find them in the "patch" things of tModLoader's GitHub page, and I'm trying to make a mod which's sole purpose is to do stuff in those methods (while that mod currently says that those methods can't be overriden).

    Edit: Or perhaps instead of an overrideable checkHalloween() and checkXMas(), maybe some kind of new tModLoader-specific checkDate() that runs when checkHalloween() and checkXMas() usually would, or something specifically for when night passes to day naturally (and vice-versa)? Either thing would be helpful for this mod in any case.
    Last edited: Oct 20, 2018
  15. Uncle_Slime

    Uncle_Slime Terrarian

    Just out of curiosity, the ultimate apocalypse guys claim to have a 64bit Tmodloader. Does any one here know if it's possible? Since terraria it self is 32 bit and all.
  16. ImagineDarkness

    ImagineDarkness Terrarian

    Hola, tengo un problema con el Terraria, el Terraria funciona correctamente pero cuando extraigo los archivos de Modloader v0.10.1.5 me sale este error Ayuda

    Attached Files:

  17. jopojelly

    jopojelly Retinazer

  18. Kobieko_Games

    Kobieko_Games Terrarian

    what do i need to do? plz help me.(this will show up if i click on mod browser)
  19. ShadowTiger

    ShadowTiger Official Terrarian

    Does tModLoader crash on exit for anyone else? Sorry if it's been reported already. Quite a few posts to go through. Here's my crash log. It even happens with no mods enabled.

    Silently Caught Exception: Object reference not set to an instance of an object. at Terraria.ModLoader.IO.ItemIO.Save(Item item) at Terraria.ModLoader.ModCompile.<>c.<ActivateExceptionReporting>b__15_0(Object sender, FirstChanceExceptionEventArgs exceptionArgs)
    at Terraria.ModLoader.IO.ItemIO.Save(Item item)
    at Terraria.ModLoader.IO.PlayerIO.SaveInventory(Item[] inv)
    at Terraria.ModLoader.IO.WorldIO.SaveChests()
    at Terraria.ModLoader.IO.WorldIO.Save(String path, Boolean isCloudSave)
    at Terraria.IO.WorldFile.saveWorld(Boolean useCloudSaving, Boolean resetTime)
    at Terraria.WorldGen.saveAndPlayCallBack(Object threadContext)
    at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
    at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
    at System.Threading.ThreadPoolWorkQueue.Dispatch()
    at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

    It also crashes at random. No cause in particular.

    I should specify that this is a custom TerraCustom world I imported from Vanilla into tModLoader. I'll bet that would make a difference.
    Last edited: Oct 27, 2018
  20. Kobieko_Games

    Kobieko_Games Terrarian

    it does not crach for me but i just can't get to my mod browser and can't update my mods bc. of this