From 9afe5da7b4bdc588bc2151bfab3f0e111bcd5906 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 31 May 2018 17:32:13 +0200 Subject: [PATCH] Make sure bred pig and sheep stay tamed and owned --- mods/ENTITIES/mobs_mc/pig.lua | 6 +++++- mods/ENTITIES/mobs_mc/sheep.lua | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/pig.lua b/mods/ENTITIES/mobs_mc/pig.lua index fede3f111..d5228a2b0 100644 --- a/mods/ENTITIES/mobs_mc/pig.lua +++ b/mods/ENTITIES/mobs_mc/pig.lua @@ -171,7 +171,11 @@ mobs:register_mob("mobs_mc:pig", { 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() + ent_c.tamed = true + ent_c.owner = parent1.owner return false end end, diff --git a/mods/ENTITIES/mobs_mc/sheep.lua b/mods/ENTITIES/mobs_mc/sheep.lua index 9f6d95e85..331d80c26 100644 --- a/mods/ENTITIES/mobs_mc/sheep.lua +++ b/mods/ENTITIES/mobs_mc/sheep.lua @@ -248,6 +248,8 @@ mobs:register_mob("mobs_mc:sheep", { end child:set_properties({textures = ent_c.base_texture}) ent_c.initial_color_set = true + ent_c.tamed = true + ent_c.owner = parent1.owner return false end end,