summaryrefslogtreecommitdiffstats
path: root/Server/Plugins/APIDump/Hooks/OnCraftingNoRecipe.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Server/Plugins/APIDump/Hooks/OnCraftingNoRecipe.lua')
-rw-r--r--Server/Plugins/APIDump/Hooks/OnCraftingNoRecipe.lua32
1 files changed, 32 insertions, 0 deletions
diff --git a/Server/Plugins/APIDump/Hooks/OnCraftingNoRecipe.lua b/Server/Plugins/APIDump/Hooks/OnCraftingNoRecipe.lua
new file mode 100644
index 000000000..7cd86b8b8
--- /dev/null
+++ b/Server/Plugins/APIDump/Hooks/OnCraftingNoRecipe.lua
@@ -0,0 +1,32 @@
+return
+{
+ HOOK_CRAFTING_NO_RECIPE =
+ {
+ CalledWhen = " No built-in crafting recipe is found. Plugin may provide a recipe.",
+ DefaultFnName = "OnCraftingNoRecipe", -- also used as pagename
+ Desc = [[
+ This callback is called when a player places items in their {{cCraftingGrid|crafting grid}} and
+ Cuberite cannot find a built-in {{cCraftingRecipe|recipe}} for the combination. Plugins may provide
+ a recipe for the ingredients given.
+ ]],
+ Params =
+ {
+ { Name = "Player", Type = "{{cPlayer}}", Notes = "The player whose crafting is reported in this hook" },
+ { Name = "Grid", Type = "{{cCraftingGrid}}", Notes = "Contents of the player's crafting grid" },
+ { Name = "Recipe", Type = "{{cCraftingRecipe}}", Notes = "The recipe that will be used (can be filled by plugins)" },
+ },
+ Returns = [[
+ If the function returns false or no value, no recipe will be used. If the function returns true, no
+ other plugin will have their callback called for this event and Cuberite will use the crafting
+ recipe in Recipe.</p>
+ <p>
+ FIXME: To allow plugins give suggestions and overwrite other plugins' suggestions, we should change
+ the behavior with returning false, so that the recipe will still be used, but fill the recipe with
+ empty values by default.
+ ]],
+ }, -- HOOK_CRAFTING_NO_RECIPE
+}
+
+
+
+