breed by throwing bread at villagers
This commit is contained in:
parent
e6b65af3b4
commit
9a866e873e
|
@ -1241,7 +1241,18 @@ mobs:register_mob("mobs_mc:villager", {
|
||||||
look_at_player = true,
|
look_at_player = true,
|
||||||
pick_up = {"mcl_farming:bread"},
|
pick_up = {"mcl_farming:bread"},
|
||||||
on_pick_up = function(self,itementity)
|
on_pick_up = function(self,itementity)
|
||||||
minetest.log("picked up "..itementity.itemstring)
|
local clicker
|
||||||
|
for _,p in pairs(minetest.get_connected_players()) do
|
||||||
|
if vector.distance(p:get_pos(),self.object:get_pos()) < 10 then
|
||||||
|
clicker = p
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not clicker then minetest.log("no clicker") end
|
||||||
|
if clicker then
|
||||||
|
mobs:feed_tame(self, clicker, 1, true, true)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
return true --do not pick up
|
||||||
end,
|
end,
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
local trg=vector.new(0,9,0)
|
local trg=vector.new(0,9,0)
|
||||||
|
@ -1250,10 +1261,6 @@ mobs:register_mob("mobs_mc:villager", {
|
||||||
--minetest.log("arrived at jobsite")
|
--minetest.log("arrived at jobsite")
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
if clicker:get_wielded_item():get_name() == "mcl_farming:bread" then
|
|
||||||
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
|
||||||
if mobs:protect(self, clicker) then return end
|
|
||||||
end
|
|
||||||
if self.child or self._profession == "unemployed" then
|
if self.child or self._profession == "unemployed" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue