diff --git a/api.lua b/api.lua index a019c79..088d513 100644 --- a/api.lua +++ b/api.lua @@ -3846,6 +3846,8 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative) local mob = minetest.add_entity(pos, mob, data) local ent = mob:get_luaentity() + if not ent then return end -- sanity check + -- set owner if not a monster if ent.type ~= "monster" then ent.owner = placer:get_player_name() @@ -3891,6 +3893,8 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative) local mob = minetest.add_entity(pos, mob) local ent = mob:get_luaentity() + if not ent then return end -- sanity check + -- don't set owner if monster or sneak pressed if ent.type ~= "monster" and not placer:get_player_control().sneak then