Fix wrong self ref with mcl_mobs.spawn_child

This commit is contained in:
cora 2022-11-27 21:14:19 +01:00
parent 318da7e3c9
commit 69c64a2c24
5 changed files with 6 additions and 6 deletions

@ -441,7 +441,7 @@ local horse = {
on_breed = function(parent1, parent2) on_breed = function(parent1, parent2)
local pos = parent1.object:get_pos() local pos = parent1.object:get_pos()
local child = mcl_mobs:spawn_child(pos, parent1.name) local child = mcl_mobs.spawn_child(pos, parent1.name)
if child then if child then
local ent_c = child:get_luaentity() local ent_c = child:get_luaentity()
local p = math.random(1, 2) local p = math.random(1, 2)

@ -221,7 +221,7 @@ mcl_mobs.register_mob("mobs_mc:llama", {
else else
parent = parent2 parent = parent2
end end
child = mcl_mobs:spawn_child(pos, parent.name) child = mcl_mobs.spawn_child(pos, parent.name)
if child then if child then
local ent_c = child:get_luaentity() local ent_c = child:get_luaentity()
ent_c.base_texture = table.copy(ent_c.base_texture) ent_c.base_texture = table.copy(ent_c.base_texture)

@ -186,7 +186,7 @@ mcl_mobs.register_mob("mobs_mc:pig", {
on_breed = function(parent1, parent2) on_breed = function(parent1, parent2)
local pos = parent1.object:get_pos() local pos = parent1.object:get_pos()
local child = mcl_mobs:spawn_child(pos, parent1.name) local child = mcl_mobs.spawn_child(pos, parent1.name)
if child then if child then
local ent_c = child:get_luaentity() local ent_c = child:get_luaentity()
ent_c.tamed = true ent_c.tamed = true

@ -267,7 +267,7 @@ mcl_mobs.register_mob("mobs_mc:sheep", {
on_breed = function(parent1, parent2) on_breed = function(parent1, parent2)
-- Breed sheep and choose a fur color for the child. -- Breed sheep and choose a fur color for the child.
local pos = parent1.object:get_pos() local pos = parent1.object:get_pos()
local child = mcl_mobs:spawn_child(pos, parent1.name) local child = mcl_mobs.spawn_child(pos, parent1.name)
if child then if child then
local ent_c = child:get_luaentity() local ent_c = child:get_luaentity()
local color1 = parent1.color local color1 = parent1.color

@ -141,7 +141,7 @@ local function egg_on_step(self, dtime)
local r = math.random(1,8) local r = math.random(1,8)
if r == 1 then if r == 1 then
mcl_mobs:spawn_child(self._lastpos, "mobs_mc:chicken") mcl_mobs.spawn_child(self._lastpos, "mobs_mc:chicken")
-- BONUS ROUND: 1/32 chance to spawn 3 additional chicks -- BONUS ROUND: 1/32 chance to spawn 3 additional chicks
local r = math.random(1,32) local r = math.random(1,32)
@ -153,7 +153,7 @@ local function egg_on_step(self, dtime)
} }
for o=1, 3 do for o=1, 3 do
local pos = vector.add(self._lastpos, offsets[o]) local pos = vector.add(self._lastpos, offsets[o])
mcl_mobs:spawn_child(pos, "mobs_mc:chicken") mcl_mobs.spawn_child(pos, "mobs_mc:chicken")
end end
end end
end end