From a9eb6cb747bafa699218b3a342b642e05096b1e5 Mon Sep 17 00:00:00 2001 From: Guy Liner Date: Wed, 5 Jan 2022 10:44:01 -0500 Subject: [PATCH] Moved that table that contains every monster's light spawning levels to a different file, added some comments --- mods/ENTITIES/mcl_mobs/api/api.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api/api.lua b/mods/ENTITIES/mcl_mobs/api/api.lua index e86827efa..ea7589f47 100644 --- a/mods/ENTITIES/mcl_mobs/api/api.lua +++ b/mods/ENTITIES/mcl_mobs/api/api.lua @@ -144,6 +144,7 @@ dofile(api_path .. "mob_effects.lua") dofile(api_path .. "projectile_handling.lua") dofile(api_path .. "breeding.lua") dofile(api_path .. "head_logic.lua") +dofile(api_path .. "monster_light.lua") mobs.spawning_mobs = {} @@ -610,9 +611,6 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative) --Changes the mob spawner type with the egg that you used to click on it --determining monster spawn lvl - local monster_lightlvl = { - zombie = 0 - } local hold_light = 15 local mon_name @@ -622,12 +620,16 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative) mon_name = name:gsub(":", "") end + --For every monster in the monster_lightlvl table check if + --it matches the spawn egg you're holding for name, lightlvl in pairs(monster_lightlvl) do print(mon_name == name) if name == mon_name then hold_light = lightlvl end end + + --Switch out the mob spawner to spawn mobs from the egg that you're holding mcl_mobspawners.setup_spawner(pointed_thing.under, itemstack:get_name(), 0, hold_light) if not mobs.is_creative(name) then