minetest.item_eat

From Minetest Developer Wiki
Jump to: navigation, search

Contents

Syntax

minetest.item_eat(hp_change, replace_with_item)

Description

Eat the item. replace_with_item can be nil. Returns a function for the on_use callback in the node, tool, or craft item definition table.

Example

minetest.register_node("default:apple", {
	description = "Apple",
	drawtype = "plantlike",
	visual_scale = 1.0,
	tiles ={"default_apple.png"},
	inventory_image = "default_apple.png",
	paramtype = "light",
	sunlight_propagates = true,
	walkable = false,
	groups = {fleshy=3,dig_immediate=3},
	on_use = minetest.item_eat(4),
	sounds = default.node_sound_defaults(),
})

See also

minetest.do_item_eat

Personal tools
Namespaces

Variants
Actions
Navigation
API
Toolbox