Click here to Skip to main content
15,867,835 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Im interested in modding the video game "Terraria". when I tryed to mod in a pickaxe, it said that it expected a }. i typed it, and now there are like, 21 errors. heres my c# code:
C#
using TheUltimateGemAddon.Tiles;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace TheUltimateGemAddon.Items
{
    public class RubyPickaxe : ModItem
    {
        public override void SetStaticDefaults()
        {
            Tooltip.SetDefault("Forged from rubys, this pickaxe can mine stuff.");
        }

        public override void SetDefaults()
        {
            item.damage = 5;
            item.melee = true;
            item.width = 40;
            item.height = 40;
            item.useTime = 10;
            item.useAnimation = 10;
            item.pick = 80;
            item.useStyle = ItemUseStyleID.SwingThrow;
            item.knockBack = 6;
            item.value = 10000;
            item.rare = ItemRarityID.Green;
            item.UseSound = SoundID.Item1;
            item.autoReuse = true;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
]           recipe.AddIngredient(Ruby, 18);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }

        public override void MeleeEffects(Player player, Rectangle hitbox)
        {

        }
    }
}

also, here is my error:

Severity Code Description Project File Line Suppression State
Error CS1513 } expected Miscellaneous Files C:\Users\somec\Documents\My Games\Terraria\ModLoader\Mod Sources\TheUltimateGemAddon\Items\RubyPickaxe.cs 36 Active

so theres a CS1513 } expected error.

What I have tried:

adding a }. way more errors popped up.
Posted
Updated 7-Jan-21 0:54am
v2

1 solution

C#
		public override void AddRecipes()
		{
			ModRecipe recipe = new ModRecipe(mod);
			]			recipe.AddIngredient(Ruby, 18);
//          ^ What is the ] there ?
			recipe.SetResult(this);
			recipe.AddRecipe();
		}
 
Share this answer
 
v2
Comments
Luc Pattyn 6-Jan-21 17:56pm    
That looks like a wandering bracket; be careful, they tend to be dangerous.
Patrice T 6-Jan-21 18:10pm    
lol
sharkmachine22 6-Jan-21 19:19pm    
thanks. didn't mean to type that, and didn't see it.
thatraja 7-Jan-21 2:44am    
:)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900