/// <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 Recipe.AddTile(tileID).
        /// </exception>
        public NewRecipeFinder AddTile(Mod mod, string tileName)
        {
            if (!ModContent.TryFind(mod.Name, tileName, out ModTile tile))
            {
                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 Recipe.AddTile(tileID).");
            }

            return(AddTile(tile));
        }
        /// <summary>
        ///     Adds an ingredient to this recipe with the given item name from the given mod, and with the given stack stack. If
        ///     the mod parameter is null, then it will automatically use an item from the mod creating this recipe.
        /// </summary>
        /// <param name="mod">The mod.</param>
        /// <param name="itemName">Name of the item.</param>
        /// <param name="stack">The stack.</param>
        /// <exception cref="RecipeException">
        ///     The item " + itemName + " does not exist in mod " + mod.Name + ". If you are trying
        ///     to use a vanilla item, try removing the first argument.
        /// </exception>
        public NewRecipeFinder AddIngredient(Mod mod, string itemName, int stack = 0)
        {
            if (!ModContent.TryFind(mod.Name, itemName, out ModItem item))
            {
                throw new RecipeException($"The item {itemName} does not exist in the mod {mod.Name}.\r\nIf you are trying to use a vanilla item, try removing the first argument.");
            }

            return(AddIngredient(item, stack));
        }
Example #3
0
        /// <summary>
        /// Sets the saved style that should be switched to, handles possibly unloaded/invalid ones and defaults to the vanilla style
        /// </summary>
        internal static void GotoSavedStyle()
        {
            switchToStyle = vanillaStyle;
            if (ModContent.TryFind(lastSelectedStyle, out ModBossBarStyle value))
            {
                switchToStyle = value;
            }

            styleLoading = false;
        }
Example #4
0
        internal static void GotoSavedModMenu()
        {
            if (LastSelectedModMenu == MenuOldVanilla.FullName)
            {
                Main.instance.playOldTile = true;                 // If the previous menu was the 1.3.5.3 one, automatically reactivate it.
            }

            switchToMenu = MenutML;
            if (ModContent.TryFind(LastSelectedModMenu, out ModMenu value) && value.IsAvailable)
            {
                switchToMenu = value;
            }

            loading = false;
        }
Example #5
0
 /// <summary> Safely attempts to find the content instance from this mod with the specified name. Caching the result is recommended. </summary>
 /// <returns> Whether or not the requested instance has been found. </returns>
 public bool TryFind <T>(string name, out T value) where T : IModType => ModContent.TryFind(Name, name, out value);