CraftLoader
CraftLoader is a compact framework mod that provides mod developers with the ability to register custom "loaders" for various crafting systems, including mechanisms and devices. These loaders can retrieve data from resource packs, game saves, and the mods themselves.
Operation Principle and Usage
Recipe factories are registered similarly to standard Minecraft crafting table recipes. For mods and resource packs, they are located at: assets/<recipe owner mod ID>/crafting/<loader owner mod ID>/<name>_factories.json. For game saves, the path is: data/crafting/<recipe owner mod ID>/<loader owner mod ID>/<name>_factories.json.
The recipes themselves are defined in files assets/<recipe owner mod ID>/crafting/<loader owner mod ID>/<name>.json for mods and resource packs, and data/crafting/<recipe owner mod ID>/<loader owner mod ID>/<name>.json for saves.
Transformers for Optimization
Transformers are maps of string types to maps of string keys with lists of replacement values. They allow significantly reducing the number of required recipes. Transformers are defined in files assets/<recipe owner mod ID>/transformers.json and data/crafting/<recipe owner mod ID>/transformers.json.
The recipe name is formed as <recipe owner mod ID>:<recipe key name from JSON after transformer application>. Loaders from other mods may require additional data from the recipe definition to create a more specific key.
Recipe Management
A recipe can be disabled by adding the parameter "disabled":true to the JSON. If another JSON file redeclares this recipe with "disabled":false, the recipe becomes active.
To apply transformers to a recipe, specify them in a string array under the key "transformers", for example: "transformers": [ "vanilla_metals" ].
To use transformers from other mods, add a prefix with the mod ID to the transformer name.
Recipes can use constants from the recipe owner mod's constants JSON file for both input data and output. In the case of output, the first matching stack is used.
Usage examples can be found in the examples folder of the source code.
To register your own loader, use the methods of the CraftLoaderAPI class.