minetest.register_on_craft

From Minetest Developer Wiki
Jump to: navigation, search
Language: English  • Deutsch

Syntax

minetest.register_on_craft(func(itemstack, player, old_craft_grid, craft_inv))

Description

  • Called when player crafts something
  • itemstack is the output
  • old_craft_grid contains the recipe (Note: the one in the inventory is cleared)
  • craft_inv is the inventory with the crafting grid
  • Returns either an ItemStack, to replace the output, or nil, to not modify it
  • IT DOESN'T WORK FOR FURNACE COOKING RECIPES!

Example

minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv)
  minetest.chat_send_all("The player "..player:get_player_name().." has just crafted something")
end)

This sends in the chat when a player has crafted something.

Personal tools
Namespaces

Variants
Actions
Navigation
API
Toolbox