From 6d336ee8793afccf5b56d4ef17468c6ea056dfea Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 24 Aug 2022 02:55:15 +0200 Subject: [PATCH 1/2] Fix tropical fish empty texture array --- mods/ENTITIES/mobs_mc/tropical_fish.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/tropical_fish.lua b/mods/ENTITIES/mobs_mc/tropical_fish.lua index d963665b2..fb321de96 100644 --- a/mods/ENTITIES/mobs_mc/tropical_fish.lua +++ b/mods/ENTITIES/mobs_mc/tropical_fish.lua @@ -72,7 +72,7 @@ local tropical_fish = { collisionbox = {-0.2, 0.0, -0.2, 0.2, 0.1, 0.2}, visual = "mesh", mesh = "extra_mobs_tropical_fish_a.b3d", - textures = {}, -- to be populated on_spawn + textures = { "extra_mobs_tropical_fish_a.png" }, -- to be populated on_spawn sounds = {}, animation = { stand_start = 0, From ccfbc7da141a46e70631cc0851c0f0e34debf455 Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 24 Aug 2022 02:56:37 +0200 Subject: [PATCH 2/2] Make sure math.random gets a >0 argument --- mods/ENTITIES/mcl_mobs/api.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index b3dd76e17..ea93915a5 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -3467,7 +3467,10 @@ local mob_activate = function(self, staticdata, def, dtime) def.textures = {def.textures} end - self.base_texture = def.textures[random(1, #def.textures)] + local c = 1 + if #def.textures > c then c = #def.textures end + + self.base_texture = def.textures[math.random(c)] self.base_mesh = def.mesh self.base_size = self.visual_size self.base_colbox = self.collisionbox