From 8af26e2e75e9f17c12febd135c806e2762538b52 Mon Sep 17 00:00:00 2001
From: teknomunk <teknomunk@protonmail.com>
Date: Tue, 18 Jun 2024 19:01:39 -0500
Subject: [PATCH] Replace biome_check() with table.find()

---
 mods/ENTITIES/mcl_mobs/spawning.lua | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua
index 8c31c1619..cc8f1c555 100644
--- a/mods/ENTITIES/mcl_mobs/spawning.lua
+++ b/mods/ENTITIES/mcl_mobs/spawning.lua
@@ -508,17 +508,6 @@ local function get_next_mob_spawn_pos(pos)
 	return spawning_position_list[math_random(1, #spawning_position_list)]
 end
 
---a simple helper function for mob_spawn
-local function biome_check(biome_list, biome_goal)
-	if not biome_goal then return false end
-	for _, data in pairs(biome_list) do
-		if data == biome_goal then
-			return true
-		end
-	end
-	return false
-end
-
 local function is_farm_animal(n)
 	return n == "mobs_mc:pig" or n == "mobs_mc:cow" or n == "mobs_mc:sheep" or n == "mobs_mc:chicken" or n == "mobs_mc:horse" or n == "mobs_mc:donkey"
 end
@@ -699,7 +688,7 @@ local function spawn_check(pos, spawn_def)
 	-- Make sure the biome is correct
 	local biome_name = get_biome_name(pos)
 	if not biome_name then return end
-	if not biome_check(spawn_def.biomes, biome_name) then return log_fail("incorrect biome") end
+	if not table.find(spawn_def.biomes, biome_name) then return log_fail("incorrect biome") end
 
 	-- Never spawn directly on bedrock
 	if gotten_node == "mcl_core:bedrock" then return log_fail("tried to spawn on bedrock") end