Rolling Machine (Tech Reborn)
Description
Converts a custom crafting recipe into an output itemstack.
Identifier
Refer to this via any of the following:
mods.techreborn.rolling_machine/* Used as page default */
mods.techreborn.rollingmachine
mods.techreborn.rollingMachine
mods.techreborn.RollingMachineAdding Recipes
Adds a shaped crafting recipe in the format
output,input:groovymods.techreborn.rolling_machine.addShaped(ItemStack, List<List<IIngredient>>)Adds a shapeless crafting recipe in the format
output,input:groovymods.techreborn.rolling_machine.addShapeless(ItemStack, List<IIngredient>)
Recipe Builder
Just like other recipe types, the Rolling Machine also uses a recipe builder.
Don't know what a builder is? Check the builder info page out.
Shaped Rolling Machine Recipe Builder
Create a Recipe Builder for Shaped Rolling Machine Crafting recipes.
groovymods.techreborn.rolling_machine.shapedBuilder()
ResourceLocation. Sets the Resource Location of the recipe.groovyname(String) name(ResourceLocation)String[]. Sets the items required in each slot of the grid as char. Requires either the key-based matrix or the ingredient-based matrix can be defined, not both.groovyrow(String) shape(String...) matrix(String...)List<List<IIngredient>>. Sets the items required in each slot in the grid as IIngredients. Requires greater than or equal to 1, less than or equal to 9, and either the key-based matrix or the ingredient-based matrix can be defined, not both.groovyshape(List<List<IIngredient>>) matrix(List<List<IIngredient>>)Char2ObjectOpenHashMap<IIngredient>. Sets the item the given char corresponds to. (Default' ' = IIngredient.EMPTY).groovykey(char, IIngredient) key(String, IIngredient) key(Map<String, IIngredient>)ItemStack. Sets the item output. Requires not null.groovyoutput(ItemStack)boolean. Sets if the recipe is horizontally mirrored. (Defaultfalse).groovymirrored() mirrored(boolean)Closure<ItemStack>. Sets an operation that modifies the input items or output item.groovyrecipeFunction(Closure<ItemStack>)Closure<Void>. Sets an operation that happens when the recipe is crafted.groovyrecipeAction(Closure<Void>)
First validates the builder, returning
nulland outputting errors to the log file if the validation failed, then registers the builder and returns the registered object. (returnsnullornet.minecraft.item.crafting.IRecipe).groovyregister()
Example
mods.techreborn.rolling_machine.shapedBuilder()
.output(item('minecraft:stone'))
.matrix('BXX',
'X B')
.key('B', item('minecraft:stone'))
.key('X', item('minecraft:gold_ingot'))
.mirrored()
.register()
mods.techreborn.rolling_machine.shapedBuilder()
.output(item('minecraft:diamond') * 32)
.matrix([[item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')],
[item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')],
[item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')]])
.register()Shapeless Rolling Machine Recipe Builder
Create a Recipe Builder for Shapeless Rolling Machine Crafting recipes.
groovymods.techreborn.rolling_machine.shapelessBuilder()
ResourceLocation. Sets the Resource Location of the recipe.groovyname(String) name(ResourceLocation)List<IIngredient>. Sets the items required for the recipe. Requires greater than or equal to 1 and less than or equal to 9.groovyinput(IIngredient) input(IIngredient...) input(Collection<IIngredient>)ItemStack. Sets the item output. Requires not null.groovyoutput(ItemStack)Closure<ItemStack>. Sets an operation that modifies the input items or output item.groovyrecipeFunction(Closure<ItemStack>)Closure<Void>. Sets an operation that happens when the recipe is crafted.groovyrecipeAction(Closure<Void>)
First validates the builder, returning
nulland outputting errors to the log file if the validation failed, then registers the builder and returns the registered object. (returnsnullornet.minecraft.item.crafting.IRecipe).groovyregister()
Example
mods.techreborn.rolling_machine.shapelessBuilder()
.output(item('minecraft:clay') * 8)
.input(item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'))
.register()
mods.techreborn.rolling_machine.shapelessBuilder()
.output(item('minecraft:clay') * 32)
.input(item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'))
.register()Removing Recipes
Removes all recipes that match the given output:
groovymods.techreborn.rolling_machine.removeByOutput(IIngredient)Removes all registered recipes:
groovymods.techreborn.rolling_machine.removeAll()
Example
mods.techreborn.rolling_machine.removeByOutput(item('minecraft:tripwire_hook'))
mods.techreborn.rolling_machine.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.techreborn.rolling_machine.streamRecipes()
