Crafting Category (Selection GUI Crafting)
Description
All recipes in the mod are divided into categories. Each category has its own set of recipes. Each category can have its own texture for the background, border, frame, decoration, and progress bar. The category can also have its own sounds, particles, can specify how the sounds are played, if recipes in the category can be added to the crafting queue, and how the output items are handed to the player.
Identifier
Refer to this via any of the following:
mods.selectionguicrafting.category/* Used as page default */
mods.selectionguicrafting.CategoryAdding Recipes
Adds a new category:
groovymods.selectionguicrafting.category.add(Category)
Recipe Builder
Just like other recipe types, the Crafting Category 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.category.categoryBuilder()
String. The Category ID, must be unique. Requires not null and the ID must be unique.groovyid(String)ResourceLocation. The path to the frame texture. The resource must be loaded via external methods. Can be overridden by the recipe. Textures that come with the mod. (Defaultselectionguicrafting:textures/gui/frame/default.png).groovyframe(String) frame(ResourceLocation)Sound. The sounds that will be played when the recipe is crafted. Can be overridden by the recipe. The firstfloatvalue is the volume, the secondfloatvalue 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)ResourceLocation. The path to the border texture. The resource must be loaded via external methods. Textures that come with the mod. (Defaultselectionguicrafting:textures/gui/background/default.png).groovyborder(String) border(ResourceLocation)AbstractTrigger. A trigger that will open a GUI with all recipes for that category. Can be a block or an item. The firstdoublevalue modifies the item damage, the second the crafting time, the third the amount of xp given to the player. Requires not null and a category needs at least one trigger.groovytrigger(Block) trigger(IIngredient) trigger(ItemTrigger) trigger(BlockTrigger) trigger(Block, double, double, double) trigger(IIngredient, double, double, double)Particle. The particles that will be spawned when the recipe is crafted. Can be overridden by the recipe. Theintvalue is the amount of particles, thefloatvalue is the speed of the particles.groovyparticle(String) particle(Particle) particle(EnumParticleTypes) particle(String, int, float) particle(EnumParticleTypes, int, float)QueueType. If the recipes in this category can be queued. Can be overridden by the recipe. Allowed values are:true,falseorYES,NO. (DefaultYES).groovyqueueType(String) queueType(boolean) queueType(QueueType)SoundType. How the sounds will be played. Can be overridden by the recipe. Allowed values are:RANDOMorCOMBINED. (DefaultRANDOM).groovysoundType(String) soundType(SoundType)ResourceLocation. The path to the background texture. The resource must be loaded via external methods. Textures that come with the mod. (Defaultselectionguicrafting:textures/gui/background/default.png).groovybackground(String) background(ResourceLocation)ResourceLocation. The path to the decoration texture. The resource must be loaded via external methods. Textures that come with the mod. (Defaultselectionguicrafting:textures/gui/decor/default.png).groovydecoration(String) decoration(ResourceLocation)OutputType. How the output will be handed to the player. Can be overridden by the recipe. Allowed values are:DROPorINVENTORY. (DefaultINVENTORY).groovyoutputType(String) outputType(OutputType)ResourceLocation. The path to the progress bar texture. The resource must be loaded via external methods. Can be overridden by the recipe. Textures that come with the mod. (Defaultselectionguicrafting:textures/gui/progress/default.png).groovybar(String) bar(ResourceLocation)BackgroundType. How the background will be rendered. The resource must be loaded via external methods. Allowed values are:SINGLE_STRETCH,TILE, orSINGLE_CUT.TILEuses a 16x16 texture and repeats it.SINGLE_STRETCHstretches the texture ratio to fill the screen.SINGLE_CUTstretches the texture while keeping the aspect ratio and cuts of anything that goes outside the gui. The texture is centered on the x and y axis. (DefaultTILE).groovybackgroundType(String) backgroundType(BackgroundType)
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. (returnsnullorio.enderdev.selectionguicrafting.registry.category.Category).groovyregister()
Example
mods.selectionguicrafting.category.categoryBuilder()
.id('dummy_category')
.trigger(item('minecraft:diamond'), 0.2, 0.8, 2.65)
.background('selectionguicrafting:textures/gui/background/wood.png')
.register()
mods.selectionguicrafting.category.categoryBuilder()
.id('blub')
.trigger(item('minecraft:stone_shovel'))
.background('selectionguicrafting:textures/gui/background/lake.png')
.backgroundType('SINGLE_CUT')
.register()
mods.selectionguicrafting.category.categoryBuilder()
.id('dead')
.trigger(block('minecraft:snow'))
.background('selectionguicrafting:textures/gui/background/deadlands.png')
.decoration('selectionguicrafting:textures/gui/decor/gold.png')
.border('selectionguicrafting:textures/gui/background/wood.png')
.backgroundType('SINGLE_CUT')
.register()Removing Recipes
Removes the given category:
groovymods.selectionguicrafting.category.remove(Category)Remove a category by its name:
groovymods.selectionguicrafting.category.removeByName(String)Removes all registered recipes:
groovymods.selectionguicrafting.category.removeAll()
Example
mods.selectionguicrafting.category.removeByName('dummy_category_1')
mods.selectionguicrafting.category.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.category.streamCategories()
