Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Recipe Manager

Tuke-Nuke edited this page Dec 9, 2016 · 2 revisions

Syntax

(create|register) [new] [custom] shaped recipe with (return|result) %itemstack% using [ingredients] %itemstacks% [with shape %strings%]
(create|register) [new] [custom] shapeless recipe with (return|result) %itemstack% using [ingredients] %itemstacks%
(create|register) [new] [custom] furnace recipe with (return|result) %itemstack% using [source] %itemstack% [with experience %number%]

About all recipes: As Bukkit doesn't let you to use ingredients with custom names, lore, nbt, I'm doing it for myself. So far, only shaped and shapeless recipes is working partially fine. There is no how to check the source item for the furnace recipe, so it only get the id and data. You don't need to register the air, only if you want to have it in the recipe.

About shapeless recipe: Nothing much to say, the items doesn't have a right order to match the recipe, e.g the crafting of a book (3 papers and a leather).

About furnace recipe: As said above, the source item will only check the id and data, no planning to add this possibility since the events isn't 'precise' for it. The result item can have name and lore as well, and it can register with a amount of experience that that recipe should give.

About shaped recipe: This one requires a little bit more attention because of the with shape ... thing. Shape is basically a string representation of the items that should be in the crafting slots. For example, the register shaped recipe ... with shape "123", "456" and "789", it is the same as the numbers was representing each slot in a crafting inventory. When you register a shaped recipe, it will assign, in order, the item X with X character from shape, for example:

create shaped recipe with result glass using stone and stick with shape "aba"

The stone (first igrendient) will be the a (first alphabetical character) from the shape, the stick(second ingredient) will be the second character, b.

In a crafting inventory, it will be like:

[a] [b] [a]
[ ] [ ] [ ]   ->   [T] #Where's the 'a' matches a stone, and the 'b' matches a stick.
[ ] [ ] [ ]

[ ] [ ] [ ]
[a] [b] [a]   ->   [T] #True because the shape only check horizontal matching.
[ ] [ ] [ ]

[a] [b] [ ]
[ ] [ ] [a]   ->   [F] #Doesn't match.
[ ] [ ] [ ]

[b] [a] [b]
[ ] [ ] [ ]   ->   [F] #False, the order isn't right.
[ ] [ ] [ ]

You can only have a maximum of 3 strings with each one having 3 characters in shape. If you don't specify a shape, it will by default use "abc", "def" and "ghi" and complete the missing item stacks with air.

Known bugs: As I'm making the thing with ingredients, there is somethings to fix.

  • Recipes (shaped and shapeless) that doesn't have 9 items doesn't match correctly the recipe.
  • Same bug above but little different with shapeless recipe: As the items doesn't have an correct order, it still buggy to check the items.
  • Prevent to register more than 3 strings and more than 3 characters each one (If you do, I think it will throw a console error).

If you register normal ingredients, without name and lore, the bugs above shouldn't happen.

Clone this wiki locally