minetest.register_on_item_eat

From Minetest Developer Wiki
Jump to: navigation, search

Syntax

minetest.register_on_item_eat(func(hp_change, replace_with_item, itemstack, user, pointed_thing))

Description

Available in 0.4.10+

Registers a callback that is called when an item is eaten, by minetest.item_eat(). Return true or an ItemStack from the callback to cancel the default item east response (e.g. HP increase).

  • 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 on_use callback.
  • user — The Player object for the player eating the item, from the on_use callback.
  • pointed_thing — Where the player is looking while eating the item, from the on_use callback.
Mbox important.png This article is incomplete.
Please help expand this article to include more useful information.
Mbox information.png This article is missing examples.
Feel free to add them.
Personal tools
Namespaces

Variants
Actions
Navigation
API
Toolbox