From dc21b02d04fc6802dbafca83b724f3973a663d8b Mon Sep 17 00:00:00 2001 From: cora Date: Mon, 30 May 2022 02:04:49 +0200 Subject: [PATCH] update old mobs_mc_ horse armor textures --- mods/ENTITIES/mobs_mc/horse.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/horse.lua b/mods/ENTITIES/mobs_mc/horse.lua index 53951b4608..d423c124c1 100644 --- a/mods/ENTITIES/mobs_mc/horse.lua +++ b/mods/ENTITIES/mobs_mc/horse.lua @@ -81,6 +81,20 @@ for b=1, #horse_base do end end +-- in e7898352d890c2414af653eba624939df9c0b8b4 (0.76-dev) all items from mobs_mc were moved to mcl_mobitems +-- this results in existing horses wearing armor would still have the old texture filename in their +-- properties this function updates them. It should be removed some time in the future when we can be +-- reasonably sure all horses that want it get the new nexture. +local function update_textures(self) + local old = "mobs_mc_horse_armor_" + local txt = self.object:get_properties().textures + if txt[2]:find(old) then + txt[2] = txt[2]:gsub(old,"mcl_mobitems_horse_armor_") + self.object:set_properties({textures=txt}) + return + end +end + -- Horse local horse = { description = S("Horse"), @@ -138,7 +152,7 @@ local horse = { max = 2, looting = "common",}, }, - + on_spawn = update_textures, do_custom = function(self, dtime) -- set needed values if not already present