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.Category
Adding Recipes
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.
mods.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)
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)
ArrayList<GsSound>
. The sounds that will be played when the recipe is crafted. Can be overridden by the recipe. The firstfloat
value is the volume, the secondfloat
value is the pitch of the sound.groovysound(GsSound) sound(String, float, float) sound(SoundEvent, float, float) sound(ResourceLocation, float, float)
ArrayList<GsParticle>
. The particles that will be spawned when the recipe is crafted. Can be overridden by the recipe. Theint
value is the amount of particles, thefloat
value is the speed of the particles.groovyparticle(GsParticle) particle(String, int, float) particle(EnumParticleTypes, int, float)
GsEnum.QueueType
. If the recipes in this category can be queued. Can be overridden by the recipe. Allowed values are:true
,false
orYES
,NO
. (DefaultYES
).groovyqueueType(String) queueType(boolean) queueType(GsEnum.QueueType)
GsEnum.SoundType
. How the sounds will be played. Can be overridden by the recipe. Allowed values are:RANDOM
orCOMBINED
. (DefaultRANDOM
).groovysoundType(String) soundType(GsEnum.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)
GsEnum.OutputType
. How the output will be handed to the player. Can be overridden by the recipe. Allowed values are:DROP
orINVENTORY
. (DefaultDROP
).groovyoutputType(String) outputType(GsEnum.OutputType)
String
. The display name of the category that will be shown in the GUI. This can either be a string or a translation key if you want to make your Display Name translatable. Requires not null and the display name must be set.groovydisplayName(String)
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)
GsEnum.BackgroundType
. How the background will be rendered. The resource must be loaded via external methods. Allowed values are:SINGLE_STRETCH
,TILE
, orSINGLE_CUT
.TILE
uses a 16x16 texture and repeats it.SINGLE_STRETCH
stretches the texture ratio to fill the screen.SINGLE_CUT
stretches 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(GsEnum.BackgroundType)
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.GsCategory
).groovyregister()
Example
mods.selectionguicrafting.category.categoryBuilder()
.id('dummy_category')
.displayName('Your first Category')
.background('selectionguicrafting:textures/gui/background/wood.png')
.register()
mods.selectionguicrafting.category.categoryBuilder()
.id('blub')
.displayName('Pick your recipe')
.background('selectionguicrafting:textures/gui/background/lake.png')
.backgroundType('SINGLE_CUT')
.register()
mods.selectionguicrafting.category.categoryBuilder()
.id('dead')
.displayName('This is another dummy category to test')
.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
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()