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.

  • 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
    Evaluates and routes a loaded custom recipe instance into the vanilla server recipe manager.
    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.
      Returns:
      The amount of successfully parsed and executed configuration paths.
    • 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/").
      Returns:
      The amount of successfully parsed and executed configuration paths.
    • 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)
      Evaluates and routes a loaded custom recipe instance into the vanilla server recipe manager.
      Parameters:
      recipe - The recipe to append to the active Bukkit state map.