Use 'spawneggs' & 'tnt' to craft 'creeper:spawnegg'

This commit is contained in:
AntumDeluge 2017-05-13 03:42:48 -07:00
parent 3cc1158417
commit 07d7745455
2 changed files with 28 additions and 14 deletions

@ -1 +1,3 @@
default default
spawneggs?
tnt?

@ -325,19 +325,31 @@ end
minetest.register_entity("creeper:creeper",def) minetest.register_entity("creeper:creeper",def)
minetest.register_craftitem("creeper:spawnegg",{ if minetest.get_modpath('spawneggs') and minetest.get_modpath('tnt') then
description = "Creeper Spawn Egg", minetest.register_craftitem("creeper:spawnegg",{
inventory_image = "creeper_spawnegg.png", description = "Creeper Spawn Egg",
stack_max = 64, inventory_image = "creeper_spawnegg.png",
on_place = function(itemstack,placer,pointed_thing) stack_max = 64,
if pointed_thing.type == "node" then on_place = function(itemstack,placer,pointed_thing)
local pos = pointed_thing.above if pointed_thing.type == "node" then
pos.y = pos.y+1 local pos = pointed_thing.above
minetest.add_entity(pos,"creeper:creeper") pos.y = pos.y+1
if not minetest.setting_getbool("creative_mode") then minetest.add_entity(pos,"creeper:creeper")
itemstack:take_item() if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end end
return itemstack
end end
end })
})
minetest.register_craft({
output = 'creeper:spawnegg',
type = 'shapeless',
recipe = {
'spawneggs:egg', 'tnt:tnt',
},
})
minetest.register_alias('spawneggs:creeper', 'creeper:spawnegg')
end