SelectionGUI Crafting - Continued
This project represents a significant reworking of the Selection GUI Crafting mod originally created by Gliese_832_c. Initially planned as a simple adaptation of the existing solution, during development it became clear that the original crafting system was too cumbersome and inconvenient for users.
Complete System Overhaul
The new version offers a completely reimagined approach to crafting through selection interface. The system became significantly clearer and more convenient to use. Modpack developers can now configure it for their needs with much greater flexibility. An important improvement was the support for GroovyScript, as well as updated integration with CraftTweaker, fully accounting for the mod's new capabilities.
How It Works?
SelectionGUI Crafting allows mod creators to add special crafting recipes activated by right-clicking with specific items in hands. This opens up many interesting possibilities.
For example, for working with clay: instead of the standard placement of clay balls on a crafting table, it's sufficient to hold a spatula in one hand, clay in the other, and select the desired finished item from the appearing list. Another scenario - blacksmithing: hold a hammer and metal ingot, then select the tool head you want to craft.
Script Integration
The system supports two popular game modification tools. Let's look at examples of their usage.
CraftTweaker
val test = mods.selectionguicrafting.category.categoryBuilder();
test.id("test");
test.displayName("Test");
test.register();
val myRecipe = mods.selectionguicrafting.recipe.recipeBuilder();
myRecipe.category("test");
myRecipe.output(<minecraft:sand> 2);
myRecipe.tool(<minecraft:stick> 5);
myRecipe.input(<minecraft:snow> 3);
myRecipe.register();
mods.selectionguicrafting.recipe.recipeBuilder().category("test").output(<minecraft:sand> 5).tool(<minecraft:stick> 10).input(<minecraft:snow> 2).register();
GroovyScript
// Crafting Category Creation:
// All recipes are divided by categories. Each category has its own set of textures for background, frame, decorations, and progress indicator. Sound effects, particles, and the method of obtaining finished items can also be configured.
mods.selectionguicrafting.category.removeByName('dummy_category_1')
mods.selectionguicrafting.category.categoryBuilder()
.id('dummy_category')
.displayName('Your First Category')
.background('selectionguicrafting:textures/gui/background/wood.png')
.register()
// Recipe Creation:
// Each recipe requires an input item (offhand), tool (main hand), and result. An optional catalyst (in inventory) can also be specified. For the recipe, crafting time, tool durability consumption, experience gain, and sound parameters are configured.
mods.selectionguicrafting.recipe.removeByInput(item('minecraft:cobblestone'))
mods.selectionguicrafting.recipe.recipeBuilder()
.category('dummy_category')
.input(item('minecraft:stone') 3)
.output(item('minecraft:cobblestone') 2, 0.5f)
.tool(item('minecraft:wooden_pickaxe'), 1.0f)
.time(200)
.xp(1)
.sound('minecraft:block.anvil.land', 1.0f, 1.0f)
.register()