From d3c591915f1f3ab35d9275b4e6ca9d8a746ad748 Mon Sep 17 00:00:00 2001 From: codiac Date: Sun, 21 Jan 2024 02:52:36 +0000 Subject: [PATCH] Fix light check and limit Y level for slime chunk spawn. (#4139) Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/4139 Reviewed-by: the-real-herowl Co-authored-by: codiac Co-committed-by: codiac --- mods/ENTITIES/mobs_mc/slime+magma_cube.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua index 85f0e189d..743f37cee 100644 --- a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua +++ b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua @@ -6,6 +6,7 @@ local MAPBLOCK_SIZE = 16 local seed = minetest.get_mapgen_setting("seed") local slime_chunk_match +local slime_chunk_spawn_max = mcl_worlds.layer_to_y(40) local x_modifier local z_modifier @@ -166,11 +167,11 @@ local swamp_light_max = 7 local function slime_spawn_check(pos, environmental_light, artificial_light, sky_light) local maxlight = swamp_light_max - if is_slime_chunk(pos) then + if pos.y <= slime_chunk_spawn_max and is_slime_chunk(pos) then maxlight = minetest.LIGHT_MAX + 1 end - return artificial_light <= maxlight + return math.max(artificial_light, sky_light) <= maxlight end -- Slime