From 9e60d24fe06714af231ad6b546e7968524ff4127 Mon Sep 17 00:00:00 2001
From: cora <coradelamouche@gmx.ch>
Date: Wed, 13 Jul 2022 16:45:41 +0200
Subject: [PATCH] Never spawn mobs on leaves

---
 mods/ENTITIES/mcl_mobs/spawning.lua | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua
index e4988183d..2108ecf41 100644
--- a/mods/ENTITIES/mcl_mobs/spawning.lua
+++ b/mods/ENTITIES/mcl_mobs/spawning.lua
@@ -428,6 +428,7 @@ if mobs_spawn then
 
 		local is_water = get_item_group(gotten_node, "water") ~= 0
 		local is_lava  = get_item_group(gotten_node, "lava") ~= 0
+		local is_leaf  = get_item_group(gotten_node, "leaves") ~= 0
 		local is_ground = not (is_water or is_lava)
 		local is_grass = minetest.get_item_group(gotten_node,"grass_block") ~= 0
 		local has_bed = minetest.find_node_near(pos,25,{"group:bed"})
@@ -469,6 +470,7 @@ if mobs_spawn then
 				and gotten_light >= mob_def.min_light
 				and gotten_light <= mob_def.max_light
 				and (is_ground or mob_def.type_of_spawning ~= "ground")
+				and (mob_def.type_of_spawning ~= "ground" or not is_leaf)
 				and (mob_def.check_position and mob_def.check_position(spawning_position) or true)
 				and (not is_farm_animal(mob_def.name) or is_grass)
 				and (mob_type ~= "npc" or has_bed)