Skip to content

Shaped Recipe

Shane Bee edited this page Aug 13, 2023 · 5 revisions

Shaped recipes may seem a little complicated but they're actually quite easy.

Here is the basic Syntax:

register [new] shaped recipe for %itemtype% (using|with ingredients) %itemtypes/materialchoices% with id %string% [in group %string%]

Let's break it down:

Registering a recipe for an item:

register [new] shaped recipe for %itemtype% 

Here we are setting the item which will be the result of this recipe.

Special Note:

Recipes should be registered in a Skript load event. This is due to the fact that recipes are only sent to the player when they log onto the server. If a recipe is registered after the player joins, they will need to re-log to receive the recipe. By only using the Skript load event this ensures all recipes are only registered when the server starts up.

Setting the ingredients:

(using|with ingredients) %itemtypes/materialchoices%

Here we are going to set the ingredient for this recipe. You can use up to 9 items.
If you input 4 or less items, this recipe will be craftable in the player's person crafting grid, as well as a crafting table.
If you input more than 4 items, this recipe will only be craftable in a crafting table. General layout:

# personal crafting grid
1 2
3 4

ex: If creating a recipe using air, diamond, air and diamond it will register like this:

air diamond
air diamond
# crafting table
1 2 3
4 5 6
7 8 9

ex: If creating a recipe using air, diamond, air, air, diamond, air, air, stick and air it will register like this:

air diamond air
air diamond air
air stick air

This also supports material choices
ex:

set {_m1} to material choice of oak planks, spruce planks and acacia planks
set {_m2} to material choice of minecraft tag "logs"
register shaped recipe diamond sword using air, {_m1}, air, air, {_m2}, air, air, wooden sword and air...

Setting the ID:

with id %string%

Here we set the ID (namespace) for the recipe. This will register the recipe to the server with a specific namespace, ex:

with id "my_item"

this will register as skbee:my_item
This id can be used to unlock recipes with this addon, or via Minecraft's recipe command, ie:

/minecraft:recipe give player_name skbee:my_item

When unlocking a recipe via this addon, skbee: is not required, this only required when typing it into Minecraft's commands.
You can also use any namespace of your choosing, ex:

with id "myplugin:some_cool_recipe"

Setting a group:

[in group %string%]

Groups are optional. This will group multiple recipes together. When you open up your recipe book, the recipes will be stacked, when you hover over the recipe you will see the item cycling thru the available recipes, when you right click the recipe, it'll show all the available recipes in this group.
Here is a visual representation showing the groups by setting in group "custom_swords":

Let's bring it all together:

Setting some recipes:

on skript load:
    set {_i1} to diamond sword named "&aEmerald Sword"
    set {_i2} to diamond sword of sharpness 1 named "&aPower Sword"
    set {_i3} to diamond sword of sharpness 5 named "&bSuper Sharp Sword"

    register new shaped recipe for {_i1} using air, emerald, air, air, emerald, air, air, stick and air with id "emerald_sword" in group "custom_swords"
    register new shaped recipe for {_i2} using air, emerald, air, air, emerald, air, air, {_i1} and air with id "power_sword" in group "custom_swords"
    register new shaped recipe for {_i3} using air, emerald, air, air, emerald, air, air, {_i2} and air with id "super_sharp_sword" in group "custom_swords"

As you can see in these examples I created 3 new items. Then I created recipes for all the items. Also to mention I used the 1st item as an ingredient in my 2nd item, and the 2nd item as an ingredient in my 3rd item. Fun hey?!