Added values for the light levels parameters for mcl_mobspawners.setup_spawner(), fixing issue #221

This commit is contained in:
GuyLiner 2023-02-08 13:33:35 -05:00 committed by Gitea
parent 44c452bf25
commit 819e2b4d36
1 changed files with 10 additions and 1 deletions

View File

@ -505,7 +505,16 @@ function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addeg
local name = placer:get_player_name()
local privs = minetest.get_player_privs(name)
local dim = mcl_worlds.pos_to_dimension(placer:get_pos())
-- the attribute in the light_levels table for mobs is "the_end" instead of "end"
if dim == "end" then
dim = "the_end"
end
local mob_light_level = {
light_max = mcl_mobs.registered_mobs[itemstack:get_name()].light_max,
light_min = mcl_mobs.registered_mobs[itemstack:get_name()].light_min
}
if under.name == "mcl_mobspawners:spawner" then
if minetest.is_protected(pointed_thing.under, name) then
minetest.record_protection_violation(pointed_thing.under, name)
@ -515,7 +524,7 @@ function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addeg
minetest.chat_send_player(name, S("You need the “maphack” privilege to change the mob spawner."))
return itemstack
end
mcl_mobspawners.setup_spawner(pointed_thing.under, itemstack:get_name())
mcl_mobspawners.setup_spawner(pointed_thing.under, itemstack:get_name(), mob_light_level.light_min[dim], mob_light_level.light_max[dim])
if not minetest.is_creative_enabled(name) then
itemstack:take_item()
end