Class RecipeLoader
java.lang.Object
com.github.darksoulq.abyssallib.world.recipe.RecipeLoader
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 handler-based system to decode YAML data into Bukkit or library-specific recipe objects.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface for handling the conversion of raw YAML data into a recipe object. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidLoads a single recipe file from the file system.static voidload(InputStream in) Parses an input stream into one or more recipe definitions.static intloadFolder(File folder) Recursively scans a folder and loads all YAML files found as recipes.static intloadFolder(org.bukkit.plugin.Plugin plugin, String resourcePath) Loads recipes from a specific resource path within a plugin's JAR.static voidloadResource(org.bukkit.plugin.Plugin plugin, String resourcePath) Loads a single recipe from a plugin resource.static voidregisterHandler(String type, RecipeLoader.RecipeHandler handler) Registers a custom handler for a specific recipe type.static voidreload()Finalizes the recipe loading process by injecting all registered recipes into the Bukkit server.
-
Constructor Details
-
RecipeLoader
public RecipeLoader()
-
-
Method Details
-
registerHandler
Registers a custom handler for a specific recipe type.- Parameters:
type- The string identifier for the recipe type (e.g., "minecraft:shaped").handler- TheRecipeLoader.RecipeHandlerlogic to process this type.
-
loadFolder
-
loadFolder
Loads recipes from a specific resource path within a plugin's JAR.- Parameters:
plugin- ThePlugininstance.resourcePath- The internal path (e.g., "recipes/").
-
load
-
loadResource
Loads a single recipe from a plugin resource.- Parameters:
plugin- ThePluginowning the resource.resourcePath- The path to the file.
-
load
Parses an input stream into one or more recipe definitions.- Parameters:
in- TheInputStreamof the YAML content.- Throws:
Codec.CodecException- If parsing fails.
-
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(Recipe)or adds potion mixes to the brewing system.
-