summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-10-15 17:43:41 +0200
committermadmaxoft <github@xoft.cz>2013-10-15 17:43:41 +0200
commitedd1a670edf97500aa9a8f68fd2ea0b68bcc8d55 (patch)
treeb7e99fcc52a8edfc38689af4dd55d0efb651ef27
parentAPIDump: Documented HOOK_POST_CRAFTING. (diff)
downloadcuberite-edd1a670edf97500aa9a8f68fd2ea0b68bcc8d55.tar
cuberite-edd1a670edf97500aa9a8f68fd2ea0b68bcc8d55.tar.gz
cuberite-edd1a670edf97500aa9a8f68fd2ea0b68bcc8d55.tar.bz2
cuberite-edd1a670edf97500aa9a8f68fd2ea0b68bcc8d55.tar.lz
cuberite-edd1a670edf97500aa9a8f68fd2ea0b68bcc8d55.tar.xz
cuberite-edd1a670edf97500aa9a8f68fd2ea0b68bcc8d55.tar.zst
cuberite-edd1a670edf97500aa9a8f68fd2ea0b68bcc8d55.zip
-rw-r--r--MCServer/Plugins/APIDump/APIDesc.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index 9430f370d..caa0f6bd8 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -2893,6 +2893,36 @@ end;
]],
}, -- HOOK_POST_CRAFTING
+ 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
+ {{cCraftingGrid|crafting grid}}, before the built-in recipes are searched for a match by MCServer.
+ 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>
+ Also note a third hook, {{OnCraftingNoRecipe|HOOK_CRAFTING_NO_RECIPE}}, that is called when MCServer
+ 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" },
+ { Name = "Recipe", Type = "{{cCraftingRecipe}}", Notes = "The recipe that MCServer will use. Modify this object to change the recipe" },
+ },
+ Returns = [[
+ If the function returns false or no value, other plugins' callbacks are called and then MCServer
+ searches the built-in recipes. The Recipe output parameter is ignored in this case.</p>
+ <p>
+ If the function returns true, no other callbacks are called for this event and MCServer uses the
+ recipe stored in the Recipe output parameter.
+ ]],
+ }, -- HOOK_PRE_CRAFTING
+
}, -- Hooks[]