From 3850fc1a9fc4340026b8ab11fca7425679053d1f Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 17 Mar 2024 20:54:39 +0000 Subject: [PATCH] Limit y range to the same hemisphere (top/bottom) --- mods/ENTITIES/mcl_mobs/spawning.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index e2047238d..0191059ff 100755 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -618,10 +618,20 @@ local function get_next_mob_spawn_pos(pos) return nil end + local y_min + local y_max + if goal_pos.y > pos.y then + y_min = math_round(pos.y) + y_max = math_round(pos.y) + MOB_SPAWN_ZONE_MIDDLE + else + y_min = math_round(pos.y) - MOB_SPAWN_ZONE_MIDDLE + y_max = math_round(pos.y) + end + -- Ask engine for valid spawn locations local spawning_position_list = find_nodes_in_area_under_air( - {x = goal_pos.x, y = math_round(pos.y) - MOB_SPAWN_ZONE_MIDDLE, z = goal_pos.z}, - {x = goal_pos.x, y = math_round(pos.y) + MOB_SPAWN_ZONE_MIDDLE, z = goal_pos.z}, + {x = goal_pos.x, y = y_min, z = goal_pos.z}, + {x = goal_pos.x, y = y_max, z = goal_pos.z}, {"group:solid", "group:water", "group:lava"} )