diff --git a/mods/ENTITIES/mobs/api.lua b/mods/ENTITIES/mobs/api.lua index 9cbfad4b..95ef5d47 100644 --- a/mods/ENTITIES/mobs/api.lua +++ b/mods/ENTITIES/mobs/api.lua @@ -988,10 +988,16 @@ local breed = function(self) local ent_c = child:get_luaentity() - -- Use parent's texture - local textures = self.base_texture + + -- Use texture of one of the parents + local p = math.random(1, 2) + if p == 1 then + ent_c.base_texture = self.base_texture + else + ent_c.base_texture = ent.base_texture + end child:set_properties({ - textures = textures, + textures = ent_c.base_texture }) -- tamed and owned by parents' owner diff --git a/mods/ENTITIES/mobs_mc/horse.lua b/mods/ENTITIES/mobs_mc/horse.lua index 9aa5a161..32f010c9 100644 --- a/mods/ENTITIES/mobs_mc/horse.lua +++ b/mods/ENTITIES/mobs_mc/horse.lua @@ -261,7 +261,16 @@ local horse = { on_breed = function(parent1, parent2) local pos = parent1.object:get_pos() - if mobs:spawn_child(pos, parent1.name) then + local child = mobs:spawn_child(pos, parent1.name) + if child then + local ent_c = child:get_luaentity() + local p = math.random(1, 2) + if p == 1 then + ent_c.base_texture = parent1.base_texture + else + ent_c.base_texture = parent2.base_texture + end + child:set_properties({textures = ent_c.base_texture}) return false end end, diff --git a/mods/ENTITIES/mobs_mc/sheep.lua b/mods/ENTITIES/mobs_mc/sheep.lua index 96734fd5..fa419737 100644 --- a/mods/ENTITIES/mobs_mc/sheep.lua +++ b/mods/ENTITIES/mobs_mc/sheep.lua @@ -206,6 +206,22 @@ mobs:register_mob("mobs_mc:sheep", { end if mobs:capture_mob(self, clicker, 0, 5, 70, false, nil) then return end end, + on_breed = function(parent1, parent2) + local pos = parent1.object:get_pos() + local child = mobs:spawn_child(pos, parent1.name) + if child then + local ent_c = child:get_luaentity() + local p = math.random(1, 2) + if p == 1 then + ent_c.base_texture = sheep_texture(parent1.color) + else + ent_c.base_texture = sheep_texture(parent2.color) + end + child:set_properties({textures = ent_c.base_texture}) + ent_c.initial_color_set = true + return false + end + end, }) mobs:spawn_specific("mobs_mc:sheep", mobs_mc.spawn.grassland, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 15000, 3, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max)