コード例 #1
0
 public void AddTile(Mod mod, string tileName)
 {
     if (mod == null)
     {
         mod = this.mod;
     }
     this.AddTile(mod.TileType(tileName));
 }
コード例 #2
0
 public static void AddBossRecipes(Mod mod)
 {
     ModRecipe recipe = new ModRecipe(mod);
     recipe.AddIngredient(null, "BossItem", 10);
     recipe.AddTile(null, "ExampleWorkbench");
     recipe.SetResult(ItemID.SuspiciousLookingEye, 20);
     recipe.AddRecipe();
     recipe = new ModRecipe(mod);
     recipe.AddIngredient(null, "BossItem", 10);
     recipe.AddTile(null, "ExampleWorkbench");
     recipe.SetResult(ItemID.WormFood, 20);
     recipe.AddRecipe();
     recipe = new ModRecipe(mod);
     recipe.AddIngredient(null, "BossItem", 10);
     recipe.AddTile(null, "ExampleWorkbench");
     recipe.SetResult(ItemID.BloodySpine, 20);
     recipe.AddRecipe();
     recipe = new ModRecipe(mod);
     recipe.AddIngredient(null, "BossItem", 10);
     recipe.AddTile(null, "ExampleWorkbench");
     recipe.SetResult(ItemID.Abeemination, 20);
     recipe.AddRecipe();
     recipe = new ModRecipe(mod);
     recipe.AddIngredient(null, "BossItem", 10);
     recipe.AddTile(null, "ExampleWorkbench");
     recipe.SetResult(ItemID.GuideVoodooDoll);
     recipe.AddRecipe();
     recipe = new ModRecipe(mod);
     recipe.AddIngredient(null, "BossItem", 10);
     recipe.AddTile(null, "ExampleWorkbench");
     recipe.SetResult(ItemID.MechanicalEye, 20);
     recipe.AddRecipe();
     recipe = new ModRecipe(mod);
     recipe.AddIngredient(null, "BossItem", 10);
     recipe.AddTile(null, "ExampleWorkbench");
     recipe.SetResult(ItemID.MechanicalWorm, 20);
     recipe.AddRecipe();
     recipe = new ModRecipe(mod);
     recipe.AddIngredient(null, "BossItem", 10);
     recipe.AddTile(null, "ExampleWorkbench");
     recipe.SetResult(ItemID.MechanicalSkull, 20);
     recipe.AddRecipe();
     // Here we see another way to retrieve type ids from classnames. Useful for those who program in an IDE who wish to avoid spelling mistakes.
     recipe = new ModRecipe(mod);
     recipe.AddIngredient(mod.ItemType<Items.BossItem>(), 10);
     recipe.AddTile(mod.TileType<Tiles.ExampleWorkbench>());
     recipe.SetResult(ItemID.LihzahrdPowerCell, 20);
     recipe.AddRecipe();
 }
コード例 #3
0
ファイル: ModRecipe.cs プロジェクト: raydeejay/tModLoader
        /// <summary>
        /// Adds a required crafting station to this recipe with the given tile name from the given mod. If the mod parameter is null, then it will automatically use a tile from the mod creating this recipe.
        /// </summary>
        /// <param name="mod">The mod.</param>
        /// <param name="tileName">Name of the tile.</param>
        /// <exception cref="RecipeException"></exception>
        public void AddTile(Mod mod, string tileName)
        {
            if (mod == null)
            {
                mod = this.mod;
            }
            int type = mod.TileType(tileName);

            if (type == 0)
            {
                string message = "The tile " + tileName + " does not exist in the mod " + mod.Name + "." + Environment.NewLine;
                message += "If you are trying to use a vanilla tile, try using ModRecipe.AddTile(tileID).";
                throw new RecipeException(message);
            }
            this.AddTile(type);
        }
コード例 #4
0
        /// <summary>
        /// Adds a required crafting station to this recipe with the given tile name from the given mod. If the mod parameter is null, then it will automatically use a tile from the mod creating this recipe.
        /// </summary>
        /// <param name="mod">The mod.</param>
        /// <param name="tileName">Name of the tile.</param>
        /// <exception cref="RecipeException">The tile " + tileName + " does not exist in mod " + mod.Name + ". If you are trying to use a vanilla tile, try using ModRecipe.AddTile(tileID).</exception>
        public ModRecipe AddTile(Mod mod, string tileName)
        {
            if (mod == null)
            {
                mod = this.mod;
            }

            int type = mod.TileType(tileName);

            if (type == 0)
            {
                throw new RecipeException($"The tile {tileName} does not exist in the mod {mod.Name}.\r\nIf you are trying to use a vanilla tile, try using ModRecipe.AddTile(tileID).");
            }

            return(AddTile(type));
        }