minetest.spawn_item

From Minetest Developer Wiki
Jump to navigation Jump to search

Syntax

<source>minetest.spawn_item(pos, item)</source>


Description

This function spawns a <source enclose="none">"__builtin:item"</source> at pos and returns its object.

Examples

<source> function nodeName() local zahl = math.random(1, 10)


if zahl < 10 then name = "default:diamond" end

if zahl < 5 then name = "default:apple 5" end end

minetest.after(5,function() for i = 10000,1,-1 do nodeName() minetest.add_item({x=math.random(-1000,1000), y=math.random(30), z=math.random(-1000,1000)}, name) minetest.chat_send_all(name) end end) </source> This will spawn 1000 apples or diamonds in a range from -1000 to 1000 blocks in x and z.

Mbox important.png This article is incomplete.
Please help expand this article to include more useful information.