From 81066c8b925e0eca7f9bfc3a9b5f71adea350b02 Mon Sep 17 00:00:00 2001 From: general Date: Sun, 7 Apr 2024 21:59:29 -0400 Subject: [PATCH] do not regiter mobs if there is not a mob * backported from undocumented upstream commit 812f18430c343c9ac70b83276faa3aabf5a25116 --- api.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api.lua b/api.lua index f98aa17..6798740 100644 --- a/api.lua +++ b/api.lua @@ -4518,6 +4518,16 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative) "^[mask:mobs_chicken_egg_overlay.png)" end + -- does mob/entity exist + local is_mob = minetest.registered_entities[mob] + + if not is_mob then + print("[Mobs Redo] Spawn Egg cannot be created for " .. mob) + return + end + -- these are only created for animals and npc mobs, not monsters TODO + -- if is_mob.type ~= "monster" then return end + -- register new spawn egg containing mob information (cannot be stacked) minetest.register_craftitem(mob .. "_set", {