所以我正在制作我自己的Terraria Mod,但我有一个问题就是当我在我的mod中使用其中一个来自我的mod中的项目时,我的mod中的其他内容会给我一个错误。
这是使用我的mod中的内容的项目:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
namespace TestMod.Items.Weapons //Where it is located
{
public class BladeOfTheElements : ModItem
{
public override void SetDefaults()
{
item.name = "Blade Of The Elements"; //Sword name
item.damage = 26; //Sword damage - Damage is x2.5 - 43 here = 109 in game
item.crit = -46; //Crit chance of the weapon
item.melee = true; //Is it a melee item?
item.width = 74; //Sword width
item.height = 74; //Sword height
item.toolTip = "A blade containing the power of; Fire, Ice and Forest"; //Item Description
item.useTime = 23; //How fast is the item? How fast does it swing or shoot?
item.useAnimation = 23;
item.useStyle = 1; //How is the item used? 1 is sword
item.knockBack = 4; //The knockback of the item
item.value = 100000; //How much does it sell for? 100 = 1 Silver
item.rare = 5;
item.useSound = 1; //What sound type? 1 is sword
item.autoReuse = true; //If it's a sword can it autoswing?
item.useTurn = true;
item.shoot = mod.ProjectileType("BladeOfTheElementsProj");
item.shootSpeed = 6f; //Speed of the projectile
}
public override void AddRecipes() //How do you craft the item?
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.BladeOfTheForest, 1); //What do you need to craft the item? (Use 1 dirt block for testing)
recipe.AddIngredient(ItemID.BladeOfIce, 1);
recipe.AddIngredient(ItemID.BladeOfTheDemons, 1);
recipe.AddTile(TileID.Anvils); //Where is it made? Work bench, anvil, water? etc (Use worck bench for testing)
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
底部制作配方中的所有刀片都来自我的mod但是当我尝试编译我的mod时出现此错误:
编译mod时发生错误。
c:/Users/Nicolas/Documents/My Games/Terraria/ModLoader/Mod Sources/TestMod/Items/Weapons/BladeOfTheElements.cs(37,41) : error CS0117: 'Terraria.ID.ItemID' does not contain a definition for 'BladeOfTheForest'
我想指出当我使用污垢块进行配方时(为了测试武器)我可以编译mod就好了。
答案 0 :(得分:0)
因为那些刮掉BladeOfTheForest BladeOfIce和BladeOfTheDemons的人不是香草物品 - 我猜你是他们造的 - 他们不是主游戏,所以他们不是ItemID.etc
。仅使用BladeOfTheForest
,BladeOfIce
和BladeOfTheDemons
代替那些。
recipe.AddIngredient("BladeOfTheForest", 1);
recipe.AddIngredient("BladeOfIce", 1);
recipe.AddIngredient("BladeOfTheDemons", 1);