do not regiter mobs if there is not a mob

* backported from undocumented upstream
  commit 812f18430c343c9ac70b83276faa3aabf5a25116
main
general 2024-04-07 21:59:29 -04:00
parent d0938ff178
commit 81066c8b92
1 changed files with 10 additions and 0 deletions

10
api.lua
View File

@ -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", {