From 92c899e6a45b4ed352a4b7fc05957cceaf51b3ec Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Tue, 7 Apr 2020 08:41:41 +0100 Subject: [PATCH] mob egg sanity checks --- api.lua | 4 ++++ 1 file changed, 4 insertions(+) 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