tModLoader Official tModLoader Help Thread

qcumber

Terrarian
When I run this mod I get "object reference not set to an instance of an object" if you can help me please do thanks.

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace testMod.items
{
public class SuperBow : ModItem
{
public override void AutoStaticDefaults()
{
DisplayName.SetDefault("SuperBow");
Tooltip.SetDefault("Super Good!");
}

public override void SetDefaults()
{
item.damage = 100000;
//item.ranged = true;
item.width = 32;
item.height = 54;
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 5;
item.noMelee = true;
item.knockBack = 4;
item.value = 10000;
item.rare = 2;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
item.shoot = 10;
item.shootSpeed = 16f;
item.useAmmo = ProjectileID.WoodenArrowFriendly;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 10);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
 

BowAndEros

Terrarian
tModLoader doesn't work for me whatsoever, and none of the fixes I've followed seem to fix it.

I'm trying to download Calamity, both without and with music, but whenever I click the download for either option, the empty loading bar appears for a split second, and then I get put back onto the Mod Browser. The mods won't download. The rest of tModLoader works perfectly fine, it's literally just the Mod Browser that won't work.

I'm using a MacBook os High Sierra on Version 10.13.6, using tModLoader v0.11.8.6 for Terraria v1.3.5.3

I've checked to make sure the tModLoader files are on my computer, and they are. The Mods folder is right where it should be, and is empty.
I've tried using the tModLoader Mod Browser Mirror, but the site won't open and gets stuck trying too. This is true on both Safari and Chrome.
Turning on Experimental Features doesn't change anything, let alone fix it.

I've posted a separate forum asking about just having someone provide the files for the Calamity Mod because it seems like it'll work if I do it manually, but I'd prefer to also just have the site work in the future so I won't have to come here and ask for mod files every time I want/need them.
 

TheEmeraldSloth

Terrarian
Whenever I try to add the projectile for the spear I am making, this error shows up. I don't know what to do. Please help. I already checked all my projectiles folders and made sure they were in the correct place. Thank you in advance.

C#:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;

namespace WeaponsofMyth.Projectiles
{
    public class RuyiJinguBangProjectile : ModProjectile
    {
        public override void SetStaticDefaults() {
            DisplayName.SetDefault("Spear");
        }

        public override void SetDefaults() {
            projectile.width = 32;
            projectile.height = 32;
            projectile.aiStyle = 19;
            projectile.penetrate = -1;
            projectile.scale = 2.3f;
            projectile.alpha = 0;

            projectile.hide = true;
            projectile.ownerHitCheck = true;
            projectile.melee = true;
            projectile.tileCollide = false;
            projectile.friendly = true;
        }

        // In here the AI uses this example, to make the code more organized and readable
        // Also showcased in ExampleJavelinProjectile.cs
        public float movementFactor // Change this value to alter how fast the spear moves
        {
            get => projectile.ai[0];
            set => projectile.ai[0] = value;
        }

        // It appears that for this AI, only the ai0 field is used!
        public override void AI() {
            // Since we access the owner player instance so much, it's useful to create a helper local variable for this
            // Sadly, Projectile/ModProjectile does not have its own
            Player projOwner = Main.player[projectile.owner];
            // Here we set some of the projectile's owner properties, such as held item and itemtime, along with projectile direction and position based on the player
            Vector2 ownerMountedCenter = projOwner.RotatedRelativePoint(projOwner.MountedCenter, true);
            projectile.direction = projOwner.direction;
            projOwner.heldProj = projectile.whoAmI;
            projOwner.itemTime = projOwner.itemAnimation;
            projectile.position.X = ownerMountedCenter.X - (float)(projectile.width / 2);
            projectile.position.Y = ownerMountedCenter.Y - (float)(projectile.height / 2);
            // As long as the player isn't frozen, the spear can move
            if (!projOwner.frozen) {
                if (movementFactor == 0f) // When initially thrown out, the ai0 will be 0f
                {
                    movementFactor = 3f; // Make sure the spear moves forward when initially thrown out
                    projectile.netUpdate = true; // Make sure to netUpdate this spear
                }
                if (projOwner.itemAnimation < projOwner.itemAnimationMax / 3) // Somewhere along the item animation, make sure the spear moves back
                {
                    movementFactor -= 2.4f;
                }
                else // Otherwise, increase the movement factor
                {
                    movementFactor += 2.1f;
                }
            }
            // Change the spear position based off of the velocity and the movementFactor
            projectile.position += projectile.velocity * movementFactor;
            // When we reach the end of the animation, we can kill the spear projectile
            if (projOwner.itemAnimation == 0) {
                projectile.Kill();
            }
            // Apply proper rotation, with an offset of 135 degrees due to the sprite's rotation, notice the usage of MathHelper, use this class!
            // MathHelper.ToRadians(xx degrees here)
            projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(135f);
            // Offset by 90 degrees here
            if (projectile.spriteDirection == -1) {
                projectile.rotation -= MathHelper.ToRadians(90f);
            }
        }
    }
}
 

Attachments

  • Screenshot (157).png
    Screenshot (157).png
    989.6 KB · Views: 43

Solo-Ion

Dungeon Spirit
T
tModLoader doesn't work for me whatsoever, and none of the fixes I've followed seem to fix it.

I'm trying to download Calamity, both without and with music, but whenever I click the download for either option, the empty loading bar appears for a split second, and then I get put back onto the Mod Browser. The mods won't download. The rest of tModLoader works perfectly fine, it's literally just the Mod Browser that won't work.

I'm using a MacBook os High Sierra on Version 10.13.6, using tModLoader v0.11.8.6 for Terraria v1.3.5.3

I've checked to make sure the tModLoader files are on my computer, and they are. The Mods folder is right where it should be, and is empty.
I've tried using the tModLoader Mod Browser Mirror, but the site won't open and gets stuck trying too. This is true on both Safari and Chrome.
Turning on Experimental Features doesn't change anything, let alone fix it.

I've posted a separate forum asking about just having someone provide the files for the Calamity Mod because it seems like it'll work if I do it manually, but I'd prefer to also just have the site work in the future so I won't have to come here and ask for mod files every time I want/need them.
That sounds like it could be a firewall wall problem. Have you tried temporarily turning off your firewall or anti virus?
 

BowAndEros

Terrarian
T

That sounds like it could be a firewall wall problem. Have you tried temporarily turning off your firewall or anti virus?
My firewall has always been off and I have no anti-virus. Strangely, I tried the mirror site again and it opens now, but still seems unable to download anything
 
Whenever I try to add the projectile for the spear I am making, this error shows up. I don't know what to do. Please help. I already checked all my projectiles folders and made sure they were in the correct place. Thank you in advance.

C#:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;

namespace WeaponsofMyth.Projectiles
{
    public class RuyiJinguBangProjectile : ModProjectile
    {
        public override void SetStaticDefaults() {
            DisplayName.SetDefault("Spear");
        }

        public override void SetDefaults() {
            projectile.width = 32;
            projectile.height = 32;
            projectile.aiStyle = 19;
            projectile.penetrate = -1;
            projectile.scale = 2.3f;
            projectile.alpha = 0;

            projectile.hide = true;
            projectile.ownerHitCheck = true;
            projectile.melee = true;
            projectile.tileCollide = false;
            projectile.friendly = true;
        }

        // In here the AI uses this example, to make the code more organized and readable
        // Also showcased in ExampleJavelinProjectile.cs
        public float movementFactor // Change this value to alter how fast the spear moves
        {
            get => projectile.ai[0];
            set => projectile.ai[0] = value;
        }

        // It appears that for this AI, only the ai0 field is used!
        public override void AI() {
            // Since we access the owner player instance so much, it's useful to create a helper local variable for this
            // Sadly, Projectile/ModProjectile does not have its own
            Player projOwner = Main.player[projectile.owner];
            // Here we set some of the projectile's owner properties, such as held item and itemtime, along with projectile direction and position based on the player
            Vector2 ownerMountedCenter = projOwner.RotatedRelativePoint(projOwner.MountedCenter, true);
            projectile.direction = projOwner.direction;
            projOwner.heldProj = projectile.whoAmI;
            projOwner.itemTime = projOwner.itemAnimation;
            projectile.position.X = ownerMountedCenter.X - (float)(projectile.width / 2);
            projectile.position.Y = ownerMountedCenter.Y - (float)(projectile.height / 2);
            // As long as the player isn't frozen, the spear can move
            if (!projOwner.frozen) {
                if (movementFactor == 0f) // When initially thrown out, the ai0 will be 0f
                {
                    movementFactor = 3f; // Make sure the spear moves forward when initially thrown out
                    projectile.netUpdate = true; // Make sure to netUpdate this spear
                }
                if (projOwner.itemAnimation < projOwner.itemAnimationMax / 3) // Somewhere along the item animation, make sure the spear moves back
                {
                    movementFactor -= 2.4f;
                }
                else // Otherwise, increase the movement factor
                {
                    movementFactor += 2.1f;
                }
            }
            // Change the spear position based off of the velocity and the movementFactor
            projectile.position += projectile.velocity * movementFactor;
            // When we reach the end of the animation, we can kill the spear projectile
            if (projOwner.itemAnimation == 0) {
                projectile.Kill();
            }
            // Apply proper rotation, with an offset of 135 degrees due to the sprite's rotation, notice the usage of MathHelper, use this class!
            // MathHelper.ToRadians(xx degrees here)
            projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(135f);
            // Offset by 90 degrees here
            if (projectile.spriteDirection == -1) {
                projectile.rotation -= MathHelper.ToRadians(90f);
            }
        }
    }
}
Based off the example mod example bullet, the Projectile is supposed to have a uppercase p.
 

Spelunkaria

Terrarian
I keep getting this error when I run my mod. Can the error be found just by looking at client.log?

Code:
[16:16:15] [1/ERROR] [Terraria]: System.InvalidOperationException: Begin cannot be called again until End has been successfully called.
   at Microsoft.Xna.Framework.Graphics.SpriteBatch.Begin(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix transformMatrix)
   at Terraria.Main.RenderBackground()
   at Terraria.Main.DoDraw(GameTime gameTime)
   at Terraria.Main.Draw(GameTime gameTime)
[16:16:16] [1/FATAL] [Terraria]: Main engine crash
System.InvalidOperationException: Begin cannot be called again until End has been successfully called.
   at Microsoft.Xna.Framework.Graphics.SpriteBatch.Begin(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix transformMatrix)
   at Terraria.Main.RenderBackground()
   at Terraria.Main.DoDraw(GameTime gameTime)
   at Terraria.Main.Draw(GameTime gameTime)
   at Microsoft.Xna.Framework.Game.DrawFrame()
   at Microsoft.Xna.Framework.Game.Tick()
   at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)
   at Microsoft.Xna.Framework.GameHost.OnIdle()
   at Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame()
   at Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e)
   at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at Microsoft.Xna.Framework.WindowsGameHost.Run()
   at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
   at Terraria.Program.LaunchGame_()
 

Spazmatism7

Spazmatism
C#:
Projectile.NewProjectile(npc.Center, new Vector2(12, 0).RotatedBy(npc.rotation), mod.ProjectileType("Fireball"), damageFireball, 3f, Main.myPlayer);

My projectile is shooting backwards
 

mmtb1mv

Terrarian
Hello, I am having some issues with Tmodloader 64 bit and that it takes all of my computers memory, is there any kind of way to limit the amount of memory tmodloader 64 bit uses?
 

Sorio

Terrarian
Hello tmodloader shows this message when i boot it, i tried to disable mods but it didn't work, game crashs.

Code:
[12:08:30] [1/INFO] [tML]: Checking Steam installation...
[12:08:30] [1/INFO] [tML]: Steam installation OK.
[12:08:30] [1/INFO] [Terraria]: Found Terraria steamapp install at: D:\steam\steamapps\common\Terraria
[12:08:30] [1/INFO] [Terraria]: Steam Cloud Quota: 152.6 MB available
[12:08:31] [1/DEBUG] [Terraria]: Graphics Device: Radeon RX 580 Series {Width:1920 Height:1080 Format:Color AspectRatio:1.777778}
[12:08:31] [1/DEBUG] [Terraria]: Device Reset, Profile: Reach -> HiDef, Width: 800, Height: 480, Fullscreen: False, Display: \\.\DISPLAY1
[12:08:32] [1/INFO] [Terraria]: Loaded 1000 vanilla assets
[12:08:32] [1/INFO] [Terraria]: Loaded 2000 vanilla assets
[12:08:33] [1/INFO] [Terraria]: Loaded 3000 vanilla assets
[12:08:33] [1/INFO] [Terraria]: Loaded 4000 vanilla assets
[12:08:33] [1/WARN] [tML]: Silently Caught Exception:
System.InvalidOperationException: Error decompressing content data.
   at Microsoft.Xna.Framework.Content.DecompressStream.DecompressNextBuffer()
   at Microsoft.Xna.Framework.Content.DecompressStream.ReadByte()
   at System.IO.BinaryReader.ReadByte()
   at System.IO.BinaryReader.Read7BitEncodedInt()
   at Microsoft.Xna.Framework.Content.ContentReader.ReadHeader()
   at Microsoft.Xna.Framework.Content.ContentReader.ReadAsset[T]()
   at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[T](String assetName, Action`1 recordDisposableObject)
   at Microsoft.Xna.Framework.Content.ContentManager.Load[T](String assetName)
   at Terraria.ModLoader.Engine.TMLContentManager.Load[T](String assetName)
   at Terraria.Main.OurLoad[T](String path)
   at Terraria.Main.LoadTextures()
   at Terraria.Main.LoadContent()
   at Microsoft.Xna.Framework.Game.DeviceCreated(Object sender, EventArgs e)
   at Microsoft.Xna.Framework.GraphicsDeviceManager.OnDeviceCreated(Object sender, EventArgs args)
   at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice(GraphicsDeviceInformation newInfo)
   at Microsoft.Xna.Framework.GraphicsDeviceManager.ChangeDevice(Boolean forceCreate)
   at Terraria.Main.SetGraphicsProfileInternal()
   at Terraria.Main.SetGraphicsProfile(GraphicsProfile profile)
   at Terraria.Main.LoadContent()
   at Microsoft.Xna.Framework.Game.Initialize()
   at Terraria.Main.ClientInitialize()
   at Terraria.Main.Initialize()
   at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
   at Terraria.Program.LaunchGame_()
   at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)
   at Terraria.WindowsLaunch.Main(String[] args)

[12:08:33] [1/FATAL] [Terraria]: Main engine crash
System.InvalidOperationException: Error decompressing content data.
   at Microsoft.Xna.Framework.Content.DecompressStream.DecompressNextBuffer()
   at Microsoft.Xna.Framework.Content.DecompressStream.ReadByte()
   at System.IO.BinaryReader.ReadByte()
   at System.IO.BinaryReader.Read7BitEncodedInt()
   at Microsoft.Xna.Framework.Content.ContentReader.ReadHeader()
   at Microsoft.Xna.Framework.Content.ContentReader.ReadAsset[T]()
   at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[T](String assetName, Action`1 recordDisposableObject)
   at Microsoft.Xna.Framework.Content.ContentManager.Load[T](String assetName)
   at Terraria.ModLoader.Engine.TMLContentManager.Load[T](String assetName)
   at Terraria.Main.OurLoad[T](String path)
   at Terraria.Main.LoadTextures()
   at Terraria.Main.LoadContent()
   at Microsoft.Xna.Framework.Game.DeviceCreated(Object sender, EventArgs e)
   at Microsoft.Xna.Framework.GraphicsDeviceManager.OnDeviceCreated(Object sender, EventArgs args)
   at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice(GraphicsDeviceInformation newInfo)
   at Microsoft.Xna.Framework.GraphicsDeviceManager.ChangeDevice(Boolean forceCreate)
   at Terraria.Main.SetGraphicsProfileInternal()
   at Terraria.Main.SetGraphicsProfile(GraphicsProfile profile)
   at Terraria.Main.LoadContent()
   at Microsoft.Xna.Framework.Game.Initialize()
   at Terraria.Main.ClientInitialize()
   at Terraria.Main.Initialize()
   at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
   at Terraria.Program.LaunchGame_()
 
Last edited:

Solo-Ion

Dungeon Spirit
Hello tmodloader shows this message when i boot it, i tried to disable mods but it didn't work, game crashs.

Code:
[12:08:30] [1/INFO] [tML]: Checking Steam installation...
[12:08:30] [1/INFO] [tML]: Steam installation OK.
[12:08:30] [1/INFO] [Terraria]: Found Terraria steamapp install at: D:\steam\steamapps\common\Terraria
[12:08:30] [1/INFO] [Terraria]: Steam Cloud Quota: 152.6 MB available
[12:08:31] [1/DEBUG] [Terraria]: Graphics Device: Radeon RX 580 Series {Width:1920 Height:1080 Format:Color AspectRatio:1.777778}
[12:08:31] [1/DEBUG] [Terraria]: Device Reset, Profile: Reach -> HiDef, Width: 800, Height: 480, Fullscreen: False, Display: \\.\DISPLAY1
[12:08:32] [1/INFO] [Terraria]: Loaded 1000 vanilla assets
[12:08:32] [1/INFO] [Terraria]: Loaded 2000 vanilla assets
[12:08:33] [1/INFO] [Terraria]: Loaded 3000 vanilla assets
[12:08:33] [1/INFO] [Terraria]: Loaded 4000 vanilla assets
[12:08:33] [1/WARN] [tML]: Silently Caught Exception:
System.InvalidOperationException: Error decompressing content data.
   at Microsoft.Xna.Framework.Content.DecompressStream.DecompressNextBuffer()
   at Microsoft.Xna.Framework.Content.DecompressStream.ReadByte()
   at System.IO.BinaryReader.ReadByte()
   at System.IO.BinaryReader.Read7BitEncodedInt()
   at Microsoft.Xna.Framework.Content.ContentReader.ReadHeader()
   at Microsoft.Xna.Framework.Content.ContentReader.ReadAsset[T]()
   at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[T](String assetName, Action`1 recordDisposableObject)
   at Microsoft.Xna.Framework.Content.ContentManager.Load[T](String assetName)
   at Terraria.ModLoader.Engine.TMLContentManager.Load[T](String assetName)
   at Terraria.Main.OurLoad[T](String path)
   at Terraria.Main.LoadTextures()
   at Terraria.Main.LoadContent()
   at Microsoft.Xna.Framework.Game.DeviceCreated(Object sender, EventArgs e)
   at Microsoft.Xna.Framework.GraphicsDeviceManager.OnDeviceCreated(Object sender, EventArgs args)
   at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice(GraphicsDeviceInformation newInfo)
   at Microsoft.Xna.Framework.GraphicsDeviceManager.ChangeDevice(Boolean forceCreate)
   at Terraria.Main.SetGraphicsProfileInternal()
   at Terraria.Main.SetGraphicsProfile(GraphicsProfile profile)
   at Terraria.Main.LoadContent()
   at Microsoft.Xna.Framework.Game.Initialize()
   at Terraria.Main.ClientInitialize()
   at Terraria.Main.Initialize()
   at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
   at Terraria.Program.LaunchGame_()
   at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)
   at Terraria.WindowsLaunch.Main(String[] args)

[12:08:33] [1/FATAL] [Terraria]: Main engine crash
System.InvalidOperationException: Error decompressing content data.
   at Microsoft.Xna.Framework.Content.DecompressStream.DecompressNextBuffer()
   at Microsoft.Xna.Framework.Content.DecompressStream.ReadByte()
   at System.IO.BinaryReader.ReadByte()
   at System.IO.BinaryReader.Read7BitEncodedInt()
   at Microsoft.Xna.Framework.Content.ContentReader.ReadHeader()
   at Microsoft.Xna.Framework.Content.ContentReader.ReadAsset[T]()
   at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[T](String assetName, Action`1 recordDisposableObject)
   at Microsoft.Xna.Framework.Content.ContentManager.Load[T](String assetName)
   at Terraria.ModLoader.Engine.TMLContentManager.Load[T](String assetName)
   at Terraria.Main.OurLoad[T](String path)
   at Terraria.Main.LoadTextures()
   at Terraria.Main.LoadContent()
   at Microsoft.Xna.Framework.Game.DeviceCreated(Object sender, EventArgs e)
   at Microsoft.Xna.Framework.GraphicsDeviceManager.OnDeviceCreated(Object sender, EventArgs args)
   at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice(GraphicsDeviceInformation newInfo)
   at Microsoft.Xna.Framework.GraphicsDeviceManager.ChangeDevice(Boolean forceCreate)
   at Terraria.Main.SetGraphicsProfileInternal()
   at Terraria.Main.SetGraphicsProfile(GraphicsProfile profile)
   at Terraria.Main.LoadContent()
   at Microsoft.Xna.Framework.Game.Initialize()
   at Terraria.Main.ClientInitialize()
   at Terraria.Main.Initialize()
   at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
   at Terraria.Program.LaunchGame_()
I'm guessing a bit here, but you could try verifying Terraria's & tModLoader's game files.
 
Last edited:

TimeAndSpace_

Terrarian
hello, so after a few minutes I enter my world this error message happens and i don't know what to do. Help pls?
 

Attachments

  • Immagine 2022-03-17 234033.png
    Immagine 2022-03-17 234033.png
    38.4 KB · Views: 24

yes_yes123

Terrarian
Hi, so tmodloader has been lagging more and more the further I progress through the game. I get fps ranging from 60 to 20. Ive tried loads of solutions and nothing has worked. Ive tried setting the affinity and deselecting cores 0 - 3, reinstalling the game, deleting the config file, uninstalling mods.

My specs:
CPU - Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz
RAM - 32GB
GPU - GeForce gtx 1080

Any suggestion would be appreciated thx
 
Last edited:

Fish.

Terrarian
so, I updated Calamity recently, and for some reason Fargo's mutant mod isn't working anymore, if anyone cold help I'd be really grateful
image_2022-03-23_202852.png
 

Mangochicken

Terrarian
so, I updated Calamity recently, and for some reason Fargo's mutant mod isn't working anymore, if anyone cold help I'd be really gratefulView attachment 360997
you'll either need to downgrade calamity, or briefly turn off fargo's souls dlc. Depending on what version of calamity you just updated to some items have been removed, so fargos souls dlc cant access them properly anymore
 

Fish.

Terrarian
you'll either need to downgrade calamity, or briefly turn off fargo's souls dlc. Depending on what version of calamity you just updated to some items have been removed, so fargos souls dlc cant access them properly anymore
ok, i upgraded to calamity 1.5.1, i was used to having trouble with fargo's mutant mod that i skipped over it saying fargo's souls dlc, lol, but thank you for the help
 

NotEvilBen

Terrarian
I'm trying to create some custom trees, pretty much just copying the code from ExampleMod, but it's not working. I'm trying to get trees to grow on vanilla tiles (in this case stone) and I have the acorn item working, I get a correct ghostly image of the correct sapling when it's selected, when I try to click an invalid tile nothing happens...that stuff is all working as intended. But when I click above a stone tile to place the sapling there, it shows the animation of placing the block, uses up the item, and nothing appears. This mod goes across several classes and I'm not sure which one the problem is in.

First, the item seems to work okay except that the sapling never appears:
Code:
using Terraria.ModLoader;
using Terraria.ID;

//due to constraints discovered while debugging this will probably have to be reworked into a multi-purpose acorn

namespace OreTrees.Items
{
    public class CopperAcorn : ModItem
    {
        public override void SetStaticDefaults()
        {
            Tooltip.SetDefault("An acorn made of copper.\nPlant to grow a copper tree.");
        }

        public override void SetDefaults()
        {
            //item.CloneDefaults(4851);
            //Topaz Gemcorn doesn't seem to exist in the version of Terraria that tmodloader uses
            item.width = 12;
            item.height = 12;
            item.maxStack = 999;
            item.useTurn = true;
            item.autoReuse = true;
            item.useAnimation = 15;
            item.useTime = 10;
            item.useStyle = ItemUseStyleID.SwingThrow;
            item.consumable = true;
            item.createTile = ModContent.TileType<Tiles.CopperSapling>();
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Acorn);
            recipe.AddIngredient(ItemID.CopperOre);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Then, since it's showing the ghostly preview of the correct sapling, I thought maybe this was working and the sapling tile might be the problem:
Code:
using Terraria.ModLoader;
using Terraria.ObjectData;
using Terraria.ID;
using Terraria.Enums;
using Terraria.DataStructures;
using Terraria;
//using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace OreTrees.Tiles
{
    public class CopperSapling : ModTile
    {
        public override void SetDefaults()
        {
            Main.tileFrameImportant[Type] = true;
            Main.tileNoAttach[Type] = true;
            Main.tileLavaDeath[Type] = true;

            TileObjectData.newTile.Width = 1;
            TileObjectData.newTile.Height = 2;
            TileObjectData.newTile.Origin = new Point16(0, 1);
            TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0);
            TileObjectData.newTile.UsesCustomCanPlace = true;
            TileObjectData.newTile.CoordinateHeights = new[] { 16, 18 };
            TileObjectData.newTile.CoordinateWidth = 16;
            TileObjectData.newTile.CoordinatePadding = 2;
            TileObjectData.newTile.AnchorValidTiles = new int[] { TileID.Stone, TileID.Ebonstone, TileID.Crimstone };
            //TileObjectData.newTile.AnchorValidTiles = new int[] { TileID.Grass };
            TileObjectData.newTile.StyleHorizontal = true;
            TileObjectData.newTile.DrawFlipHorizontal = true;
            TileObjectData.newTile.WaterPlacement = LiquidPlacement.NotAllowed;
            TileObjectData.newTile.LavaDeath = true;
            TileObjectData.newTile.RandomStyleRange = 3;
            TileObjectData.newTile.StyleMultiplier = 3;
            //TileObjectData.newSubTile.CopyFrom(TileObjectData.newTile);
            //TileObjectData.newSubTile.AnchorValidTiles = new int[] { TileID.Sand };
            //TileObjectData.addSubTile(1);
            TileObjectData.addTile(Type);
            sapling = true;
            adjTiles = new int[] { TileID.Saplings };
        }

        public override void RandomUpdate(int i, int j)
        {
            if (WorldGen.genRand.Next(20) == 0)
            {
                Tile tile = Framing.GetTileSafely(i, j);
                bool growSuccess = WorldGen.GrowTree(i, j);

                bool isPlayerNear = WorldGen.PlayerLOS(i, j);

                if (growSuccess && isPlayerNear)
                    WorldGen.TreeGrowFXCheck(i, j);
            }
        }

        public override void SetSpriteEffects(int i, int j, ref SpriteEffects effects)
        {
            if (i % 2 == 1)
                effects = SpriteEffects.FlipHorizontally;
        }
    }
}

Again, most of this is copied from ExampleSapling; I guessed that the SubTile stuff has to do with palm trees and I'm not messing with that, so I commented it out just in case I need it later, but it doesn't work with or without that in there. It didn't work when RandomUpdate was empty, so I filled that in seeing if that was the problem. Same issue. My main Mod class even has a GlobalTile adding the CopperTree to stone, ebonstone, and crimstone in its Load method and it all compiles fine. I've been chasing this problem for over a week and I'm at a dead end; I've tried everything I can think to try short of decompiling the vanilla code and recreating trees from scratch. Which I really don't want to do. What am I doing wrong here?

Not shown here: the Mod class, OreTrees; also CopperTree : ModTree. Let me know if you need to see these to diagnose the problem.

Oh, and the commented out line 29 in the acorn is from an experiment when I tried seeing what happens when I just let it be placed on grass, and when I did it placed a regular tree sapling. There's definitely something I'm not getting here. I'd appreciate any insight people can give even if it's that I did a stupid typo.

Edit: I've already redone the mods with herbs instead of trees and it's beautiful, but I'd still like to know what I did wrong here.
 
Last edited:

Sc4rletz

Terrarian
having world gen problem here help ._.
the mods im playing with

Yet Another Boss Heath Bar v1.3.2
Calamity Mod Music v1.5.1.1
Calamity's Vanities v9.3
Calamity Mod v1.5.1.6
JoJo-Stands v.1.4.0.1
Max Stack Plus Extra v1.1.0.4
Localizer v1.5.0.19
Magic Storage - Extra v0.5.5.10
Wing Slot v1.8.4
Boss CheckList v1.1.6.1
Recipe Browser v0.8.9.1
Lui afk v1.0.0.130
Cheat Sheet v0.6.6.4
Magic Storage v0.4.3.6
 

Attachments

  • client.log
    274.9 KB · Views: 17
Top Bottom