recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.Cobweb, 10);
recipe.AddIngredient(ItemID.SlimeBlock, 5);
recipe.SetResult(null, "SlimeySilk", 1);
recipe.AddRecipe();
what do you mean by add recipes from ModItem? also can i use items i made in the mod and use them to craft things?
recipe.AddIngredient(null, "Name here", 5);
AddItem("Name here", new ClassNameHere(), "ModName/Items/Namehere");
ok thankswhat do you mean by add recipes from ModItem? also can i use items i made in the mod and use them to craft things?
ok thanks!Yes you can:
Code:recipe.AddIngredient(null, "Name here", 5);
Change 5 to the amount required
"Name here corresponds to:
Code:AddItem("Name here", new ClassNameHere(), "ModName/Items/Namehere");
SetGlobalItem(new TerrariaUnleashedItem());
AddItem("SlimeBlock", new SlimeBlock(), "TerrariaUnleashed/Items/SlimeBlock");
recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.Cobweb, 10);
recipe.AddIngredient(ItemID.SlimeBlock, 5);
recipe.SetResult(null, "SlimeySilk", 1);
recipe.AddRecipe();
Hm, can I see the code for your Mod class and your GlobalItem class?There we go, progress. fixed the recipe errors, it was a simple spelling error. Now when i do using HuntersMod.Items it says the items type or namespace does not exist, where do i call/declare items, or am i going about this the wrong way. thank you again.
Are you saying that some recipes are working but other ones aren't?Can i ask something. I've started coding my own mod. So fair everything is going well.. got crafting recipes for new items i wanna add in. they work and show up.
Now i wanna use those new items to make things with. But the recipes won't show up.. I've got them in my mod. Can see them written out but nothing in game that requires any new items. Any clues?
Example:
I mean that there will be a hook in ModItem to add recipes, to reduce the clutter in the Mod class.what do you mean by add recipes from ModItem? also can i use items i made in the mod and use them to craft things?
Hm, it's hard to tell what the problem is without the rest of the code. Several things to watch out for:I can't say if they arenb't working.
The compile doesn't show issues when making it. The recipes for anything Only using base Terraria items works fine.
But any recipes using 1 or more of my Own made items as an ingredient aren't showing up when i have the items in my inventory.
So yes the recipes aren't working
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using TerrariaUnleashed.Items;
namespace TerrariaUnleashed
{
public class TerrariaUnleashed : Mod
{
public override void SetModInfo(out string name, ref string version, ref string author)
{
name = "Terraria Unleashed";
version = "v0.0.1 Alpha Build";
author = "Dark King Joey";
}
public override void Load()
/**
This is Adding Items to Game Section
**/
{
SetGlobalItem(new GlobalItem());
AddItem("SlimeBlock", new SlimeBlock(), "TerrariaUnleashed/Items/SlimeBlock");
AddItem("SlimeAlter", new SlimeAlter(), "TerrariaUnleashed/Items/SlimeAlter");
AddItem("MBottle", new MBottle(), "TerrariaUnleashed/Items/MBottle");
AddItem("InfusedCloth", new InfusedCloth(), "TerrariaUnleashed/Items/InfusedCloth");
AddItem("InfusedLeather", new InfusedLeather(), "TerrariaUnleashed/Items/InfusedLeather");
AddItem("SlimeySilk", new SlimeySilk(), "TerrariaUnleashed/Items/SlimeySilk");
/**
AddItem("SlimeHat", new SlimeHat(), "TerrariaUnleashed/Items/Armor/SlimeHat");
AddItem("SlimeHood", new SlimeHood(), "TerrariaUnleashed/Items/Armor/SlimeHood");
AddItem("SlimeRobe", new SlimeRobe(), "TerrariaUnleashed/Items/Armor/SlimeRobe");
AddItem("SlimeLegs", new SlimeLegs(), "TerrariaUnleashed/Items/Armor/SlimeLegs");
AddEquipTexture(EquipType.Head, SlimeHat.texture);
AddEquipTexture(EquipType.Head, SlimeHood.texture);
AddEquipTexture(EquipType.Body, SlimeRobe.texture, SlimeRobe.armTexture, SlimeRobe.femaleTexture);
AddEquipTexture(EquipType.Legs, SlimeLegs.texture);
**/
}
public override void AddRecipes()
{
ModRecipe
recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.DirtBlock, 1);
recipe.AddIngredient(ItemID.Gel, 1);
recipe.SetResult(null, "SlimeBlock", 10);
recipe.AddRecipe();
recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.ManaPotion, 10);
recipe.SetResult(null, "MBottle", 1);
recipe.AddRecipe();
/**
recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.SlimeBlock, 5);
recipe.AddIngredient(ItemID.StoneBlock, 5);
recipe.AddIngredient(ItemID.Wood, 5);
recipe.SetResult(null, "SlimeAlter", 1);
recipe.AddRecipe();
recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.Leather, 2);
recipe.AddIngredient(ItemID.MBottle, 1);
recipe.SetResult(null, "InfusedLeather", 1);
recipe.AddRecipe();
**/
recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.MBottle, 1);
recipe.SetResult(null, "InfusedCloth", 1);
recipe.AddRecipe();
RecipeHolder.AddEquipmentRecipes(this);
}
}
}
Ok so heres what i got
Followed by
Now the recipe above is my 3rd recipe.. the 2 above are using only base terraria items and work fine.
recipe.AddIngredient(null, "SlimeBlock", 5);
It looks like the correct name is TileID.WorkBenchesIs the code to make a recipe use a work bench this?
recipe.requiredTile[0] = TileID.Workbench;
Or have i done something wrong with that?
Ok, so i had been trying to implement a new accessory, but i think that was causing problems on its own, i just rewrote 90% of my code and have come back to the same error of the namespace not being found. here are the three .cs pages im using.Hm, can I see the code for your Mod class and your GlobalItem class?
Wait, so you're trying to create a new WyvernCoreItem() when that class doesn't actually exist?Ok, so i had been trying to implement a new accessory, but i think that was causing problems on its own, i just rewrote 90% of my code and have come back to the same error of the namespace not being found. here are the three .cs pages im using.
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using WyvernCore.Items;
namespace WyvernCore {
public class WyvernCore : Mod
{
public override void SetModInfo(out string name, ref string version, ref string author)
{
name = "WyvernStuff";
version = "v0.0.0.1";
author = "WyvernHunter";
}
public override void Load()
{
SetGlobalItem(new WyvernCoreItem());
AddItem("FeatherBlade", new FeatherBlade(), "WyvernCore/Items/FeatherBlade");
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.DirtBlock);
recipe.SetResult(null, "FeatherBlade");
recipe.AddRecipe();
}
}
}using System;
using Terraria.ID;
using Terraria.ModLoader;
namespace WyvernCore {
public static class RecipeHelper
{
public static void AddEquipmentRecipes(Mod mod)
{
ModRecipe recipe = new ModRecipe(mod);
}
}
}The FeatherBlade.png is located in the Items folder with FeatherBlade.cs and the Items Folder is in the WyvernCore folder, that is all i have. Thank you for your patience.using System;
using Terraria;
using Terraria.ModLoader;
namespace WyvernCore.Items {
public class FeatherBlade : ModItem
{
public override void SetDefaults()
{
item.name = "Feathery Blade";
item.damage = 45;
item.melee = true;
item.width = 40;
item.height = 40;
item.toolTip = "Doesn't seem very sharp...";
item.useTime = 18;
item.useAnimation = 18;
item.useStyle = 1;
item.knockBack = 8;
item.value = 20000;
item.rare = 2;
item.useSound = 1;
item.autoReuse = true;
}
}
}
In the SetDefaults method, you can modify item.tileBoost.I may look like a Moron, but is there a way to increase the range of a tool? o: