Standalone [1.3] tModLoader - A Modding API

Can confirm
server is gettin out of sync

console report
Error on message Terraria.MessageBuffer

happens if you hit a mod mob,open a chest and more :/
 
Can confirm
server is gettin out of sync

console report
Error on message Terraria.MessageBuffer

happens if you hit a mod mob,open a chest and more :/
So on hitting an NPC/opening a chest, the server console gets the MessageBuffer error but doesn't crash?

Thanks! This helps a lot; hopefully I'll be able to track down the problem soon.
 
So on hitting an NPC/opening a chest, the server console gets the MessageBuffer error but doesn't crash?

Thanks! This helps a lot; hopefully I'll be able to track down the problem soon.
Nope no crash
as an example
if you loot a chest the server gives the "Error on message Terraria.MessageBuffer" out and some of the chest loot will respawn in it after closing the chest and reopen it
or if you put something in a chest,the server also gives out the msg and some loot will despawn or the char will not be saved right if you leave the server
 
I know I have asked this question already :sigh:but... I've been stuck for a while making a projectile have gravity. I've done some research, but everything I tried has not worked. So how do you make a projectile have gravity?
 
I'm currently having the issue of other players not being able to see me and not able to open their inventory or chat in multiplayer
 
I know I have asked this question already :sigh:but... I've been stuck for a while making a projectile have gravity. I've done some research, but everything I tried has not worked. So how do you make a projectile have gravity?
Have you tried updating the projectile's velocity by adding 0.9f (If I recall the gravity constant in Terraria correctly...) to it like this in the AI portion of your projectile?

Code:
public override void AI()
{
   projectile.velocity.Y += 0.9f; //Positive is down and negative is up, forget the reason behind this though.
}
 
Hey, Ethan again. I was getting ready to play some modded Terraria with a couple of pals when one reported some errors occurring with The Thorium Mod. As far as I can tell, it's not with the mod itself, but rather with the way the sound is being used. Terraria sounds already refuse to work on his computer (sound & ambient sliders have no effect on sound, music slider just resets back to 0% whenever he changes it, we haven't found a fix), and I'm guessing that's what's causing it, as no one else has the problem. Here's the report:

An unexpected error has occurred.
at Microsoft.Xna.Framework.Audio.SoundEffect.AllocateFormatAndData(Byte[] format, Byte[] data, Int32 offset, Int32 count)
at Microsoft.Xna.Framework.Audio.SoundEffect..ctor(Stream stream)
at Microsoft.Xna.Framework.Audio.SoundEffect.FromStream(Stream stream)
at Terraria.ModLoader.ModLoader.LoadMod(TmodFile modFile, BuildProperties properties)
at Terraria.ModLoader.ModLoader.LoadMods()


Any ideas?

Edit: @bluemagic123 you there? Sorry to spam you requests for help, but I'm out of ideas here. We've tried everything there is.
 
Last edited:
Big dupe bug in multiplayer showing up with Chests and the Loot All button. If you have multiple slots filled with items, hitting the loot all button will give you all the items but reopening the chest will have all the items still there except the first slot that was previously filled. Can be repeated ad nauseam to achieve literally infinite of any item so far tested.

This seems like a server issue and there are NO mod items involved so I'm assuming this is the right place to make this known. Can anyone else confirm?
 
Big dupe bug in multiplayer showing up with Chests and the Loot All button. If you have multiple slots filled with items, hitting the loot all button will give you all the items but reopening the chest will have all the items still there except the first slot that was previously filled. Can be repeated ad nauseam to achieve literally infinite of any item so far tested.

This seems like a server issue and there are NO mod items involved so I'm assuming this is the right place to make this known. Can anyone else confirm?
I can confirm this, because I believe I have found the bug that causes chests to act wacky. It might be tough for me to come up with an efficient solution, but I have a general idea of how to fix it.
 
When I updated my Tmodloader to the current version V7.1.1 my custom accessorie gives me this error when I try to load my mod.
Item SpeedBoots uses an old UpdateAccessory hook
at Terraria.ModLoader.Mod.AddItem(String name, ModItem item, String texture)
at Terraria.ModLoader.Mod.AutoloadItem(Type type)
at Terraria.ModLoader.Mod.Autoload()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

Here is the code if it helps
Code:
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace EpicnessMod.Items.Accessories
{
    public class SpeedBoots : ModItem
    {
        public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
        {
            equips.Add(EquipType.Shoes);
            return true;
        }

        public override void SetDefaults()
        {
            item.name = "Speed Boots";
            item.width = 10;
            item.height = 14;
            item.toolTip = "Allows the wearer to run extremely fast.";
            item.toolTip2 = "Allows flight.";
            item.value = 1300;
            item.rare = 3;
            item.accessory = true;
        }
  public override void AddRecipes()
        {
                ModRecipe recipe = new ModRecipe(mod);
                recipe.AddIngredient(ItemID.SoulofFlight, 20);
                recipe.AddIngredient(ItemID.SpectreBoots, 1);
                recipe.AddTile(null, "SuperWoodAnvil");
                recipe.SetResult(this);
                recipe.AddRecipe();
        }
        public override void UpdateAccessory(Player player)
        {
            player.noFallDmg = true;
            player.canRocket = true;
            player.rocketTime = 1200;
            player.rocketBoots = 1;
            player.rocketTimeMax = 1200;
            if (player.controlLeft)
    {
        if (player.velocity.X > -5f) player.velocity.X -= 0.29f;
        if (player.velocity.X < -5f && player.velocity.X > -10)
        {
            player.velocity.X -= 0.29f;
        }
    }
    if (player.controlRight)
    {
        if (player.velocity.X < 5f) player.velocity.X += 0.29f;
        if (player.velocity.X > 5f && player.velocity.X < 10)
        {
            player.velocity.X += 0.29f;
        }
    }
        }

       
}
}
 
When I updated my Tmodloader to the current version V7.1.1 my custom accessorie gives me this error when I try to load my mod.
Item SpeedBoots uses an old UpdateAccessory hook
at Terraria.ModLoader.Mod.AddItem(String name, ModItem item, String texture)
at Terraria.ModLoader.Mod.AutoloadItem(Type type)
at Terraria.ModLoader.Mod.Autoload()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

Here is the code if it helps
Code:
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace EpicnessMod.Items.Accessories
{
    public class SpeedBoots : ModItem
    {
        public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
        {
            equips.Add(EquipType.Shoes);
            return true;
        }

        public override void SetDefaults()
        {
            item.name = "Speed Boots";
            item.width = 10;
            item.height = 14;
            item.toolTip = "Allows the wearer to run extremely fast.";
            item.toolTip2 = "Allows flight.";
            item.value = 1300;
            item.rare = 3;
            item.accessory = true;
        }
  public override void AddRecipes()
        {
                ModRecipe recipe = new ModRecipe(mod);
                recipe.AddIngredient(ItemID.SoulofFlight, 20);
                recipe.AddIngredient(ItemID.SpectreBoots, 1);
                recipe.AddTile(null, "SuperWoodAnvil");
                recipe.SetResult(this);
                recipe.AddRecipe();
        }
        public override void UpdateAccessory(Player player)
        {
            player.noFallDmg = true;
            player.canRocket = true;
            player.rocketTime = 1200;
            player.rocketBoots = 1;
            player.rocketTimeMax = 1200;
            if (player.controlLeft)
    {
        if (player.velocity.X > -5f) player.velocity.X -= 0.29f;
        if (player.velocity.X < -5f && player.velocity.X > -10)
        {
            player.velocity.X -= 0.29f;
        }
    }
    if (player.controlRight)
    {
        if (player.velocity.X < 5f) player.velocity.X += 0.29f;
        if (player.velocity.X > 5f && player.velocity.X < 10)
        {
            player.velocity.X += 0.29f;
        }
    }
        }

      
}
}
In 0.7.1 new method:
public override void UpdateAccessory(Player player, bool hideVisual)
 
I know it's nearly impossible but I would really really enjoy (along with a lot of players) having new dimensions in Terraria. It would greatly extend the game and open up a whole new world of options.

I was just curious if it was possible and what the logistics behind it was.
 
Any guide how to add world generation (ores)? Also my ModWorld seems to be broken:

ccP4dc2.png


Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria.ModLoader;
using Terraria;
using System.IO;

namespace TrueEternity
{
    class TEWorld : ModWorld
    {
        private const int saveVersion = 0;
        public bool isSuperhardmode = false;

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

        public override void SaveCustomData(BinaryWriter writer)
        {
            writer.Write(saveVersion);
            byte flags = 0;
            if (isSuperhardmode)
            {
                flags |= 1;
            }
            /*if (moreStuff)
            {
                flags |= 2;
            }
            writer.Write(flags);*/
        }

        public override void LoadCustomData(BinaryReader reader)
        {
            reader.ReadInt32();
            byte flags = reader.ReadByte();
            isSuperhardmode = ((flags & 1) == 1);
            //moreStuff = ((flags & 2) == 2);
        }
    }
}
 
Any guide how to add world generation (ores)? Also my ModWorld seems to be broken:

ccP4dc2.png


Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria.ModLoader;
using Terraria;
using System.IO;

namespace TrueEternity
{
    class TEWorld : ModWorld
    {
        private const int saveVersion = 0;
        public bool isSuperhardmode = false;

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

        public override void SaveCustomData(BinaryWriter writer)
        {
            writer.Write(saveVersion);
            byte flags = 0;
            if (isSuperhardmode)
            {
                flags |= 1;
            }
            /*if (moreStuff)
            {
                flags |= 2;
            }
            writer.Write(flags);*/
        }

        public override void LoadCustomData(BinaryReader reader)
        {
            reader.ReadInt32();
            byte flags = reader.ReadByte();
            isSuperhardmode = ((flags & 1) == 1);
            //moreStuff = ((flags & 2) == 2);
        }
    }
}
Looks like you either have a pre 0.7.1 Terraria.exe or a pre 0.7.1 TerrariaMac.exe.

Here is ore generation:
Code:
        public override void PostWorldGen()
        {
            for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 6E-05); k++)
            {
                WorldGen.TileRunner(WorldGen.genRand.Next(0, Main.maxTilesX), WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY), (double)WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(2, 6), mod.TileType("CoalOre"), false, 0f, 0f, false, true);
            }
        }
[DOUBLEPOST=1456561663,1456561555][/DOUBLEPOST]
Is it possible to make an item or accessory that works as a substitute to a crafting material(like wood) but is never consumed?

So if I equip it I don't need wood in crafting at all. Like with Alchemy Station that reduces the amount of crafting items to be used by 33.3% but instead with a 100% reducion of a certain material.
I can't think of how to make that work.
[DOUBLEPOST=1456561682][/DOUBLEPOST]
How to add custom background?
You can't yet.
[DOUBLEPOST=1456561946][/DOUBLEPOST]
Hey, Ethan again. I was getting ready to play some modded Terraria with a couple of pals when one reported some errors occurring with The Thorium Mod. As far as I can tell, it's not with the mod itself, but rather with the way the sound is being used. Terraria sounds already refuse to work on his computer (sound & ambient sliders have no effect on sound, music slider just resets back to 0% whenever he changes it, we haven't found a fix), and I'm guessing that's what's causing it, as no one else has the problem. Here's the report:

An unexpected error has occurred.
at Microsoft.Xna.Framework.Audio.SoundEffect.AllocateFormatAndData(Byte[] format, Byte[] data, Int32 offset, Int32 count)
at Microsoft.Xna.Framework.Audio.SoundEffect..ctor(Stream stream)
at Microsoft.Xna.Framework.Audio.SoundEffect.FromStream(Stream stream)
at Terraria.ModLoader.ModLoader.LoadMod(TmodFile modFile, BuildProperties properties)
at Terraria.ModLoader.ModLoader.LoadMods()


Any ideas?

Edit: @bluemagic123 you there? Sorry to spam you requests for help, but I'm out of ideas here. We've tried everything there is.
Sounds like a problem with the computer, since vanilla Terraria sounds don't work. I'd suggest reinstalling XNA, maybe even windows media player.
[DOUBLEPOST=1456562340][/DOUBLEPOST]
I know it's nearly impossible but I would really really enjoy (along with a lot of players) having new dimensions in Terraria. It would greatly extend the game and open up a whole new world of options.

I was just curious if it was possible and what the logistics behind it was.

Terraria has a 2d array of tiles that represent the world, and it is initialized to the size of the world. Where would the alternate dimension fix in there? How would a server handle 2 players being in different dimensions when in reality they are right next to each other.(Their X Y positions)

Anyway, I managed something like this before, but I never went farther with the idea since I was certain it would end poorly:
 
I've been trying to get some aspects of my mod working on with a server. I've been using "Main.NewText("something");" and "Console.WriteLine("something else");" to see what does and doesn't happen, and I've noticed some odd things.

When I use an item, the UseItem hook isn't called on the owner in singleplayer or the owner's client in multiplayer, but it is called on the server and other clients. I've also noticed that the Shoot hook is only called on the client of the item's owner, but not other clients or the server.

Are these bugs or intentional behaviour?
 
Back
Top Bottom