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

This commit is contained in:
AntumDeluge 2017-05-13 03:42:48 -07:00 committed by Jordan Irwin
parent 84f6c2f3c9
commit 9d4581ec5b
2 changed files with 25 additions and 14 deletions

@ -342,19 +342,29 @@ end
minetest.register_entity("creeper:creeper",def) minetest.register_entity("creeper:creeper",def)
minetest.register_craftitem("creeper:spawnegg",{ if minetest.global_exists("spawneggs") 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

@ -3,3 +3,4 @@ title = Creeper
description = Adds some explosive nuisance. description = Adds some explosive nuisance.
author = Rui author = Rui
depends = default, tnt depends = default, tnt
optional_depends = spawneggs