Class RecipeLoader

java.lang.Object
com.github.darksoulq.abyssallib.world.recipe.RecipeLoader

public class RecipeLoader extends Object
A utility class for loading, parsing, and registering Minecraft recipes from external files.

This class supports standard Minecraft recipe types (Shaped, Shapeless, Furnace, etc.) as well as custom types. It uses a RecipeType system to decode JSON and YAML data into recipe objects.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    loadFile(File file)
    Loads a single recipe file from the file system.
    static int
    loadFolder(File folder)
    Recursively scans a folder and loads all JSON and YAML files found as recipes.
    static int
    loadFolder(org.bukkit.plugin.Plugin plugin, String resourcePath)
    Loads recipes from a specific resource path within a plugin's JAR.
    static void
    loadResource(org.bukkit.plugin.Plugin plugin, String resourcePath)
    Loads a single recipe from a plugin resource.
    static void
     
    static void
    Finalizes the recipe loading process by injecting all registered recipes into the Bukkit server.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RecipeLoader

      public RecipeLoader()
  • Method Details

    • loadFolder

      public static int loadFolder(File folder)
      Recursively scans a folder and loads all JSON and YAML files found as recipes.
      Parameters:
      folder - The File directory to scan.
    • loadFolder

      public static int loadFolder(org.bukkit.plugin.Plugin plugin, String resourcePath)
      Loads recipes from a specific resource path within a plugin's JAR.
      Parameters:
      plugin - The Plugin instance.
      resourcePath - The internal path (e.g., "recipes/").
    • loadFile

      public static void loadFile(File file)
      Loads a single recipe file from the file system.
      Parameters:
      file - The YAML or JSON File.
    • loadResource

      public static void loadResource(org.bukkit.plugin.Plugin plugin, String resourcePath)
      Loads a single recipe from a plugin resource.
      Parameters:
      plugin - The Plugin owning the resource.
      resourcePath - The path to the file.
    • reload

      @Internal public static void reload()
      Finalizes the recipe loading process by injecting all registered recipes into the Bukkit server.

      This method iterates through all internal registries and calls Bukkit.addRecipe(org.bukkit.inventory.Recipe) or adds potion mixes to the brewing system.

    • registerToBukkit

      public static void registerToBukkit(CustomRecipe recipe)