From 9d4581ec5bfdc46d3e74ff4dc09b34006d7d0ed6 Mon Sep 17 00:00:00 2001 From: AntumDeluge Date: Sat, 13 May 2017 03:42:48 -0700 Subject: [PATCH] Use 'spawneggs' & 'tnt' to craft 'creeper:spawnegg' --- init.lua | 38 ++++++++++++++++++++++++-------------- mod.conf | 1 + 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/init.lua b/init.lua index 21dab1e..caecd8b 100644 --- a/init.lua +++ b/init.lua @@ -342,19 +342,29 @@ end minetest.register_entity("creeper:creeper",def) -minetest.register_craftitem("creeper:spawnegg",{ - description = "Creeper Spawn Egg", - inventory_image = "creeper_spawnegg.png", - stack_max = 64, - on_place = function(itemstack,placer,pointed_thing) - if pointed_thing.type == "node" then - local pos = pointed_thing.above - pos.y = pos.y+1 - minetest.add_entity(pos,"creeper:creeper") - if not minetest.setting_getbool("creative_mode") then - itemstack:take_item() +if minetest.global_exists("spawneggs") then + minetest.register_craftitem("creeper:spawnegg",{ + description = "Creeper Spawn Egg", + inventory_image = "creeper_spawnegg.png", + stack_max = 64, + on_place = function(itemstack,placer,pointed_thing) + if pointed_thing.type == "node" then + local pos = pointed_thing.above + pos.y = pos.y+1 + minetest.add_entity(pos,"creeper:creeper") + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + return itemstack end - return itemstack end - end -}) + }) + + minetest.register_craft({ + output = "creeper:spawnegg", + type = "shapeless", + recipe = {"spawneggs:egg", "tnt:tnt",}, + }) + + minetest.register_alias("spawneggs:creeper", "creeper:spawnegg") +end diff --git a/mod.conf b/mod.conf index 515dbd1..7a632a8 100644 --- a/mod.conf +++ b/mod.conf @@ -3,3 +3,4 @@ title = Creeper description = Adds some explosive nuisance. author = Rui depends = default, tnt +optional_depends = spawneggs