-
Notifications
You must be signed in to change notification settings - Fork 2
Categories
To get started, you first need to create a Category. Categories are the actual GUI "window" that is opened when a trigger item/block is clicked. It's highly recommended to use /ct syntax frequently to check if your syntax is correct!
Start with:
mods.selectionguicrafting.category.categoryBuilder()
.id(string)
Every category needs a unique ID, no matter what. This is also how you link recipes to a category. Example:
mods.selectionguicrafting.category.categoryBuilder()
.id("category_flint")
.register();
I recommend using Resource Loader to load/refresh/allow editing of the selectioncrafting:lang/en_us.lang file. For each category you make, you'll need an entry. The format is:
selectionguicrafting.category.[CategoryID].name=[Whatever you want to name it]
for example, selectionguicrafting.category.category_flint.name=Primitive Flint Crafting
would name a category with the ID "category_flint" as Primitive Flint Crafting in-game.
There are a few different ways to use triggers, with different optional parameters. The most common is with held items. You can use the command /ct hand
to get the current held crafttweaker IItemStack item.
A simple example that will trigger this GUI category when you hold minecraft:flint and right-click:
mods.selectionguicrafting.category.categoryBuilder()
.id("category_flint")
.trigger(<minecraft:flint>)
.register();
There are also optional parameters, too:
.trigger(Crafttweaker IItemStack, double DamageMultiplier, double timeMultiplier, double xpMultiplier)
This is used to create a Category Trigger that specifies a multiplier for recipe-related tool damage, time increase/decrease, and xp increase/decrease. Example:
mods.selectionguicrafting.category.categoryBuilder()
.id("category_flint")
trigger(<minecraft:flint>)
trigger(<minecraft:diamond_pickaxe>, 10.0, 0.1, 10.0)
.register();
Functions the same as an Item trigger, but you need to specify it's a CraftTweaker IBlock:
.trigger(<minecraft:grass>.asBlock())
or .trigger(<minecraft:grass>.asBlock(), 2.0, 2.0, 2.0)
Triggers can be combined, so right clicking ANY of these will trigger the crafting GUI to appear:
mods.selectionguicrafting.category.categoryBuilder()
.id("category_flint")
.trigger(<minecraft:flint>)
.trigger(<minecraft:diamond_pickaxe>, 10.0, 0.1, 10.0)
.trigger(<minecraft:grass>.asBlock(), 2.0, 2.0, 2.0)
.register();
The above example means that if you right-click with a Diamond Pickaxe, it will give the pickaxe 10x the specified recipe-tool damage in the recipe, but only takes 10% of the standard recipe time, and provides 10x the specified recipe experience. If you right click a Flint, the category will be normal. If you right click a placed block of grass, it will only do 2x the recipe tool damage, but take twice as long while providing 2x the standard experience.
Use a mod like Resource Loader to load/change custom background, frame, border, and decoration images! However, there are a few built-in if you see the assets at selectioncrafting:textures/gui
.
-
.background(string ResourceLocation)
Sets the background image. Default is.background("selectioncrafting:textures/gui/background/default.png")
. -
.backgroundType("string BackgroundType")
Sets the behavior of the background image. "SINGLE_CUT" displays the image as-is. "SINGLE_STRETCH" stretches the image to fit. "TILE" sets the image to repeat, similar to advancement backgrounds. Useful if you're using a block texture like.background("minecraft:textures/blocks/planks_oak.png")
. -
.border(string ResourceLocation)
Sets the border image around the Category. Default is .border("selectioncrafting:textures/gui/decor/default.png"). -
.frame(string ResourceLocation)
Sets the frame image around the recipe items themselves. Default is .frame("selectioncrafting:textures/gui/decor/default.png"). -
.bar("selectioncrafting:textures/gui/bar/default.png")
Sets the progress bar image for the recipe as it crafts. See the default for an example of how the image is formatted! -
.sound("minecraft:block.wood.break", 16.0, 1.0)
Format is .sound(sound ResourceLocation, volumeRadius double, Pitch double) Adds a sound to the category when a recipe is finished. You can add multiple. Can find sounds with the /playsound command! -
.soundType("RANDOM")
Determines if the sounds added are randomly selected or played at the same time. Choose "RANDOM" or "COMBINED". -
.particle("CLOUD", 100, 1.0)
Adds optional particles when the recipe is finished. Use /particle command to find particles. -
.queueable(true)
Determines whether the recipes in this category can be "queued" (clicked to queue multiple recipes in order while they craft). Set to true or false. -
.outputType("INVENTORY")
Determines whether the output item is dropped on the ground in front of the player, or if it appears in their inventory when finished. Options are "INVENTORY" or "DROP"
//// Create category "chopped_oak" ////
mods.selectionguicrafting.category.categoryBuilder()
.id("chopped_oak")
.trigger(<contenttweaker:chopped_oak>)
.background("minecraft:textures/blocks/planks_oak.png")
.backgroundType("TILE")
.border("selectioncrafting:textures/gui/decor/default.png")
.frame("selectioncrafting:textures/gui/frame/chest.png")
.bar("selectioncrafting:textures/gui/bar/default.png")
.sound("minecraft:block.wood.break", 16.0, 1.0)
//.soundType("RANDOM") //RANDOM or COMBINED
//.particle("CLOUD", 100, 1.0)
.queueable(true)
.outputType("INVENTORY")
.register();

The example above creates a Category that, when a contenttweaker:chopped_oak item is held and right-clicked, looks like this. It changes the sound to breaking wood, doesn't create any particles, is queuable, and has certain background/border settings applied. The recipe item "frame" is set to the selectioncrafting texture called "chest.png".
Let's move on to adding Recipes for your category!