Crafting Recipe (Selection GUI Crafting)
Description
Creates a recipe that is shown in the specified category. Each recipe requires at least an input and output. There can also be an optional input for either hand. The recipe can have its own frame, sounds, particles, progress bar, can specify how the sounds are played, if the recipe can be added to the crafting queue, how the output items are handed to the player, how much durability is consumed if the tool is a damageable item, the crafting time, and how much XP is rewarded. Most of these have a fallback to the category settings.
Identifier
Refer to this via any of the following:
mods.selectionguicrafting.recipe/* Used as page default */
mods.selectionguicrafting.Recipe
Adding Recipes
Adds a new recipe:
groovymods.selectionguicrafting.recipe.add(Recipe)
Recipe Builder
Just like other recipe types, the Crafting Recipe also uses a recipe builder.
Don't know what a builder is? Check the builder info page out.
Recipe Builder
Create the Recipe Builder.
groovymods.selectionguicrafting.recipe.recipeBuilder()
Integer
. The amount of XP that will be granted to the player when the recipe is crafted. Requires greater than or equal to 0. (Default0
).groovyxp(int)
Integer
. The time in ticks it takes to craft the recipe. Requires greater than or equal to 0. (Default20
).groovytime(int)
ResourceLocation
. The path to the frame texture. Overrides the category frame. Textures that come with the mod. (Defaultselectionguicrafting:textures/gui/frame/default.png
).groovyframe(String) frame(ResourceLocation)
RecipeInput
. The input items that are required to craft the recipe. Input refers to the offhand item. You can add multiple inputs each with a different amount. Theint
value is the damage applied to the item, thedouble
value is the chance the item will be damaged / consumed. Requires greater than or equal to 0.groovyinput(IIngredient) input(RecipeInput) input(Collection<?>) input(IIngredient...) input(RecipeInput...) input(IIngredient, int) input(IIngredient, double) input(IIngredient, double, int)
String
. The skills required to craft the recipe. (Requires: Reskillable).groovyskill(String, int)
Sound
. The sounds that will be played when the recipe is crafted. Overrides the category sounds. The firstfloat
value is the volume, the secondfloat
value is the pitch of the sound.groovysound(Sound) sound(String) sound(SoundEvent) sound(ResourceLocation) sound(String, float, float) sound(SoundEvent, float, float) sound(ResourceLocation, float, float)
RecipeOutput
. The output items that will be given to the player. You can add multiple outputs each with a different chance. Thedouble
value is the chance of the item being dropped. Requires greater than or equal to 1.groovyoutput(ItemStack) output(ItemStack...) output(RecipeOutput) output(Collection<?>) output(RecipeOutput...) output(ItemStack, double)
String
. The commands to execute after crafting the recipe.groovycommand(String) command(String...)
RecipeInput
. The offhand input that will be used to craft the recipe. Theint
value is the damage applied to the item, thedouble
value is the chance the item will be damaged / consumed. Requires greater than or equal to 0 and less than or equal to 1.groovyoffhand(IIngredient) offhand(RecipeInput) offhand(IIngredient, int) offhand(IIngredient, double) offhand(IIngredient, double, int)
String
. The category that the recipe belongs to. Requires not null and the category must exist.groovycategory(String)
RecipeInput
. The mainhand input that will be used to craft the recipe. Theint
value is the damage applied to the item, thedouble
value is the chance the item will be damaged / consumed. Requires greater than or equal to 0 and less than or equal to 1.groovymainhand(IIngredient) mainhand(RecipeInput) mainhand(IIngredient, int) mainhand(IIngredient, double) mainhand(IIngredient, double, int)
Particle
. The particles that will be spawned when the recipe is crafted. Overrides the category particles. Theint
value is the amount of particles, thefloat
value is the speed of the particles.groovyparticle(String) particle(Particle) particle(EnumParticleTypes) particle(String, int, float) particle(EnumParticleTypes, int, float)
String
. The game stages required to craft the recipe. (Requires: Game Stages).groovygamestage(String) gamestage(String...)
QueueType
. If the recipe can be queued. Overrides the category queueable. Allowed values are either:true
,false
orYES
,NO
.groovyqueueable(String) queueable(boolean) queueable(QueueType)
SoundType
. How the sounds will be played. Overrides the category soundType. Allowed values are:RANDOM
orCOMBINED
.groovysoundType(String) soundType(SoundType)
OutputType
. How the output will be handed to the player. Overrides the category outputType. Allowed values are:DROP
orINVENTORY
.groovyoutputType(String) outputType(OutputType)
ResourceLocation
. The advancements required to craft the recipe.groovyadvancement(String) advancement(String...) advancement(ResourceLocation) advancement(ResourceLocation...)
ResourceLocation
. The path to the progress bar texture. Overrides the category progressBar. Textures that come with the mod. (Defaultselectionguicrafting:textures/gui/progress/default.png
).groovyprogressBar(String) progressBar(ResourceLocation)
First validates the builder, returning
null
and outputting errors to the log file if the validation failed, then registers the builder and returns the registered object. (returnsnull
orio.enderdev.selectionguicrafting.registry.recipe.Recipe
).groovyregister()
Example
mods.selectionguicrafting.recipe.recipeBuilder()
.category('dummy_category')
.input(item('minecraft:stone') * 3)
.output(item('minecraft:cobblestone') * 2, 0.5)
.time(200)
.xp(1)
.sound('minecraft:block.anvil.land', 1.0f, 1.0f)
.register()
mods.selectionguicrafting.recipe.recipeBuilder()
.category('blub')
.input(item('minecraft:diamond'))
.output(item('minecraft:wheat_seeds') * 5, 0.5)
.register()
mods.selectionguicrafting.recipe.recipeBuilder()
.category('dummy_category')
.input(item('minecraft:stone') * 32)
.output(item('minecraft:diamond') * 50, 0.5)
.output(item('minecraft:clay') * 2, 0.1)
.time(200)
.xp(10)
.sound('minecraft:block.anvil.land', 1.0f, 1.0f)
.register()
mods.selectionguicrafting.recipe.recipeBuilder()
.category('dead')
.input(item('minecraft:wheat_seeds') * 3)
.output(item('minecraft:sand') * 2)
.time(40)
.queueable(false)
.outputType('DROP')
.xp(100)
.register()
mods.selectionguicrafting.recipe.recipeBuilder()
.category('dead')
.input(item('minecraft:stick') * 3)
.output(item('minecraft:sand') * 2)
.frame('selectionguicrafting:textures/gui/frame/iron.png')
.time(40)
.queueable(false)
.command('kill @p')
.register()
Removing Recipes
Removes the given recipe:
groovymods.selectionguicrafting.recipe.remove(Recipe)
Remove all recipes in a category:
groovymods.selectionguicrafting.recipe.removeByCategory(String)
Removes all recipes that match the given input:
groovymods.selectionguicrafting.recipe.removeByInput(IIngredient)
Removes all recipes that match the given output:
groovymods.selectionguicrafting.recipe.removeByOutput(IIngredient)
Removes all registered recipes:
groovymods.selectionguicrafting.recipe.removeAll()
Example
mods.selectionguicrafting.recipe.removeByCategory('dummy_category')
mods.selectionguicrafting.recipe.removeByInput(item('minecraft:cobblestone'))
mods.selectionguicrafting.recipe.removeByOutput(item('minecraft:stone'))
mods.selectionguicrafting.recipe.removeAll()
Getting the value of recipes
Iterates through every entry in the registry, with the ability to call remove on any element to remove it:
groovymods.selectionguicrafting.recipe.streamRecipes()