From Minetest Developer Wiki
minetest.register_on_item_eat(func(hp_change, replace_with_item, itemstack, user, pointed_thing))
- Available in 0.4.10+
hp_change— The HP change due to eating the item, from minetest.item_eat().
replace_with_item— Replacement for the item, for use in add_item(). Can be nil.
itemstack— The itemstack holding the item being eaten, from the
user— The Player object for the player eating the item, from the
pointed_thing— Where the player is looking while eating the item, from the
This article is incomplete.
This article is missing examples, feel free to add them.