summaryrefslogtreecommitdiff
path: root/builtin/misc_register.lua
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/misc_register.lua')
-rw-r--r--builtin/misc_register.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/builtin/misc_register.lua b/builtin/misc_register.lua
index f1d816124..aa8399f16 100644
--- a/builtin/misc_register.lua
+++ b/builtin/misc_register.lua
@@ -230,6 +230,20 @@ function minetest.register_biome(biome)
register_biome_raw(biome)
end
+function minetest.on_craft(itemstack, player, old_craft_list, craft_inv)
+ for _, func in ipairs(minetest.registered_on_crafts) do
+ itemstack = func(itemstack, player, old_craft_list, craft_inv) or itemstack
+ end
+ return itemstack
+end
+
+function minetest.craft_predict(itemstack, player, old_craft_list, craft_inv)
+ for _, func in ipairs(minetest.registered_craft_predicts) do
+ itemstack = func(itemstack, player, old_craft_list, craft_inv) or itemstack
+ end
+ return itemstack
+end
+
-- Alias the forbidden item names to "" so they can't be
-- created via itemstrings (e.g. /give)
local name
@@ -327,4 +341,6 @@ minetest.registered_on_joinplayers, minetest.register_on_joinplayer = make_regis
minetest.registered_on_leaveplayers, minetest.register_on_leaveplayer = make_registration()
minetest.registered_on_player_receive_fields, minetest.register_on_player_receive_fields = make_registration_reverse()
minetest.registered_on_cheats, minetest.register_on_cheat = make_registration()
+minetest.registered_on_crafts, minetest.register_on_craft = make_registration()
+minetest.registered_craft_predicts, minetest.register_craft_predict = make_registration()