From 3845369237e9d50171252edfec580259f30580ae Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 15 Aug 2017 14:16:40 +0200 Subject: [PATCH] Fix generated mob spawners sometimes have pig --- mods/ITEMS/mcl_mobspawners/init.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_mobspawners/init.lua b/mods/ITEMS/mcl_mobspawners/init.lua index b7fb4983..d5c7fed3 100644 --- a/mods/ITEMS/mcl_mobspawners/init.lua +++ b/mods/ITEMS/mcl_mobspawners/init.lua @@ -214,7 +214,20 @@ minetest.register_node("mcl_mobspawners:spawner", { is_ground_content = false, drop = "", - on_construct = mcl_mobspawners.setup_spawner, + on_place = function(itemstack, placer, pointed_thing) + local node_under = minetest.get_node(pointed_thing.under) + local new_itemstack, success = minetest.item_place(itemstack, placer, pointed_thing) + if success then + local placepos + if minetest.registered_nodes[node_under.name].buildable_to then + placepos = pointed_thing.under + else + placepos = pointed_thing.above + end + mcl_mobspawners.setup_spawner(placepos) + end + return new_itemstack + end, on_destruct = function(pos) local meta = minetest.get_meta(pos)