c# - C#Mod编译错误(tModLoader)

标签 c# compiler-errors

因此,我正在制作自己的Terraria 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();
        }
    }
}

底部的制作配方中的所有 Blade 都来自我的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。

最佳答案

您不能对Mod项目https://forums.terraria.org/index.php?threads/tutorial-3-items.44842/使用ItemId.Ingredient,如果需要帮助,则此注释中有一个“修复”

关于c# - C#Mod编译错误(tModLoader),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37886446/

相关文章:

c# - NAUDIO多输入,单输出

c# - 在 C# 代码中隐藏属性

c# - 通过 DbContext.SaveChanges() 获取删除的行数和编辑的行数

arrays - 分段故障(核心已转储)需要建议

c# - 递归类 C#

c# - 单声道中的多维数组索引错误

amazon-web-services - AWS Lambda 函数出现问题,cloudwatch 上调用错误

c++ - 如何从此示例更改代码

java - 找不到符号—符号: method lastIndexOf(java.lang.String) location: class java.util.Scanner

gcc - 编译6.3.0 gcc时声明冲突