From 1cd488470745cfacc0461b0a92529ba2c897a8ba Mon Sep 17 00:00:00 2001 From: general Date: Sun, 7 Apr 2024 22:18:25 -0400 Subject: [PATCH] mobs:add_mob() can now set mob texture * backported upstream commit ce47b81da56bba7618f1ab62ede0daaca1b88ced --- api.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/api.lua b/api.lua index c422069..6b40299 100644 --- a/api.lua +++ b/api.lua @@ -4011,8 +4011,13 @@ function mobs:add_mob(pos, def) effect(pos, 15, "tnt_smoke.png", 1, 2, 2, 15, 5) end + -- use new texture if found + local new_texture = def.texture or ent.base_texture + if def.child then + ent.mommy_tex = new_texture -- how baby looks when grown + ent.base_texture = new_texture local textures = ent.base_texture -- using specific child texture (if found) @@ -4046,6 +4051,12 @@ function mobs:add_mob(pos, def) }) ent.child = true + -- if not child set new texture + elseif def.texture then + + ent.base_texture = new_texture + + mob:set_properties({textures = new_texture}) end if def.owner then