2013-11-23 15:26:24 -05:00
|
|
|
return
|
|
|
|
{
|
|
|
|
HOOK_PRE_CRAFTING =
|
|
|
|
{
|
|
|
|
CalledWhen = "Before the built-in recipes are checked.",
|
|
|
|
DefaultFnName = "OnPreCrafting", -- also used as pagename
|
|
|
|
Desc = [[
|
|
|
|
This hook is called when a {{cPlayer|player}} changes contents of their
|
2015-08-13 04:19:24 -04:00
|
|
|
{{cCraftingGrid|crafting grid}}, before the built-in recipes are searched for a match by Cuberite.
|
2013-11-23 15:26:24 -05:00
|
|
|
Plugins may use this hook to provide a custom recipe.</p>
|
|
|
|
<p>
|
|
|
|
If you intend to tweak built-in recipes, use the {{OnPostCrafting|HOOK_POST_CRAFTING}} hook, because
|
|
|
|
that will be called once the built-in recipe is matched.</p>
|
|
|
|
<p>
|
2015-08-13 04:19:24 -04:00
|
|
|
Also note a third hook, {{OnCraftingNoRecipe|HOOK_CRAFTING_NO_RECIPE}}, that is called when Cuberite
|
2013-11-23 15:26:24 -05:00
|
|
|
cannot find any built-in recipe for the given ingredients.
|
|
|
|
]],
|
|
|
|
Params =
|
|
|
|
{
|
|
|
|
{ Name = "Player", Type = "{{cPlayer}}", Notes = "The player who has changed their crafting grid contents" },
|
|
|
|
{ Name = "Grid", Type = "{{cCraftingGrid}}", Notes = "The new crafting grid contents" },
|
2015-08-11 16:48:55 -04:00
|
|
|
{ Name = "Recipe", Type = "{{cCraftingRecipe}}", Notes = "The recipe that Cuberite will use. Modify this object to change the recipe" },
|
2013-11-23 15:26:24 -05:00
|
|
|
},
|
|
|
|
Returns = [[
|
2015-08-13 04:19:24 -04:00
|
|
|
If the function returns false or no value, other plugins' callbacks are called and then Cuberite
|
2013-11-23 15:26:24 -05:00
|
|
|
searches the built-in recipes. The Recipe output parameter is ignored in this case.</p>
|
|
|
|
<p>
|
2015-08-11 16:48:55 -04:00
|
|
|
If the function returns true, no other callbacks are called for this event and Cuberite uses the
|
2013-11-23 15:26:24 -05:00
|
|
|
recipe stored in the Recipe output parameter.
|
|
|
|
]],
|
|
|
|
}, -- HOOK_PRE_CRAFTING
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|