Developer API
Crafting Tweaks provides both a Java API for developers as well as customization through JSON files.
Both can be used to make crafting grids compatible with Crafting Tweaks. The data pack API is recommended for most cases - the Java API can be used for more complex dynamic crafting grids that cannot be represented in a data pack.
This guide will help you get started with the Crafting Tweaks API.
API Overview
You can learn about the available API methods on our GitHub repository.
A good starting point is the CraftingTweaksAPI or CraftingTweaksClientAPI class. They will allow you to register a CraftingGridProvider to define crafting grids within a container menu, and optionally a GridGuiHandler to customize the placement of the tweak buttons.
You can find an example of how CraftingGridProvider is implemented for Vanilla in the VanillaCraftingGridProvider class.
If you have any questions or need help, feel free to join our Discord server.
repositories {
maven {
url "https://maven.twelveiterations.com/repository/maven-public/"
content {
includeGroup "net.blay09.mods"
}
}
}
dependencies {
// Common (mojmap):
compileOnly "net.blay09.mods:craftingtweaks-common:${mod_version}"
// NeoForge:
implementation "net.blay09.mods:craftingtweaks-neoforge:${mod_version}"
// Fabric:
implementation "net.blay09.mods:craftingtweaks-fabric:${mod_version}"
}