Interface IRecipeHandler


  • public interface IRecipeHandler
    Handles custom crafting recipes and anvil recipes.
    • Method Detail

      • getGlobalList

        List<IRecipe> getGlobalList()
        Returns:
        all global (vanilla workbench) recipes.
      • getCarpentryList

        List<IRecipe> getCarpentryList()
        Returns:
        all carpentry table recipes.
      • getAnvilList

        List<IAnvilRecipe> getAnvilList()
        Returns:
        all custom anvil recipes.
      • addRecipe

        void addRecipe​(String name,
                       boolean global,
                       net.minecraft.item.ItemStack result,
                       Object... recipe)
        Adds a shaped crafting recipe.
        Parameters:
        name - the recipe name.
        global - true for global (vanilla workbench); false for carpentry.
        result - the resulting item stack.
        recipe - the recipe pattern and ingredient mappings.
      • addRecipe

        void addRecipe​(String name,
                       boolean global,
                       net.minecraft.item.ItemStack result,
                       int width,
                       int height,
                       net.minecraft.item.ItemStack... items)
        Adds a shaped crafting recipe with explicit dimensions.
        Parameters:
        name - the recipe name.
        global - true for global; false for carpentry.
        result - the resulting item stack.
        width - the recipe grid width.
        height - the recipe grid height.
        items - the ingredient item stacks.
      • delete

        IRecipe delete​(int id)
        Deletes a crafting recipe by ID.
        Parameters:
        id - the recipe ID.
        Returns:
        the deleted recipe, or null if not found.
      • deleteAnvil

        IAnvilRecipe deleteAnvil​(int id)
        Deletes an anvil recipe by ID.
        Parameters:
        id - the recipe ID.
        Returns:
        the deleted anvil recipe, or null if not found.
      • addAnvilRecipe

        void addAnvilRecipe​(String name,
                            boolean global,
                            net.minecraft.item.ItemStack itemToRepair,
                            net.minecraft.item.ItemStack repairMaterial,
                            int xpCost,
                            float repairPercentage)
        Adds a custom anvil recipe.
        Parameters:
        name - the recipe name.
        global - true for global; false for carpentry.
        itemToRepair - the item to be repaired.
        repairMaterial - the material used for repair.
        xpCost - the experience cost.
        repairPercentage - the percentage of durability restored per material.